Package gov.nih.mipav.model.algorithms
Class AlgorithmObjectExtractor
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.AlgorithmObjectExtractor
-
- All Implemented Interfaces:
AlgorithmInterface,java.awt.event.ActionListener,java.awt.event.WindowListener,java.lang.Runnable,java.util.EventListener
public class AlgorithmObjectExtractor extends AlgorithmBase implements AlgorithmInterface
A class for segmenting objects. The algorithm is partially based on the paper:BET: Brain Extraction Tool
Stephen M. Smith
FMRIB Technical Report TR00SMS2
Oxford Centre for Functional Magnetic Resonance Imaging of the Brain
See the document BrainExtraction.pdf for a detailed description of the algorithm as implemented in this class. A few modifications to the original algorithm were made.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classAlgorithmObjectExtractor.EdgeA representation of an edge for the vertex-edge-triangle table.private classAlgorithmObjectExtractor.UnorderedSetIntAn unordered set of 'int' stored in an array.
-
Field Summary
Fields Modifier and Type Field Description private float[]boxDOCUMENT ME!protected floatc1FactorDOCUMENT ME!protected floatc3FactorDOCUMENT ME!private int[]directionDOCUMENT ME!private float[]gvfBufferDOCUMENT ME!private ModelImageimageDOCUMENT ME!private intiSubdivisionsDOCUMENT ME!protected float[]m_afCurvatureDOCUMENT ME!protected float[]m_afImageThe 3D MRI image stored as a 1D array.protected float[]m_afLengthDOCUMENT ME!protected int[]m_aiConnectDOCUMENT ME!protected byte[]m_aiMaskobject mask creation.protected AlgorithmObjectExtractor.UnorderedSetInt[]m_akAdjacentDOCUMENT ME!protected WildMagic.LibFoundation.Mathematics.Vector3f[]m_akSNormalDOCUMENT ME!protected WildMagic.LibFoundation.Mathematics.Vector3f[]m_akSTangentDOCUMENT ME!protected WildMagic.LibFoundation.Mathematics.Vector3f[]m_akVertexDOCUMENT ME!protected WildMagic.LibFoundation.Mathematics.Vector3f[]m_akVMeanDOCUMENT ME!protected WildMagic.LibFoundation.Mathematics.Vector3f[]m_akVNormalDOCUMENT ME!protected floatm_fEParamDOCUMENT ME!protected floatm_fFParamDOCUMENT ME!protected floatm_fMeanEdgeLengthupdate parameters.protected floatm_fRayDeltaDOCUMENT ME!protected floatm_fReductionXDOCUMENT ME!protected floatm_fReductionYDOCUMENT ME!protected floatm_fReductionZDOCUMENT ME!protected floatm_fStiffnessDOCUMENT ME!protected floatm_fXDeltaThe size of a voxel, in voxel units.protected floatm_fYDeltaThe size of a voxel, in voxel units.protected floatm_fZDeltaThe size of a voxel, in voxel units.protected intm_iDMaxDOCUMENT ME!protected intm_iEQuantityDOCUMENT ME!protected intm_iMedianIntensityDOCUMENT ME!protected intm_iQuantityThe MRI image bounds and quantity of voxels.protected intm_iTQuantityDOCUMENT ME!protected intm_iVQuantitymesh data.protected intm_iXBoundThe MRI image bounds and quantity of voxels.protected intm_iYBoundThe MRI image bounds and quantity of voxels.protected intm_iZBoundThe MRI image bounds and quantity of voxels.protected WildMagic.LibFoundation.Mathematics.Vector3fm_kCenterinitial ellipsoid parameters.protected java.util.HashMap<AlgorithmObjectExtractor.Edge,java.lang.Integer>m_kEMapDOCUMENT ME!protected WildMagic.LibFoundation.Mathematics.Matrix3fm_kRotateDOCUMENT ME!private floatoldUValDOCUMENT ME!private floatoldVValDOCUMENT ME!private floatoldWValDOCUMENT ME!private booleanonlyInitDOCUMENT ME!private float[]outputBufferprivate booleansaveGVFDOCUMENT ME!private float[]startLocationDOCUMENT ME!protected WildMagic.LibGraphics.SceneGraph.TriMeshtriMeshDOCUMENT ME!private float[]uValDOCUMENT ME!private VOIvoiDOCUMENT ME!private float[]vValDOCUMENT ME!private float[]wValDOCUMENT ME!-
Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStopped
-
-
Constructor Summary
Constructors Constructor Description AlgorithmObjectExtractor(ModelImage srcImg, VOI voi, boolean justInit, boolean saveGVF, WildMagic.LibGraphics.SceneGraph.TriMesh triMesh, float[] uVal, float[] vVal, float[] wVal)Create an extractor for segmenting an object from an image.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidalgorithmPerformed(AlgorithmBase algorithm)Called after an algorithm this listener is registered to exits (maybe successfully, maybe not).private voidcalcGradMag()DOCUMENT ME!private voidcalcGVF3D()Calculate GVF from 3D image buffer.protected voidcomputeMeanEdgeLength()Compute the average length of all the edges in the triangle mesh.protected voidcomputeVertexInformation()Let V[i] be a vertex in the triangle mesh.protected voidcomputeVertexNormals()Compute the vertex normals of the triangle mesh.protected voidestimateEllipsoid()Approximate the brain surface by an ellipsoid.voidextractObject()The segmentation function.voidfinalize()Prepares this class for destruction.protected voidfloodFill(int iX, int iY, int iZ)Identify voxels enclosed by the brain surface by using a flood fill.protected voidgenerateEllipsoidMesh()Tessellate a unit sphere centered at the origin.intgetDilationSize()Get the dilation size for dilating the voxelized object surface obtained by rasterizing the triangle mesh.protected intgetIndex(int iX, int iY, int iZ)A convenience function for mapping the 3D voxel position (iX,iY,iZ) to a 1D array index.protected voidgetInsideVoxels()Identify all voxels that are inside or on the mesh that represents the brain surface.protected intgetIntersectX(WildMagic.LibFoundation.Mathematics.Vector3f kV0, WildMagic.LibFoundation.Mathematics.Vector3f kV1, WildMagic.LibFoundation.Mathematics.Vector3f kV2, int iY, int iZ)Compute the point of intersection between a line (0,iY,iZ)+t(1,0,0) and the triangle defined by the three input points.protected intgetIntersectY(WildMagic.LibFoundation.Mathematics.Vector3f kV0, WildMagic.LibFoundation.Mathematics.Vector3f kV1, WildMagic.LibFoundation.Mathematics.Vector3f kV2, int iX, int iZ)Compute the point of intersection between a line (iX,0,iZ)+t(0,1,0) and the triangle defined by the three input points.protected intgetIntersectZ(WildMagic.LibFoundation.Mathematics.Vector3f kV0, WildMagic.LibFoundation.Mathematics.Vector3f kV1, WildMagic.LibFoundation.Mathematics.Vector3f kV2, int iX, int iY)Compute the point of intersection between a line (iX,iY,0)+t(0,0,1) and the triangle defined by the three input points.byte[]getObjectMask()Get the 3D image that represents the extracted object.floatgetRayDelta()Get the spacing along the vertex normal rays, as described in BrainExtraction.pdf, that is part of the image term in the surface evolution.floatgetReductionX()Set the reduction factor for estimating the initial ellipsoid, as described in BrainExtraction.pdf.floatgetReductionY()Set the reduction factor for estimating the initial ellipsoid, as described in BrainExtraction.pdf.floatgetReductionZ()Set the reduction factor for estimating the initial ellipsoid, as described in BrainExtraction.pdf.floatgetStiffness()Set the stiffness of the mesh, as described in BrainExtraction.pdf, that is part of the surface normal term in the surface evolution.floatgetTriLinear(float x, float y, float z, float[] buffer)DOCUMENT ME!voidrunAlgorithm()Starts the program.protected voidsaveMesh(boolean flip)Internal support to write vertices, normals, and connectivity indices to the file.voidsetDilationSize(int iDMax)Set the dilation size for dilating the voxelized object surface obtained by rasterizing the triangle mesh.voidsetJustIntial(boolean flag)Indicates if surface evolution should be skipped.voidsetRayDelta(float fRayDelta)Set the spacing along the vertex normal rays, as described in BrainExtraction.pdf, that is part of the image term in the surface evolution.voidsetReductionX(float fReduction)Set the reduction factor for estimating the initial ellipsoid, as described in BrainExtraction.pdf.voidsetReductionY(float fReduction)Set the reduction factor for estimating the initial ellipsoid, as described in BrainExtraction.pdf.voidsetReductionZ(float fReduction)Set the reduction factor for estimating the initial ellipsoid, as described in BrainExtraction.pdf.voidsetStiffness(float fStiffness)Set the stiffness of the mesh, as described in BrainExtraction.pdf, that is part of the surface normal term in the surface evolution.protected floatupdate2(int i)Compute the coefficient of the surface normal for the update of the mesh vertex V[i] in the SNormal[i] direction.protected voidupdate3(int i)Compute the coefficient of the vertex normal for the update of the mesh vertex V[i] in the VNormal[i] direction.voidupdateMesh()The heart of the segmentation.-
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, generateProgressValues, getDestImage, getElapsedTime, getMask, getMaxProgressValue, getMinProgressValue, getNumberOfThreads, getProgress, getProgressChangeListener, getProgressChangeListeners, getProgressModulus, getProgressStep, getProgressValues, getSrcImage, isCompleted, isImage25D, isMultiThreadingEnabled, isRunningInSeparateThread, isThreadStopped, linkProgressToAlgorithm, linkProgressToAlgorithm, makeProgress, notifyListeners, removeListener, removeProgressChangeListener, run, setCompleted, setImage25D, setMask, setMaxProgressValue, setMinProgressValue, setMultiThreadingEnabled, setNumberOfThreads, setProgress, setProgressModulus, setProgressStep, setProgressValues, setProgressValues, setRunningInSeparateThread, setSrcImage, setStartTime, setThreadStopped, startMethod, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
c1Factor
protected float c1Factor
DOCUMENT ME!
-
c3Factor
protected float c3Factor
DOCUMENT ME!
-
m_afCurvature
protected float[] m_afCurvature
DOCUMENT ME!
-
m_afImage
protected float[] m_afImage
The 3D MRI image stored as a 1D array. The mapping from (x,y,z) to 1D is: index = x + xbound*(y + ybound*z).
-
m_afLength
protected float[] m_afLength
DOCUMENT ME!
-
m_aiConnect
protected int[] m_aiConnect
DOCUMENT ME!
-
m_aiMask
protected byte[] m_aiMask
object mask creation.
-
m_akAdjacent
protected AlgorithmObjectExtractor.UnorderedSetInt[] m_akAdjacent
DOCUMENT ME!
-
m_akSNormal
protected WildMagic.LibFoundation.Mathematics.Vector3f[] m_akSNormal
DOCUMENT ME!
-
m_akSTangent
protected WildMagic.LibFoundation.Mathematics.Vector3f[] m_akSTangent
DOCUMENT ME!
-
m_akVertex
protected WildMagic.LibFoundation.Mathematics.Vector3f[] m_akVertex
DOCUMENT ME!
-
m_akVMean
protected WildMagic.LibFoundation.Mathematics.Vector3f[] m_akVMean
DOCUMENT ME!
-
m_akVNormal
protected WildMagic.LibFoundation.Mathematics.Vector3f[] m_akVNormal
DOCUMENT ME!
-
m_fEParam
protected float m_fEParam
DOCUMENT ME!
-
m_fFParam
protected float m_fFParam
DOCUMENT ME!
-
m_fMeanEdgeLength
protected float m_fMeanEdgeLength
update parameters.
-
m_fRayDelta
protected float m_fRayDelta
DOCUMENT ME!
-
m_fReductionX
protected float m_fReductionX
DOCUMENT ME!
-
m_fReductionY
protected float m_fReductionY
DOCUMENT ME!
-
m_fReductionZ
protected float m_fReductionZ
DOCUMENT ME!
-
m_fStiffness
protected float m_fStiffness
DOCUMENT ME!
-
m_fXDelta
protected float m_fXDelta
The size of a voxel, in voxel units.
-
m_fYDelta
protected float m_fYDelta
The size of a voxel, in voxel units.
-
m_fZDelta
protected float m_fZDelta
The size of a voxel, in voxel units.
-
m_iDMax
protected int m_iDMax
DOCUMENT ME!
-
m_iEQuantity
protected int m_iEQuantity
DOCUMENT ME!
-
m_iMedianIntensity
protected int m_iMedianIntensity
DOCUMENT ME!
-
m_iTQuantity
protected int m_iTQuantity
DOCUMENT ME!
-
m_iVQuantity
protected int m_iVQuantity
mesh data.
-
m_iXBound
protected int m_iXBound
The MRI image bounds and quantity of voxels.
-
m_iYBound
protected int m_iYBound
The MRI image bounds and quantity of voxels.
-
m_iZBound
protected int m_iZBound
The MRI image bounds and quantity of voxels.
-
m_iQuantity
protected int m_iQuantity
The MRI image bounds and quantity of voxels.
-
m_kCenter
protected WildMagic.LibFoundation.Mathematics.Vector3f m_kCenter
initial ellipsoid parameters.
-
m_kEMap
protected java.util.HashMap<AlgorithmObjectExtractor.Edge,java.lang.Integer> m_kEMap
DOCUMENT ME!
-
m_kRotate
protected WildMagic.LibFoundation.Mathematics.Matrix3f m_kRotate
DOCUMENT ME!
-
triMesh
protected WildMagic.LibGraphics.SceneGraph.TriMesh triMesh
DOCUMENT ME!
-
box
private float[] box
DOCUMENT ME!
-
direction
private int[] direction
DOCUMENT ME!
-
gvfBuffer
private float[] gvfBuffer
DOCUMENT ME!
-
image
private ModelImage image
DOCUMENT ME!
-
iSubdivisions
private int iSubdivisions
DOCUMENT ME!
-
oldUVal
private float oldUVal
DOCUMENT ME!
-
oldVVal
private float oldVVal
DOCUMENT ME!
-
oldWVal
private float oldWVal
DOCUMENT ME!
-
onlyInit
private boolean onlyInit
DOCUMENT ME!
-
saveGVF
private boolean saveGVF
DOCUMENT ME!
-
startLocation
private float[] startLocation
DOCUMENT ME!
-
uVal
private float[] uVal
DOCUMENT ME!
-
voi
private VOI voi
DOCUMENT ME!
-
vVal
private float[] vVal
DOCUMENT ME!
-
wVal
private float[] wVal
DOCUMENT ME!
-
outputBuffer
private float[] outputBuffer
-
-
Constructor Detail
-
AlgorithmObjectExtractor
public AlgorithmObjectExtractor(ModelImage srcImg, VOI voi, boolean justInit, boolean saveGVF, WildMagic.LibGraphics.SceneGraph.TriMesh triMesh, float[] uVal, float[] vVal, float[] wVal)
Create an extractor for segmenting an object from an image.- Parameters:
srcImg- the source image.voi- initial voi used to estimate the inital ellipsoidjustInit- if true just perform one iterationsaveGVF- if true save uvf, vvf, and wvf filestriMesh- if not null use mesh instead of voiuVal- x component of GVF fieldvVal- y component of GVF fieldwVal- z component of GVF field
-
-
Method Detail
-
extractObject
public void extractObject()
The segmentation function. Various parameters may be modified, if necessary, before the call.
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalizein classAlgorithmBase
-
getDilationSize
public final int getDilationSize()
Get the dilation size for dilating the voxelized object surface obtained by rasterizing the triangle mesh. The rasterization is designed so that the voxel surface has no holes, thereby allowing it to be flood-filled. But just in case numerical round-off errors cause a few holes, this parameter is exposed for public use. The default value is 0 (no dilation). If the value is D > 0, the dilation mask is a cube of size (2*D+1)x(2*D+1)x(2*D+1).- Returns:
- the current dilation size
-
getObjectMask
public final byte[] getObjectMask()
Get the 3D image that represents the extracted object. The image is ternary and has the same dimensions as the input MRI. A voxel value of 0 indicates background. A voxel value of 1 indicates object surface. A voxel value of 2 indicates a voxel inside the object surface.- Returns:
- the image that represents the extracted object
-
getRayDelta
public final float getRayDelta()
Get the spacing along the vertex normal rays, as described in BrainExtraction.pdf, that is part of the image term in the surface evolution. The default value is 1.0.- Returns:
- the current spacing
-
getReductionX
public final float getReductionX()
Set the reduction factor for estimating the initial ellipsoid, as described in BrainExtraction.pdf. The default value is 0.75.- Returns:
- the current reduction factor
-
getReductionY
public final float getReductionY()
Set the reduction factor for estimating the initial ellipsoid, as described in BrainExtraction.pdf. The default value is 0.75.- Returns:
- the current reduction factor
-
getReductionZ
public final float getReductionZ()
Set the reduction factor for estimating the initial ellipsoid, as described in BrainExtraction.pdf. The default value is 0.75.- Returns:
- the current reduction factor
-
getStiffness
public final float getStiffness()
Set the stiffness of the mesh, as described in BrainExtraction.pdf, that is part of the surface normal term in the surface evolution. The default value is 0.1.- Returns:
- the current stiffness
-
getTriLinear
public final float getTriLinear(float x, float y, float z, float[] buffer)DOCUMENT ME!- Parameters:
x- DOCUMENT ME!y- DOCUMENT ME!z- DOCUMENT ME!buffer- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
runAlgorithm
public void runAlgorithm()
Starts the program.- Specified by:
runAlgorithmin classAlgorithmBase
-
setDilationSize
public final void setDilationSize(int iDMax)
Set the dilation size for dilating the voxelized object surface obtained by rasterizing the triangle mesh. The rasterization is designed so that the voxel surface has no holes, thereby allowing it to be flood-filled. But just in case numerical round-off errors cause a few holes, this parameter is exposed for public use. The default value is 0 (no dilation). If the value is D > 0, the dilation mask is a cube of size (2*D+1)x(2*D+1)x(2*D+1).- Parameters:
iDMax- the new dilation size
-
setJustIntial
public final void setJustIntial(boolean flag)
Indicates if surface evolution should be skipped. This is helpful when determining if the initial ellipsoid is a good estimate.- Parameters:
flag- whether the surface evolution should be skipped
-
setRayDelta
public final void setRayDelta(float fRayDelta)
Set the spacing along the vertex normal rays, as described in BrainExtraction.pdf, that is part of the image term in the surface evolution. The default value is 1.0.- Parameters:
fRayDelta- the new spacing along the vertex normal rays
-
setReductionX
public final void setReductionX(float fReduction)
Set the reduction factor for estimating the initial ellipsoid, as described in BrainExtraction.pdf. The default value is 0.6.- Parameters:
fReduction- the amount to reduce the axis of the ellipsoid.
-
setReductionY
public final void setReductionY(float fReduction)
Set the reduction factor for estimating the initial ellipsoid, as described in BrainExtraction.pdf. The default value is 0.5.- Parameters:
fReduction- the amount to reduce the axis of the ellipsoid.
-
setReductionZ
public final void setReductionZ(float fReduction)
Set the reduction factor for estimating the initial ellipsoid, as described in BrainExtraction.pdf. The default value is 0.6.- Parameters:
fReduction- the amount to reduce the axis of the ellipsoid.
-
setStiffness
public final void setStiffness(float fStiffness)
Set the stiffness of the mesh, as described in BrainExtraction.pdf, that is part of the surface normal term in the surface evolution. The default value is 0.1.- Parameters:
fStiffness- the new stiffness
-
updateMesh
public void updateMesh()
The heart of the segmentation. This function is responsible for the evolution of the triangle mesh that approximates the object surface. The update has a tangential component, a surface normal component, and a vertex normal component for each vertex in the mesh. The first two components control the geometry of the mesh. The last component is based on the MRI data itself. See BrainExtraction.pdf for a detailed description of the update terms.
-
computeMeanEdgeLength
protected void computeMeanEdgeLength()
Compute the average length of all the edges in the triangle mesh.
-
computeVertexInformation
protected void computeVertexInformation()
Let V[i] be a vertex in the triangle mesh. This function computes VMean[i], the average of the immediate neighbors of V[i]. Define S[i] = VMean[i] - V[i]. The function also computes a surface normal SNormal[i], the component of S[i] in the vertex normal direction. STangent[i] = S[i] - SNormal[i] is computed as an approximation to a tangent to the surface. Finally, Curvature[i] is an approximation of the surface curvature at V[i].
-
computeVertexNormals
protected void computeVertexNormals()
Compute the vertex normals of the triangle mesh. Each vertex normal is the unitized average of the non-unit triangle normals for those triangles sharing the vertex.
-
estimateEllipsoid
protected void estimateEllipsoid()
Approximate the brain surface by an ellipsoid. The approximation is based on locating all voxels of intensity larger than a brightness threshold and that are part of the upper-half of the head. The idea is that the scalp voxels in the upper-half form lie approximately on an ellipsoidal surface.
NOTE. The assumption is that the traversal from bottom to top of head is in the y-direction of the 3D image. It does not matter if the top of the head has y-values smaller/larger than those for the bottom of the head. If this assumption is not met, the image should be permuted OR this code must be modified to attempt to recognize the orientation of the head
-
floodFill
protected void floodFill(int iX, int iY, int iZ)Identify voxels enclosed by the brain surface by using a flood fill. The flood fill is nonrecursive to avoid overflowing the program stack.- Parameters:
iX- the x-value of the seed point for the filliY- the y-value of the seed point for the filliZ- the z-value of the seed point for the fill
-
generateEllipsoidMesh
protected void generateEllipsoidMesh()
Tessellate a unit sphere centered at the origin. Start with an octahedron and subdivide. The final mesh is then affinely mapped to the initial ellipsoid produced by estimateEllipsoid(). The subdivision scheme is described in BrainExtraction.pdf.
-
getIndex
protected final int getIndex(int iX, int iY, int iZ)A convenience function for mapping the 3D voxel position (iX,iY,iZ) to a 1D array index. The images are stored as 1D arrays, so this function is used frequently.- Parameters:
iX- the x-value of the voxel positioniY- the y-value of the voxel positioniZ- the z-value of the voxel position- Returns:
- the 1D array index corresponding to (iX,iY,iZ)
-
getInsideVoxels
protected void getInsideVoxels()
Identify all voxels that are inside or on the mesh that represents the brain surface. The surface voxels are constructed by rasterizing the triangles of the mesh in 3D. The centroid of these voxels is used as a seed point for a flood fill of the region enclosed by the surface.
-
getIntersectX
protected int getIntersectX(WildMagic.LibFoundation.Mathematics.Vector3f kV0, WildMagic.LibFoundation.Mathematics.Vector3f kV1, WildMagic.LibFoundation.Mathematics.Vector3f kV2, int iY, int iZ)Compute the point of intersection between a line (0,iY,iZ)+t(1,0,0) and the triangle defined by the three input points. All calculations are in voxel coordinates and the x-value of the intersection point is truncated to an integer.- Parameters:
kV0- a 3D vertex of the trianglekV1- a 3D vertex of the trianglekV2- a 3D vertex of the triangleiY- the y-value of the origin of the lineiZ- the z-value of the origin of the line- Returns:
- the x-value of the intersection
-
getIntersectY
protected int getIntersectY(WildMagic.LibFoundation.Mathematics.Vector3f kV0, WildMagic.LibFoundation.Mathematics.Vector3f kV1, WildMagic.LibFoundation.Mathematics.Vector3f kV2, int iX, int iZ)Compute the point of intersection between a line (iX,0,iZ)+t(0,1,0) and the triangle defined by the three input points. All calculations are in voxel coordinates and the y-value of the intersection point is truncated to an integer.- Parameters:
kV0- a 3D vertex of the trianglekV1- a 3D vertex of the trianglekV2- a 3D vertex of the triangleiX- the x-value of the origin of the lineiZ- the z-value of the origin of the line- Returns:
- the y-value of the intersection
-
getIntersectZ
protected int getIntersectZ(WildMagic.LibFoundation.Mathematics.Vector3f kV0, WildMagic.LibFoundation.Mathematics.Vector3f kV1, WildMagic.LibFoundation.Mathematics.Vector3f kV2, int iX, int iY)Compute the point of intersection between a line (iX,iY,0)+t(0,0,1) and the triangle defined by the three input points. All calculations are in voxel coordinates and the z-value of the intersection point is truncated to an integer.- Parameters:
kV0- a 3D vertex of the trianglekV1- a 3D vertex of the trianglekV2- a 3D vertex of the triangleiX- the x-value of the origin of the lineiY- the y-value of the origin of the line- Returns:
- the z-value of the intersection
-
saveMesh
protected void saveMesh(boolean flip) throws java.io.IOExceptionInternal support to write vertices, normals, and connectivity indices to the file.- Parameters:
flip- if the y axis should be inverted - true for extract, false for from another surface- Throws:
java.io.IOException- if there is an error writing to the file
-
update2
protected float update2(int i)
Compute the coefficient of the surface normal for the update of the mesh vertex V[i] in the SNormal[i] direction. See BrainExtraction.pdf for a description of the update.- Parameters:
i- the index of the vertex to update- Returns:
- the coefficient of SNormal[i] for the update
-
update3
protected void update3(int i)
Compute the coefficient of the vertex normal for the update of the mesh vertex V[i] in the VNormal[i] direction. See BrainExtraction.pdf for a description of the update.- Parameters:
i- the index of the vertex to update
-
calcGradMag
private void calcGradMag()
DOCUMENT ME!
-
calcGVF3D
private void calcGVF3D()
Calculate GVF from 3D image buffer.
-
algorithmPerformed
public void algorithmPerformed(AlgorithmBase algorithm)
Description copied from interface:AlgorithmInterfaceCalled after an algorithm this listener is registered to exits (maybe successfully, maybe not). If the algorithm is run in a separate thread, this call will be made within that thread. If not, this call will be made from that same, shared thread.- Specified by:
algorithmPerformedin interfaceAlgorithmInterface- Parameters:
algorithm- the algorithm which has just completed
-
-