Class LatticeModel
java.lang.Object
gov.nih.mipav.view.renderer.WildMagic.WormUntwisting.LatticeModel
Supports the worm-straightening algorithms that use a 3D lattice as the basis of the straightening process.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected float[]private int[][]protected float[]private Vector<AnnotationListener> private Stringprivate VOIprotected VOIprotected Vector<WildMagic.LibFoundation.Mathematics.Box3f> protected VOIContourprivate VOIprotected VOIContourprotected WildMagic.LibFoundation.Curves.NaturalSpline3private Vector<boolean[]> private booleanprivate WildMagic.LibGraphics.SceneGraph.TriMesh(package private) Vector<WildMagic.LibFoundation.Mathematics.Vector3f> private Vector<CurveListener> protected final intprivate VOI[]private VOIprotected VOIprivate booleanprotected Vector<WildMagic.LibFoundation.Mathematics.Ellipsoid3f> private booleanprotected VOIContour[]private VOIprivate floatprotected intprotected ModelImageprivate WildMagic.LibFoundation.Mathematics.Vector3fprotected VOIVectorprivate VOIprivate VOIVectorprivate booleanprivate Vector<LatticeListener> private VOIWormAnnotationprotected int[]private VOIVectorprotected VOIprotected VOIprivate VOIprivate VOIprotected VOIContourprivate Vector<WildMagic.LibFoundation.Mathematics.Vector3f> private intprotected final floatprivate booleanEnables the user to visualize the simple ellipse-based model of the worm during lattice construction.protected Vector<WildMagic.LibFoundation.Mathematics.Vector3f> private intprivate intprivate Stringprivate intprivate WildMagic.LibFoundation.Mathematics.Vector3fprivate booleanprotected VOIprotected VOIprivate VOIprivate VOIprotected VOIContourprotected Vector<WildMagic.LibFoundation.Mathematics.Vector3f> protected static final intprotected VOIprivate int[][]private Stringprivate VOIContour[]private VOIprotected Vector<LatticeModel.AnnotationSplineControlPts> private booleanprotected int[]protected WildMagic.LibFoundation.Mathematics.Vector3fprotected Vector<WildMagic.LibFoundation.Mathematics.Vector3f> protected Shortprotected WildMagic.LibFoundation.Mathematics.Vector3f -
Constructor Summary
ConstructorsConstructorDescriptionLatticeModel(ModelImage image) Creates a new LatticeModelLatticeModel(ModelImage image, VOIVector lattice) Creats a new LatticeModel with the given input lattice. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnnotation(VOI textVOI, boolean multiSelect) Add an annotation to the annotation list.voidaddAnnotation(VOIWormAnnotation newText, boolean multiSelect) voidaddAnnotationListener(AnnotationListener listener) Adds an annotation listener.voidaddAnnotations(VOI newAnnotations) Called when new annotations are loaded from file, replaces current annotations.voidaddCurveListener(CurveListener listener) private booleanaddInsertionPoint(WildMagic.LibFoundation.Mathematics.Vector3f startPt, WildMagic.LibFoundation.Mathematics.Vector3f endPt, WildMagic.LibFoundation.Mathematics.Vector3f maxPt, boolean isSeam) Adds a point to the lattice.voidaddLatticeListener(LatticeListener listener) voidaddLeftRightMarker(WildMagic.LibFoundation.Mathematics.Vector3f pt, boolean isSeam) Adds a new left/right marker to the worm image.voidaddNeurite(VOI annotionVOI, String name) Generates a natural spline curve to fit the input set of annotation points to model a neurite.voidaddSplineControlPts(Vector<VOIWormAnnotation> controlPts) Add a curve to the list.private static VOIannotationChanged(VOI annotationsNew, VOI annotationOld) private static ModelImageblur(ModelImage image, int sigma) Returns a blurred image of the input image.static booleanstatic voidcheckParentDir(String parentDir) voidClears the selected VOI or Annotation point.voidEnables user to start editing the lattice.private voidclearCurves(boolean clearGrid) Resets the natural spline curves when the lattice changes.private voidCounts the annotations and colors them based on the number of annotations.voidcolorAnnotations(boolean setColor) private booleancontainsAnnotation(VOI annotationsList, VOIWormAnnotation text) voidvoidvoiddeleteSelectedPoint(boolean doAnnotation) Deletes the selected annotation or lattice point.voiddisplayAnnotation(String name, boolean display) voiddispose()Deletes this LatticeModelprivate static intfill(BitSet surfaceMask, Vector<WildMagic.LibFoundation.Mathematics.Vector3f> seedList, BitSet visited, WildMagic.LibFoundation.Mathematics.Vector3f min, WildMagic.LibFoundation.Mathematics.Vector3f max, int dimX, int dimY, int dimZ) private intvoidstatic voidflipLattice(VOI left, VOI right) protected booleangenerateCurves(float stepSize) Generates the set of natural spline curves to fit the current lattice.private voidgenerateEllipses(int extent) WildMagic.LibGraphics.SceneGraph.TriMeshgenerateTriMesh(boolean returnMesh, boolean saveMesh) WildMagic.LibGraphics.SceneGraph.TriMeshgenerateTriMesh2(boolean returnMesh, boolean saveMesh, int stepSize) WildMagic.LibFoundation.Mathematics.Vector3f[]getBasisVectors(int i) WildMagic.LibFoundation.Mathematics.Vector3fgetCenter(int i) private booleanprivate static floatgetCorrectionFactor(ModelImage image) Returns the amount of correction which should be applied to the z-direction sigma (assuming that correction is requested).intintgetDiameter(int i) private static StringgetImageName(ModelImage image) private ModelImagegetInsideMeshImage(BitSet surfaceMask) private ModelImagegetInsideMeshImage(WildMagic.LibGraphics.SceneGraph.TriMesh mesh) intVector<WildMagic.LibFoundation.Mathematics.Vector3f> WildMagic.LibFoundation.Mathematics.Vector3fReturns the currently selected point, either on the lattice or from the annotation list.WildMagic.LibFoundation.Mathematics.Vector3fgetPicked(WildMagic.LibFoundation.Mathematics.Vector3f pt, boolean doAnnotation) Finds the closest point to the input point and sets it as the currently selected lattice or annotation point.private static StringVector<WildMagic.LibFoundation.Mathematics.Vector3f> getSamplingPlanes(boolean scale) protected doubleGetSquared(WildMagic.LibFoundation.Mathematics.Vector3f point, WildMagic.LibFoundation.Mathematics.Ellipsoid3f ellipsoid) Vector<WildMagic.LibFoundation.Mathematics.Vector3f> booleanvoidinitializeInterpolation(boolean saveStats) protected voidinterpolateContour(VOIContour contour) Interpolates the input contour so that the spacing between contour points is invalid input: '<'= 1 voxel.voidinterpolateLattice(boolean displayResult, boolean useModel, boolean untwistImage, boolean untwistMarkers) Entry point in the lattice-based straightening algorithm.private static WildMagic.LibFoundation.Mathematics.Vector3finverseDiagonal(ModelImage image, int slice, int extent, WildMagic.LibFoundation.Mathematics.Vector3f[] verts, WildMagic.LibFoundation.Mathematics.Vector3f target) booleanisCurveSelected(String name) booleanbooleanprivate booleanloadDiameters(String imageDir) protected VOIContourloadPositions(String imageDir, String name) protected VOIloadSamplePlanes(String imageDir) protected WildMagic.LibFoundation.Mathematics.Ellipsoid3fmakeEllipse(WildMagic.LibFoundation.Mathematics.Vector3f right, WildMagic.LibFoundation.Mathematics.Vector3f up, WildMagic.LibFoundation.Mathematics.Vector3f center, float diameterA, float diameterB, VOIContour ellipse) Generates the 3D 1-voxel thick ellipsoids used in the intial worm model.protected voidmakeEllipse2DA(WildMagic.LibFoundation.Mathematics.Vector3f right, WildMagic.LibFoundation.Mathematics.Vector3f up, WildMagic.LibFoundation.Mathematics.Vector3f center, float radius, VOIContour ellipse) protected voidmakeEllipse2DA(WildMagic.LibFoundation.Mathematics.Vector3f right, WildMagic.LibFoundation.Mathematics.Vector3f up, WildMagic.LibFoundation.Mathematics.Vector3f center, float radius, WildMagic.LibFoundation.Mathematics.Vector3f normal, float curvature, VOIContour ellipse, boolean ellipseCross, float scale) private voidprivate voidmakeSelectionFrame(WildMagic.LibFoundation.Mathematics.Vector3f right, WildMagic.LibFoundation.Mathematics.Vector3f up, WildMagic.LibFoundation.Mathematics.Vector3f center, float diameter, VOIContour ellipse) Generates the VOI that highlights which point (lattice or annotation) is currently selected by the user.static booleanbooleanmodifyAnnotation(WildMagic.LibFoundation.Mathematics.Vector3f pt) Enables the user to move an annotation point with the mouse.booleanmodifyLattice(WildMagic.LibFoundation.Mathematics.Vector3f startPt, WildMagic.LibFoundation.Mathematics.Vector3f endPt, WildMagic.LibFoundation.Mathematics.Vector3f pt) Enables the user to modify the lattice point with the mouse.voidmodifyLeftRightMarker(WildMagic.LibFoundation.Mathematics.Vector3f pt) Sets the currently selected point (lattice or annotation).voidmoveSelectedPoint(WildMagic.LibFoundation.Mathematics.Vector3f direction, boolean doAnnotation) Enables the user to move the selected point (lattice or annotation) with the arrow keys.voidopenNeuriteCurves(String outputDirectory) static voidopenStraightNeuriteCurves(ModelImage image, String outputDirectory) protected WildMagic.LibFoundation.Mathematics.Vector3foriginToStraight(ModelImage model, ModelImage originToStraight, WildMagic.LibFoundation.Mathematics.Vector3f pt, String text) Given a point in the twisted volume, calculates and returns the corresponding point in the straightened image.static VOIreadAnnotationsCSV(String fileName) Read a list of annotations from a CSV file: name,x,y,z,radius (optional)static WildMagic.LibFoundation.Mathematics.Box3f[]readContours(ModelImage image, String subDir, String postScript) static VOIVectorreadLatticeCSV(String fileName) static VOIVectorreadLatticeCSV(String fileName, boolean saveSeamCells) private voidvoidredo()VOI operation redovoidstatic booleanrenameLatticeOnLoad(ModelImage image, VOIVector latticeVector) private WildMagic.LibFoundation.Mathematics.Vector3fretwistAnnotation(VOIWormAnnotation annotation) retwistAnnotations(VOIVector lattice) retwistLattice(VOIVector lattice) static voidsaveAllVOIsTo(String voiDir, ModelImage image) Saves all VOIs to the specified file.static voidsaveAnnotationsAsCSV(String dir, String fileName, VOI annotations) static voidsaveAnnotationsAsCSV(String dir, String fileName, VOI annotations, boolean isCurve) Saves the input annotations to the CSV file in the following format: name,x,y,zprotected VOIsaveAnnotationStatistics(String imageDir, ModelImage model, ModelImage originToStraight, int[] outputDim, String postFix) Saves the annotation statistics to a file.static voidsaveBasisVectorsAsCSV(ModelImage image, String subDir, String postScript, VOIContour positions, Vector<WildMagic.LibFoundation.Mathematics.Vector3f> normals, Vector<WildMagic.LibFoundation.Mathematics.Vector3f> rightVectors, Vector<WildMagic.LibFoundation.Mathematics.Vector3f> upVectors) static voidsaveContourAsCSV(ModelImage image, String subDir, String postScript, VOIContour contour) private voidsaveContours(ModelImage image, WildMagic.LibFoundation.Mathematics.Box3f[] contours) protected voidsaveDiameters(Vector<Float> diameters, String imageDir) static voidsaveImage(ModelImage originalImage, ModelImage image, String subDir, String postScript) private voidsaveImage(String imageName, ModelImage image, boolean saveAsTif) voidEnables the user to save the lattice to a user-selected file.voidsaveLattice(String directory, String fileName) Saves the lattice to the specified file and directory.static voidsaveLattice(String directory, String fileName, VOIVector latticeVector) static voidsaveLattice(String directory, String fileName, String latticeFileName, VOIVector latticeVector) private voidprotected voidsaveLatticeStatistics(String imageDir, float length, VOI left, VOI right, float[] leftPairs, float[] rightPairs, String postFix) Saves the lattice statistics to a file.private voidvoidprotected voidsavePositions(VOIContour contour, String imageDir, String name) protected voidsaveSamplePlanes(VOI planes, String imageDir) private voidsaveSpline(String outputDirectory, VOI data, WildMagic.LibFoundation.Mathematics.Vector3f transformedOrigin, String postFix) static voidsaveTriMesh(ModelImage image, String outputDirectory, String subDir, String postScript, WildMagic.LibGraphics.SceneGraph.TriMesh mesh) segmentLattice(ModelImage image, boolean saveContourImage, int paddingFactor, boolean segmentLattice) voidsegmentLattice(ModelImage image, ModelImage contourImageBlur) booleanselectAnnotation(WildMagic.LibFoundation.Mathematics.Vector3f startPt, WildMagic.LibFoundation.Mathematics.Vector3f endPt, WildMagic.LibFoundation.Mathematics.Vector3f pt, boolean rightMouse, boolean multiSelect) booleanselectLattice(WildMagic.LibFoundation.Mathematics.Vector3f startPt, WildMagic.LibFoundation.Mathematics.Vector3f endPt, WildMagic.LibFoundation.Mathematics.Vector3f pt, boolean isSeam) voidvoidsetAnnotations(VOI newAnnotations) Called when new annotations are loaded from file, replaces current annotations.voidsetCurveName(String oldName, String newName) voidsetCurveSelected(String name, boolean selected) voidsetCurveVisible(String name, boolean visible) voidsetImage(ModelImage image) Change the underlying image for the latticeModel.voidsetLattice(VOIVector newLattice) Called when a new lattice is loaded from file, replaces the current lattice.voidsetMarkers(VOI markerVOIs) voidsetPaddingFactor(int padding) voidsetPreviewMode(boolean preview, VOIVector lattice, VOI annotations) voidsetSharedDirectory(String dir) voidshowLattice(boolean display) Turns on/off lattice display:voidshowLatticeLabels(boolean display) voidshowMarker(int i) voidshowModel(boolean display) protected WildMagic.LibFoundation.Curves.NaturalSpline3smoothCurve(VOIContour curve, float[] time) Generates the Natural Spline for the lattice center-line curve.static WildMagic.LibFoundation.Curves.NaturalSpline3smoothCurve(Vector<VOIWormAnnotation> controlPts) protected WildMagic.LibFoundation.Mathematics.Vector3f[]straightenFrame(ModelImage image, int slice, int[] extents, WildMagic.LibFoundation.Mathematics.Vector3f[] verts, WildMagic.LibFoundation.Mathematics.Vector3f centerPos, WildMagic.LibFoundation.Mathematics.Vector3f leftPos, WildMagic.LibFoundation.Mathematics.Vector3f rightPos) private voidvoidundo()VOI operation undo.private voiduntwist(ModelImage image, int[] resultExtents, boolean saveTif) Straightens the worm image based on the input lattice positions.untwistAnnotations(String dir, ModelImage contourImage) voiduntwistImage(boolean mainImage) Entry point in the lattice-based straightening algorithm.private voiduntwistLattice(ModelImage image, int[] resultExtents) Untwists the lattice and lattice interpolation curves, writing the straightened data to spreadsheet format .csv files and the straightened lattice to a VOI file.voiduntwistMarkers(boolean untwistAll) Entry point in the lattice-based straightening algorithm.private voiduntwistMarkers(ModelImage image, int[] resultExtents) voiduntwistNeuriteCurves(boolean useLatticeModel) private voiduntwistSampleCount(ModelImage image, int[] resultExtents, boolean saveTif) untwistTest(VolumeImage[] stack) Untwists the worm image quickly for the preview mode - without saving any images or statisticsprivate ModelImage[]untwistTest(VolumeImage[] stack, int[] resultExtents) Untwists the worm image quickly for the preview mode - without saving any images or statistics Straightens the worm image based on the input lattice positions.voidupdateAnnotation(VOIWormAnnotation annotation) private voidUpdates the list of listeners that the annotations have changed.voidupdateCrossSection(boolean useSpline, boolean ellipse, float percent) private voidprivate voidupdateEllipseModel(float stepSize) private voidupdateLattice(boolean rebuild) Updates the lattice data structures for rendering whenever the user changes the lattice.voidupdateLattice(boolean isLeft, VOIWormAnnotation text, VOIWormAnnotation newText) private voidprivate voidUpdates the lattice data structures on undo/redo.private voidprivate voidUpdates the VOI displaying which point (lattice or annotation) is currently selected when the selection changes.voidupdateSelectedPoint(Color color) private voidprotected WildMagic.LibFoundation.Mathematics.Vector3fwriteDiagonal(ModelImage image, int slice, int[] extents, WildMagic.LibFoundation.Mathematics.Vector3f[] verts, WildMagic.LibFoundation.Mathematics.Vector3f target, float[] minDistance) protected voidwriteDiagonal(ModelImage image, ModelImage result, int tSlice, int slice, int[] extents, WildMagic.LibFoundation.Mathematics.Vector3f[] verts) protected voidwriteDiagonalSampleCount(ModelImage image, ModelImage result, int tSlice, int slice, int[] extents, WildMagic.LibFoundation.Mathematics.Vector3f[] verts) protected voidwriteDiagonalTest(ModelImage image, ModelImage result, int tSlice, int slice, int[] extents, WildMagic.LibFoundation.Mathematics.Vector3f[] verts, float radiusSq)
-
Field Details
-
SampleLimit
protected static final int SampleLimit- See Also:
-
imageA
-
imageDims
private WildMagic.LibFoundation.Mathematics.Vector3f imageDims -
outputDirectory
-
lattice
-
left
-
leftContour
-
right
-
rightContour
-
latticeGrid
-
center
-
latticeSlices
protected int[] latticeSlices -
afTimeC
protected float[] afTimeC -
allTimes
protected float[] allTimes -
splineRangeIndex
protected int[] splineRangeIndex -
centerSpline
protected WildMagic.LibFoundation.Curves.NaturalSpline3 centerSpline -
centerPositions
-
leftPositions
-
rightPositions
-
leftLine
-
rightLine
-
centerLine
-
wormDiameters
-
extent
protected int extent -
rightVectors
-
normalVectors
-
upVectors
-
curvatureNormals
Vector<WildMagic.LibFoundation.Mathematics.Vector3f> curvatureNormals -
curvature
-
boxBounds
-
ellipseBounds
-
latticeInterpolationInit
private boolean latticeInterpolationInit -
samplingPlanes
-
maxSplineLength
private int maxSplineLength -
displayContours
-
displayContours2
-
ellipseCurvesVOI
-
ellipseCurves
-
displayInterpolatedContours
-
pickedPoint
private WildMagic.LibFoundation.Mathematics.Vector3f pickedPoint -
showSelectedVOI
-
showSelected
-
DiameterBuffer
protected final int DiameterBuffer- See Also:
-
minRange
protected final float minRange- See Also:
-
leftMarker
-
rightMarker
-
annotationVOIs
-
wormOrigin
protected WildMagic.LibFoundation.Mathematics.Vector3f wormOrigin -
transformedOrigin
protected WildMagic.LibFoundation.Mathematics.Vector3f transformedOrigin -
neuriteData
-
voiID
-
seamCellIDs
private int[][] seamCellIDs -
allSeamCellIDs
private int[][] allSeamCellIDs -
colorAnnotations
private boolean colorAnnotations -
annotationListeners
-
curveListeners
-
latticeListeners
-
annotationPrefix
-
paddingFactor
private int paddingFactor -
numEllipsePts
private int numEllipsePts -
latticeContours
-
markerNames
-
markerCenters
-
markerLatticeSegments
-
markerSlices
-
annotationsStraight
-
latticeStraight
-
previewMode
private boolean previewMode -
clipMask
-
splineControlPtsList
-
numSurfaceSegments
private int numSurfaceSegments -
currentMesh
private WildMagic.LibGraphics.SceneGraph.TriMesh currentMesh -
latticepositionMarker
-
modelDisplayed
private boolean modelDisplayedEnables the user to visualize the simple ellipse-based model of the worm during lattice construction. -
splineModel
private boolean splineModel -
ellipseCross
private boolean ellipseCross -
ellipseScale
private float ellipseScale -
displayLatticeLabels
private boolean displayLatticeLabels
-
-
Constructor Details
-
LatticeModel
Creates a new LatticeModel- Parameters:
imageA-
-
LatticeModel
Creats a new LatticeModel with the given input lattice.- Parameters:
lattice-imageA-
-
-
Method Details
-
checkParentDir
-
getImageName
-
match
-
checkName
-
readAnnotationsCSV
Read a list of annotations from a CSV file: name,x,y,z,radius (optional)- Parameters:
fileName-- Returns:
- VOI containing list of annotations.
-
readLatticeCSV
-
readLatticeCSV
-
saveAllVOIsTo
Saves all VOIs to the specified file.- Parameters:
voiDir-image-
-
saveAnnotationsAsCSV
-
saveAnnotationsAsCSV
public static void saveAnnotationsAsCSV(String dir, String fileName, VOI annotations, boolean isCurve) Saves the input annotations to the CSV file in the following format: name,x,y,z- Parameters:
dir-fileName-annotations-
-
inverseDiagonal
private static WildMagic.LibFoundation.Mathematics.Vector3f inverseDiagonal(ModelImage image, int slice, int extent, WildMagic.LibFoundation.Mathematics.Vector3f[] verts, WildMagic.LibFoundation.Mathematics.Vector3f target) -
addAnnotation
Add an annotation to the annotation list.- Parameters:
textVOI-
-
addAnnotation
-
removeListeners
public void removeListeners() -
addAnnotationListener
Adds an annotation listener. The annotation listeners are updated when the annotations change in any way.- Parameters:
listener-
-
addSplineControlPts
Add a curve to the list.- Parameters:
textVOI-
-
addCurveListener
-
addLatticeListener
-
addLeftRightMarker
public void addLeftRightMarker(WildMagic.LibFoundation.Mathematics.Vector3f pt, boolean isSeam) Adds a new left/right marker to the worm image.- Parameters:
pt-
-
addNeurite
Generates a natural spline curve to fit the input set of annotation points to model a neurite. -
clear3DSelection
public void clear3DSelection()Clears the selected VOI or Annotation point. -
clearAddLeftRightMarkers
public void clearAddLeftRightMarkers()Enables user to start editing the lattice. -
colorAnnotations
public void colorAnnotations(boolean setColor) -
deleteAnnotations
public void deleteAnnotations() -
deleteSelectedPoint
public void deleteSelectedPoint(boolean doAnnotation) Deletes the selected annotation or lattice point.- Parameters:
doAnnotation-
-
displayAnnotation
-
dispose
public void dispose()Deletes this LatticeModel -
flipLattice
public void flipLattice() -
flipLattice
-
generateTriMesh
public WildMagic.LibGraphics.SceneGraph.TriMesh generateTriMesh(boolean returnMesh, boolean saveMesh) -
generateTriMesh2
public WildMagic.LibGraphics.SceneGraph.TriMesh generateTriMesh2(boolean returnMesh, boolean saveMesh, int stepSize) -
getAnnotationPrefix
-
getAnnotations
-
getAnnotationsStraight
-
getSplineCurves
-
deleteSelectedCurve
public void deleteSelectedCurve() -
isCurveSelected
-
setCurveName
-
setCurveSelected
-
setCurveVisible
-
getCurrentIndex
public int getCurrentIndex() -
getLattice
-
getLatticeStraight
-
getCenter
-
getPlanes
-
getEllipseCurves
-
getLatticeCurveLength
public int getLatticeCurveLength() -
getCenter
public WildMagic.LibFoundation.Mathematics.Vector3f getCenter(int i) -
showMarker
public void showMarker(int i) -
getDiameter
public int getDiameter(int i) -
getBasisVectors
public WildMagic.LibFoundation.Mathematics.Vector3f[] getBasisVectors(int i) -
getLeftCurve
-
getRightCurve
-
getCenterControlPoints
-
getNormalVectors
-
getRightVectors
-
getUpVectors
-
getPicked
public WildMagic.LibFoundation.Mathematics.Vector3f getPicked()Returns the currently selected point, either on the lattice or from the annotation list.- Returns:
-
getPicked
public WildMagic.LibFoundation.Mathematics.Vector3f getPicked(WildMagic.LibFoundation.Mathematics.Vector3f pt, boolean doAnnotation) Finds the closest point to the input point and sets it as the currently selected lattice or annotation point.- Parameters:
pt-doAnnotation-- Returns:
-
getPickedAnnotation
-
getSamplingPlanes
-
hasPicked
public boolean hasPicked() -
initializeInterpolation
public void initializeInterpolation(boolean saveStats) -
interpolateLattice
public void interpolateLattice(boolean displayResult, boolean useModel, boolean untwistImage, boolean untwistMarkers) Entry point in the lattice-based straightening algorithm. At this point a lattice must be defined, outlining how the worm curves in 3D. A lattice is defined ad a VOI with two curves of equal length marking the left-hand and right-hand sides or the worm.- Parameters:
displayResult- , when true intermediate volumes and results are displayed as well as the final straightened image.
-
modifyAnnotation
public boolean modifyAnnotation(WildMagic.LibFoundation.Mathematics.Vector3f pt) Enables the user to move an annotation point with the mouse.- Parameters:
pt- point along the ray with the maximum intensity value.startPt- 3D start point of a ray intersecting the volume.endPt- 3D end point of a ray intersecting the volume.
-
modifyLattice
public boolean modifyLattice(WildMagic.LibFoundation.Mathematics.Vector3f startPt, WildMagic.LibFoundation.Mathematics.Vector3f endPt, WildMagic.LibFoundation.Mathematics.Vector3f pt) Enables the user to modify the lattice point with the mouse.- Parameters:
startPt- 3D start point of a ray intersecting the volume.endPt- 3D end point of a ray intersecting the volume.pt- point along the ray with the maximum intensity value.
-
modifyLeftRightMarker
public void modifyLeftRightMarker(WildMagic.LibFoundation.Mathematics.Vector3f pt) Sets the currently selected point (lattice or annotation).- Parameters:
pt-doAnnotation-
-
moveSelectedPoint
public void moveSelectedPoint(WildMagic.LibFoundation.Mathematics.Vector3f direction, boolean doAnnotation) Enables the user to move the selected point (lattice or annotation) with the arrow keys.- Parameters:
direction-doAnnotation-
-
redo
public void redo()VOI operation redo -
retwistAnnotations
-
retwistLattice
-
saveLattice
public void saveLattice()Enables the user to save the lattice to a user-selected file. -
saveLattice
Saves the lattice to the specified file and directory.- Parameters:
directory-fileName-
-
getContourFile
private boolean getContourFile() -
saveMeshContoursCSV
private void saveMeshContoursCSV() -
readMeshContoursCSV
private void readMeshContoursCSV() -
openNeuriteCurves
-
saveNeuriteCurves
public void saveNeuriteCurves() -
untwistNeuriteCurves
public void untwistNeuriteCurves(boolean useLatticeModel) -
openStraightNeuriteCurves
-
segmentLattice
public ModelImage segmentLattice(ModelImage image, boolean saveContourImage, int paddingFactor, boolean segmentLattice) -
segmentLattice
-
selectAnnotation
public boolean selectAnnotation(WildMagic.LibFoundation.Mathematics.Vector3f startPt, WildMagic.LibFoundation.Mathematics.Vector3f endPt, WildMagic.LibFoundation.Mathematics.Vector3f pt, boolean rightMouse, boolean multiSelect) -
selectLattice
public boolean selectLattice(WildMagic.LibFoundation.Mathematics.Vector3f startPt, WildMagic.LibFoundation.Mathematics.Vector3f endPt, WildMagic.LibFoundation.Mathematics.Vector3f pt, boolean isSeam) -
setAnnotationPrefix
-
setAnnotations
Called when new annotations are loaded from file, replaces current annotations.- Parameters:
newAnnotations-
-
addAnnotations
Called when new annotations are loaded from file, replaces current annotations.- Parameters:
newAnnotations-
-
setImage
Change the underlying image for the latticeModel. Update the output directories.- Parameters:
image-
-
setLattice
Called when a new lattice is loaded from file, replaces the current lattice.- Parameters:
newLattice-
-
setMarkers
-
setPaddingFactor
public void setPaddingFactor(int padding) -
isPreview
public boolean isPreview() -
setPreviewMode
-
showModel
public void showModel(boolean display) -
isModelDisplayed
public boolean isModelDisplayed() -
updateCrossSection
public void updateCrossSection(boolean useSpline, boolean ellipse, float percent) -
showLatticeLabels
public void showLatticeLabels(boolean display) -
showLattice
public void showLattice(boolean display) Turns on/off lattice display: -
undo
public void undo()VOI operation undo. -
untwistImage
public void untwistImage(boolean mainImage) Entry point in the lattice-based straightening algorithm. At this point a lattice must be defined, outlining how the worm curves in 3D. A lattice is defined ad a VOI with two curves of equal length marking the left-hand and right-hand sides or the worm.- Parameters:
displayResult- , when true intermediate volumes and results are displayed as well as the final straightened image.
-
untwistMarkers
public void untwistMarkers(boolean untwistAll) Entry point in the lattice-based straightening algorithm. At this point a lattice must be defined, outlining how the worm curves in 3D. A lattice is defined ad a VOI with two curves of equal length marking the left-hand and right-hand sides or the worm.- Parameters:
displayResult- , when true intermediate volumes and results are displayed as well as the final straightened image.
-
untwistTest
Untwists the worm image quickly for the preview mode - without saving any images or statistics- Returns:
- untwisted image.
-
updateLattice
-
updateAnnotation
-
updateSelectedPoint
-
generateCurves
protected boolean generateCurves(float stepSize) Generates the set of natural spline curves to fit the current lattice. -
updateEllipseModel
private void updateEllipseModel(float stepSize) -
GetSquared
protected double GetSquared(WildMagic.LibFoundation.Mathematics.Vector3f point, WildMagic.LibFoundation.Mathematics.Ellipsoid3f ellipsoid) -
interpolateContour
Interpolates the input contour so that the spacing between contour points is invalid input: '<'= 1 voxel.- Parameters:
contour-
-
loadDiameters
-
loadPositions
-
loadSamplePlanes
-
makeEllipse
protected WildMagic.LibFoundation.Mathematics.Ellipsoid3f makeEllipse(WildMagic.LibFoundation.Mathematics.Vector3f right, WildMagic.LibFoundation.Mathematics.Vector3f up, WildMagic.LibFoundation.Mathematics.Vector3f center, float diameterA, float diameterB, VOIContour ellipse) Generates the 3D 1-voxel thick ellipsoids used in the intial worm model.- Parameters:
right-up-center-diameterA-diameterB-ellipse-- Returns:
-
makeEllipse2DA
protected void makeEllipse2DA(WildMagic.LibFoundation.Mathematics.Vector3f right, WildMagic.LibFoundation.Mathematics.Vector3f up, WildMagic.LibFoundation.Mathematics.Vector3f center, float radius, VOIContour ellipse) -
makeEllipse2DA
protected void makeEllipse2DA(WildMagic.LibFoundation.Mathematics.Vector3f right, WildMagic.LibFoundation.Mathematics.Vector3f up, WildMagic.LibFoundation.Mathematics.Vector3f center, float radius, WildMagic.LibFoundation.Mathematics.Vector3f normal, float curvature, VOIContour ellipse, boolean ellipseCross, float scale) -
originToStraight
protected WildMagic.LibFoundation.Mathematics.Vector3f originToStraight(ModelImage model, ModelImage originToStraight, WildMagic.LibFoundation.Mathematics.Vector3f pt, String text) Given a point in the twisted volume, calculates and returns the corresponding point in the straightened image.- Parameters:
model-originToStraight-pt-text-- Returns:
-
saveAnnotationStatistics
protected VOI saveAnnotationStatistics(String imageDir, ModelImage model, ModelImage originToStraight, int[] outputDim, String postFix) Saves the annotation statistics to a file.- Parameters:
model-originToStraight-outputDim-postFix-image-- Returns:
-
saveDiameters
-
saveLatticeStatistics
protected void saveLatticeStatistics(String imageDir, float length, VOI left, VOI right, float[] leftPairs, float[] rightPairs, String postFix) Saves the lattice statistics to a file.- Parameters:
length-left-right-leftPairs-rightPairs-postFix-image-
-
savePositions
-
saveSamplePlanes
-
smoothCurve
Generates the Natural Spline for the lattice center-line curve. Sets the time values for each point on the curve.- Parameters:
curve-time-- Returns:
-
smoothCurve
public static WildMagic.LibFoundation.Curves.NaturalSpline3 smoothCurve(Vector<VOIWormAnnotation> controlPts) -
straightenFrame
protected WildMagic.LibFoundation.Mathematics.Vector3f[] straightenFrame(ModelImage image, int slice, int[] extents, WildMagic.LibFoundation.Mathematics.Vector3f[] verts, WildMagic.LibFoundation.Mathematics.Vector3f centerPos, WildMagic.LibFoundation.Mathematics.Vector3f leftPos, WildMagic.LibFoundation.Mathematics.Vector3f rightPos) -
writeDiagonal
protected WildMagic.LibFoundation.Mathematics.Vector3f writeDiagonal(ModelImage image, int slice, int[] extents, WildMagic.LibFoundation.Mathematics.Vector3f[] verts, WildMagic.LibFoundation.Mathematics.Vector3f target, float[] minDistance) -
writeDiagonal
protected void writeDiagonal(ModelImage image, ModelImage result, int tSlice, int slice, int[] extents, WildMagic.LibFoundation.Mathematics.Vector3f[] verts) -
writeDiagonalSampleCount
protected void writeDiagonalSampleCount(ModelImage image, ModelImage result, int tSlice, int slice, int[] extents, WildMagic.LibFoundation.Mathematics.Vector3f[] verts) -
writeDiagonalTest
protected void writeDiagonalTest(ModelImage image, ModelImage result, int tSlice, int slice, int[] extents, WildMagic.LibFoundation.Mathematics.Vector3f[] verts, float radiusSq) -
addInsertionPoint
private boolean addInsertionPoint(WildMagic.LibFoundation.Mathematics.Vector3f startPt, WildMagic.LibFoundation.Mathematics.Vector3f endPt, WildMagic.LibFoundation.Mathematics.Vector3f maxPt, boolean isSeam) Adds a point to the lattice.- Parameters:
startPt-endPt-maxPt-
-
clearCurves
private void clearCurves(boolean clearGrid) Resets the natural spline curves when the lattice changes. -
colorAnnotations
private void colorAnnotations()Counts the annotations and colors them based on the number of annotations. This is only used when the user is labeling seam-cells as an aid in determining if 20 pairs of seam cells have been found. -
generateEllipses
private void generateEllipses(int extent) -
makeSelectionFrame
private void makeSelectionFrame(WildMagic.LibFoundation.Mathematics.Vector3f right, WildMagic.LibFoundation.Mathematics.Vector3f up, WildMagic.LibFoundation.Mathematics.Vector3f center, float diameter, VOIContour ellipse) Generates the VOI that highlights which point (lattice or annotation) is currently selected by the user.- Parameters:
right-up-center-diameter-ellipse-
-
retwistAnnotation
private WildMagic.LibFoundation.Mathematics.Vector3f retwistAnnotation(VOIWormAnnotation annotation) -
saveImage
-
saveImage
public static void saveImage(ModelImage originalImage, ModelImage image, String subDir, String postScript) -
saveLatticeStatistics
private void saveLatticeStatistics() -
saveContourAsCSV
public static void saveContourAsCSV(ModelImage image, String subDir, String postScript, VOIContour contour) -
saveBasisVectorsAsCSV
public static void saveBasisVectorsAsCSV(ModelImage image, String subDir, String postScript, VOIContour positions, Vector<WildMagic.LibFoundation.Mathematics.Vector3f> normals, Vector<WildMagic.LibFoundation.Mathematics.Vector3f> rightVectors, Vector<WildMagic.LibFoundation.Mathematics.Vector3f> upVectors) -
saveContours
-
readContours
public static WildMagic.LibFoundation.Mathematics.Box3f[] readContours(ModelImage image, String subDir, String postScript) -
saveTriMesh
public static void saveTriMesh(ModelImage image, String outputDirectory, String subDir, String postScript, WildMagic.LibGraphics.SceneGraph.TriMesh mesh) -
saveSpline
-
untwist
Straightens the worm image based on the input lattice positions. The image is straightened without first building a worm model. The image is segmented after clipping based on surface markers or the lattice shape.- Parameters:
image-resultExtents-
-
untwistSampleCount
-
untwistLattice
Untwists the lattice and lattice interpolation curves, writing the straightened data to spreadsheet format .csv files and the straightened lattice to a VOI file. The target slices for the lattice and curve data is generated from the distance along the curve. No segmentation or interpolation is necessary:- Parameters:
image-resultExtents-
-
untwistMarkers
-
untwistAnnotations
-
untwistTest
Untwists the worm image quickly for the preview mode - without saving any images or statistics Straightens the worm image based on the input lattice positions. The image is straightened without first building a worm model. The image is segmented after clipping based on surface markers or the lattice shape.- Parameters:
resultExtents-image-
-
getPrefix
-
containsAnnotation
-
updateSplineControlPoints
private void updateSplineControlPoints() -
updateAnnotationListeners
private void updateAnnotationListeners()Updates the list of listeners that the annotations have changed. This is how the latticeModel communicates changes to the different plugins that display lists of annotations, etc. -
updateCurveListeners
private void updateCurveListeners() -
updateLatticeListeners
private void updateLatticeListeners() -
makeLatticeContours
private void makeLatticeContours() -
updateLattice
private void updateLattice(boolean rebuild) Updates the lattice data structures for rendering whenever the user changes the lattice.- Parameters:
rebuild-
-
updateLinks
private void updateLinks()Updates the lattice data structures on undo/redo. -
updateSelected
private void updateSelected()Updates the VOI displaying which point (lattice or annotation) is currently selected when the selection changes. -
findPoint
-
updateSeamCount
private void updateSeamCount() -
renameLatticeOnLoad
-
saveLattice
-
saveLattice
-
annotationChanged
-
latticeChanged
private boolean latticeChanged() -
testLatticeMeshIntersection
private void testLatticeMeshIntersection() -
getInsideMeshImage
-
getInsideMeshImage
-
blur
Returns a blurred image of the input image.- Parameters:
image-sigma-- Returns:
-
getCorrectionFactor
Returns the amount of correction which should be applied to the z-direction sigma (assuming that correction is requested).- Returns:
- the amount to multiply the z-sigma by to correct for resolution differences
-
fill
-