Class LseSegmenter
- java.lang.Object
-
- gov.nih.mipav.model.algorithms.levelset.LseSegmenter
-
- Direct Known Subclasses:
LseSegGeodesicActiveContour2
,LseSegGeodesicActiveContour3
,LseSegShapeDetection2
,LseSegShapeDetection3
,LseSegThreshold2
,LseSegThreshold3
public abstract class LseSegmenter extends java.lang.Object
The abstract base class for segmentation via level-set evolution.- Version:
- 0.1 November 7, 2006
- Author:
- David Eberly
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean[]
m_abMask
Masks to indicate which image elements are to be processed by the segmenter.protected boolean[]
m_abSignedDistanceMask
The mask that indicates which image elements have been included in the signed distance transform.protected float[]
m_afData
The image elements.protected float[]
m_afSignedDistance
The signed distance transform computed from the coarse-level region grown by the fast marching method.protected int[]
m_aiBoundary
The boundary of the segmented result from region growing.protected int[]
m_aiInterior
The interior of the segmented result from region growing.protected float
m_fCurrentDistance
The current distance for boundary pixels in the region growing involving the signed distance transform.protected float
m_fMaxDistance
The maximum allowed distance for the signed distance transform.protected int
m_iQuantity
The number of image elements.protected LseFastMarch
m_kFastMarcher
The fast marching object used for region growing and for signed distance transforms.protected LsePdeFilter
m_kLevelSetEvolver
The level-set evolver.
-
Constructor Summary
Constructors Modifier Constructor Description protected
LseSegmenter(int iQuantity, float[] afData, boolean[] abMask)
Create a new level-set segmenter object.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
beginCoarse(int[] aiSeeds)
The region is grown from the input seeds.boolean
beginDistanceTransform(float fMaxDistance)
An annulus is computed about the boundary of the coarse-level segmentation.void
beginEvolution(float fAdvectionWeight, float fPropagationWeight, float fCurvatureWeight, float fLaplacianWeight, float fTimeStep)
Evolve the signed-distance transform in the annulus constructed previously.void
endCoarse()
Call endCoarse when you are finished with the region growing.void
endDistanceTransform()
Call endDistanceTransform when you are finished with the distance transform construction.void
endEvolution()
Call endEvolution when you are finished with the level-set evolution.int[]
getBoundary()
The set of boundary points that were identified as part of the coarse-level region growing.LseFastMarch
getFastMarcher()
Get the fast marching object.int[]
getInterior()
The set of interior points that were identified as part of the coarse-level region growing.LsePdeFilter
getLevelSetEvolver()
Get the level-set evolver object.float[]
getSignedDistanceImage()
Get the signed distance transform.boolean[]
getSignedDistanceMask()
Get the signed distance transform mask.void
iterateCoarse()
Apply a single iteration of the region-growing fast march.boolean
iterateDistanceTransform()
Apply a single iteration of the annulus construction.void
iterateEvolution()
Apply a single iteration of the evolution.abstract void
setDiffusionIterations(int iDIterations)
Set the number of iterations to use in the nonlinear diffusion (curvature flow filter) applied to the input image.abstract void
setGradientMagnitudeScale(float fScale)
Set the scale to use in computing the blurred gradient magnitude of the curvature flow image.abstract void
setPDEParameters(float fBorderValue, int eScaleType, float fTimeStep)
Parameters for the feature image creation.abstract void
setSigmoidFilter(float fAlpha, float fBeta, float fMin, float fMax)
Set the parameters for the sigmoid function through which the blurred gradient magnitude image is processed.
-
-
-
Field Detail
-
m_iQuantity
protected int m_iQuantity
The number of image elements.
-
m_afData
protected float[] m_afData
The image elements.
-
m_abMask
protected boolean[] m_abMask
Masks to indicate which image elements are to be processed by the segmenter.
-
m_kFastMarcher
protected LseFastMarch m_kFastMarcher
The fast marching object used for region growing and for signed distance transforms.
-
m_aiInterior
protected int[] m_aiInterior
The interior of the segmented result from region growing.
-
m_aiBoundary
protected int[] m_aiBoundary
The boundary of the segmented result from region growing.
-
m_fCurrentDistance
protected float m_fCurrentDistance
The current distance for boundary pixels in the region growing involving the signed distance transform.
-
m_fMaxDistance
protected float m_fMaxDistance
The maximum allowed distance for the signed distance transform. This is user-specified.
-
m_afSignedDistance
protected float[] m_afSignedDistance
The signed distance transform computed from the coarse-level region grown by the fast marching method.
-
m_abSignedDistanceMask
protected boolean[] m_abSignedDistanceMask
The mask that indicates which image elements have been included in the signed distance transform.
-
m_kLevelSetEvolver
protected LsePdeFilter m_kLevelSetEvolver
The level-set evolver.
-
-
Constructor Detail
-
LseSegmenter
protected LseSegmenter(int iQuantity, float[] afData, boolean[] abMask)
Create a new level-set segmenter object.- Parameters:
iQuantity
- The number of image elements.afData
- The image elements.abMask
- The masks to indicate which image elements should be processed by the segmenter.
-
-
Method Detail
-
setPDEParameters
public abstract void setPDEParameters(float fBorderValue, int eScaleType, float fTimeStep)
Parameters for the feature image creation. You may set these anytime before a sequence of fast-march iterations. The PDE filters require you to specify how to handle boundary values. If you want Dirichlet conditions (constant boundary), set BorderValue to a finite number. If you want Neumann conditions (zero-derivative boundary), set the BorderValue to Float.MAX_VALUE. If you want the original image to be scaled, choose the Type parameter appropriately. The input image is processed by a curvature-based anisotropic diffusion filter; the number of iterations is DIterations. The gradient magnitude at the specified Scale is computed for the output of the diffusion filter. The gradient magnitude is transformed to the feature image by a sigmoid function:
feature(x) = min + (max-min)/(1 + exp(-(x-beta)/alpha))
The inverse of the feature image values are the speeds used in the fast marching algorithm.- Parameters:
fBorderValue
- The border value to use when processing boundary pixels.eScaleType
- The scaling type for the image.fTimeStep
- The time step for the PDE solver.
-
setDiffusionIterations
public abstract void setDiffusionIterations(int iDIterations)
Set the number of iterations to use in the nonlinear diffusion (curvature flow filter) applied to the input image.- Parameters:
iDIterations
- The number of iterations.
-
setGradientMagnitudeScale
public abstract void setGradientMagnitudeScale(float fScale)
Set the scale to use in computing the blurred gradient magnitude of the curvature flow image.- Parameters:
fScale
- The scale for the blurred gradient magnitude image.
-
setSigmoidFilter
public abstract void setSigmoidFilter(float fAlpha, float fBeta, float fMin, float fMax)
Set the parameters for the sigmoid function through which the blurred gradient magnitude image is processed.- Parameters:
fAlpha
- The variance of the function.fBeta
- The center of the function.fMin
- The minimum of the function.fMax
- The maximum of the function.
-
getFastMarcher
public final LseFastMarch getFastMarcher()
Get the fast marching object. This object is used for the coarse-level segmentation and for the signed-distance transform.- Returns:
- The fast marching object.
-
getLevelSetEvolver
public final LsePdeFilter getLevelSetEvolver()
Get the level-set evolver object.- Returns:
- The evolver object.
-
beginCoarse
public void beginCoarse(int[] aiSeeds)
The region is grown from the input seeds. You can apply the region growing multiple times to the same image, each time starting with beginCoarse. A derived class must implement this function and call the base-class function before it does any of its specialized work.- Parameters:
aiSeeds
- The initial region to grow.
-
iterateCoarse
public final void iterateCoarse()
Apply a single iteration of the region-growing fast march.
-
endCoarse
public final void endCoarse()
Call endCoarse when you are finished with the region growing. After this call, getInterior and getBoundary may be called to examine the coarse-level segmentation.
-
getInterior
public final int[] getInterior()
The set of interior points that were identified as part of the coarse-level region growing.- Returns:
- An array of interior points of the grown region.
-
getBoundary
public final int[] getBoundary()
The set of boundary points that were identified as part of the coarse-level region growing.- Returns:
- An array of boundary points of the grown region.
-
beginDistanceTransform
public boolean beginDistanceTransform(float fMaxDistance)
An annulus is computed about the boundary of the coarse-level segmentation. The maximum distance from annulus points to the boundary is the input to this function (in image-element units). The function returns 'true' if and only if the set of boundary points from the region growing is not empty. A derived class must implement this function and call the base-class function before it does any of its specialized work.- Parameters:
fMaxDistance
- The maximum distance allowed in the region growing associated with the signed distance transform.- Returns:
- 'true' iff the current region has at least one boundary point.
-
iterateDistanceTransform
public final boolean iterateDistanceTransform()
Apply a single iteration of the annulus construction.- Returns:
- 'true' iff there are still iterations to perform. This is the case as long as the current distance is smaller than the maximum specified distance.
-
endDistanceTransform
public final void endDistanceTransform()
Call endDistanceTransform when you are finished with the distance transform construction. After this call, getSignedDistanceImage and getSignedDistanceMask may be called to examine the annulus points and signed distances.
-
getSignedDistanceImage
public final float[] getSignedDistanceImage()
Get the signed distance transform. These have relevant values only after a call to EndDistanceTransform. The signed distances are set to zero for image elements that are outside the annulus (masked region).- Returns:
- The array of signed distance values.
-
getSignedDistanceMask
public final boolean[] getSignedDistanceMask()
Get the signed distance transform mask. These have relevant values only after a call to EndDistanceTransform. The 'true' masks indicate image elements that are part of the computed annulus.- Returns:
- The array of signed distance transform masks.
-
beginEvolution
public void beginEvolution(float fAdvectionWeight, float fPropagationWeight, float fCurvatureWeight, float fLaplacianWeight, float fTimeStep)
Evolve the signed-distance transform in the annulus constructed previously. A derived class must implement this function and call the base-class function before it does any of its specialized work.- Parameters:
fAdvectionWeight
- The advection weight in the PDE governing the level-set evolution in the annulus.fPropagationWeight
- The propagation weight in the PDE governing the level-set evolution in the annulus.fCurvatureWeight
- The curvature weight in the PDE governing the level-set evolution in the annulus.fLaplacianWeight
- The Laplacian weight in the PDE governing the level-set evolution in the annulus.fTimeStep
- The time step for one iteration of the numerical PDE solver.
-
iterateEvolution
public final void iterateEvolution()
Apply a single iteration of the evolution.
-
endEvolution
public final void endEvolution()
Call endEvolution when you are finished with the level-set evolution.
-
-