Class LseFastMarch
- java.lang.Object
-
- gov.nih.mipav.model.algorithms.levelset.LseFastMarch
-
- Direct Known Subclasses:
LseFastMarch2
,LseFastMarch3
public abstract class LseFastMarch extends java.lang.Object
The abstract base class for fast-marching methods of images. This is based on material from J. Sethian's book, Level Set Methods and Fast Marching Methods.- Version:
- 0.1 November 7, 2006
- Author:
- David Eberly
-
-
Field Summary
Fields Modifier and Type Field Description (package private) float[]
m_afInvSpeed
The inverse speeds associated with the image elements.(package private) float[]
m_afTime
The times at which the image elements are visited by moving boundaries.(package private) LseMinHeap.Record[]
m_akTrial
Those image elements that are adjacent to the current region boundary points are tracked to allow fast updates of the boundary.(package private) float
m_fMaxTime
The maximum time in m_afTime[].(package private) float
m_fMinTime
The minimum time in m_afTime[].(package private) int
m_iQuantity
The number of image elements.(package private) LseMinHeap
m_kHeap
A min-heap data structure used to keep track of the times so that the image element corresponding to the minimum time becomes the next processed boundary point.
-
Constructor Summary
Constructors Modifier Constructor Description protected
LseFastMarch(int iQuantity, float[] afSpeed, int[] aiSeeds)
Create a new fast-marching object, where the speed varies per image element.protected
LseFastMarch(int iQuantity, float fSpeed, int[] aiSeeds)
Create a new fast-marching object, where the speed is constant for all image elements.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
computeTimeExtremes()
Compute the minimum and maximum visitation times for the image elements.abstract int[]
getBoundary()
Get the indices of the boundary points of the current region.int[]
getInterior()
Get the indices of the interior points of the current region.float
getMaxTime()
Get the maximum visitation time for the image elements.float
getMinTime()
Get the minimum visitation time for the image elements.int
getQuantity()
Get the number of image elements.float
getTime(int i)
Get the time of visitation for an image element.protected void
initialize(int iQuantity, int[] aiSeeds)
Partial initialization of the fast marching object.protected void
initializeSpeed(float fSpeed)
Partial initialization of the fast marching object.protected void
initializeSpeed(float[] afSpeed)
Partial initialization of the fast marching object.abstract boolean
isBoundary(int i)
An image element is a boundary point when it is on the boundary of the current region.boolean
isFar(int i)
An image element is a far element when its visitation time t is infinite: t = Float.MAX_VALUE.boolean
isInterior(int i)
An image element is an interior element when it is valid and not a trial element.boolean
isTrial(int i)
An image element is a trial element when its visitation time t is invalid (t < 0), its inverse speed is finite, and the element is adjacent to the boundary of the current region.boolean
isValid(int i)
An image element is valid whenever its visitation time t satisfies the conditions: 0 ≤ t < Float.MAX_VALUE).boolean
isZeroSpeed(int i)
An image element is never visited when its corresponding speed is zero.abstract void
iterate()
Run one iteration of the fast marching algorithm.void
setTime(int i, float fTime)
Set the time of visitation for an image element.
-
-
-
Field Detail
-
m_iQuantity
int m_iQuantity
The number of image elements.
-
m_afInvSpeed
float[] m_afInvSpeed
The inverse speeds associated with the image elements. These are used to control the evolution of region boundaries.
-
m_afTime
float[] m_afTime
The times at which the image elements are visited by moving boundaries.
-
m_fMinTime
float m_fMinTime
The minimum time in m_afTime[].
-
m_fMaxTime
float m_fMaxTime
The maximum time in m_afTime[].
-
m_kHeap
LseMinHeap m_kHeap
A min-heap data structure used to keep track of the times so that the image element corresponding to the minimum time becomes the next processed boundary point.
-
m_akTrial
LseMinHeap.Record[] m_akTrial
Those image elements that are adjacent to the current region boundary points are tracked to allow fast updates of the boundary.
-
-
Constructor Detail
-
LseFastMarch
protected LseFastMarch(int iQuantity, float[] afSpeed, int[] aiSeeds)
Create a new fast-marching object, where the speed varies per image element.- Parameters:
iQuantity
- The number of image elements.afSpeed
- The array of speeds for the image elements.aiSeeds
- The initial region points.
-
LseFastMarch
protected LseFastMarch(int iQuantity, float fSpeed, int[] aiSeeds)
Create a new fast-marching object, where the speed is constant for all image elements.- Parameters:
iQuantity
- The number of image elements.fSpeed
- The common speed for the image elements.aiSeeds
- The initial region points.
-
-
Method Detail
-
getQuantity
public final int getQuantity()
Get the number of image elements.- Returns:
- The number of image elements.
-
setTime
public final void setTime(int i, float fTime)
Set the time of visitation for an image element.- Parameters:
i
- The index of the image element.fTime
- The time of visitation for the image element.
-
getTime
public final float getTime(int i)
Get the time of visitation for an image element.- Parameters:
i
- The index of the image element.- Returns:
- The time of visitation for the image element.
-
computeTimeExtremes
public final void computeTimeExtremes()
Compute the minimum and maximum visitation times for the image elements. The extreme values may be retrieved via calls to getMinTime() and getMaxTime().
-
getMinTime
public final float getMinTime()
Get the minimum visitation time for the image elements.- Returns:
- The minimum visitation time.
-
getMaxTime
public final float getMaxTime()
Get the maximum visitation time for the image elements.- Returns:
- The maximum visitation time.
-
isValid
public final boolean isValid(int i)
An image element is valid whenever its visitation time t satisfies the conditions: 0 ≤ t < Float.MAX_VALUE).- Parameters:
i
- The index of the image element.- Returns:
- The Boolean result of the t-constraints.
-
isTrial
public final boolean isTrial(int i)
An image element is a trial element when its visitation time t is invalid (t < 0), its inverse speed is finite, and the element is adjacent to the boundary of the current region.- Parameters:
i
- The index of the image element.- Returns:
- The Boolean result of the t-constraints.
-
isFar
public final boolean isFar(int i)
An image element is a far element when its visitation time t is infinite: t = Float.MAX_VALUE. Such elements are not considered when searching the heap for the next element to visit.- Parameters:
i
- The index of the image element.- Returns:
-
isZeroSpeed
public final boolean isZeroSpeed(int i)
An image element is never visited when its corresponding speed is zero. Such elements are preprocessed initially so that there visitation times are t = -Float.MAX_VALUE.- Parameters:
i
- The index of the image element.- Returns:
-
isInterior
public final boolean isInterior(int i)
An image element is an interior element when it is valid and not a trial element. Effectively, these are interior points of the current region.- Parameters:
i
- The index of the image element.- Returns:
-
getInterior
public int[] getInterior()
Get the indices of the interior points of the current region.- Returns:
- The array of indices of the interior points.
-
getBoundary
public abstract int[] getBoundary()
Get the indices of the boundary points of the current region. This is an abstract function, because the identification of such points depends on the dimensionality of the image.- Returns:
- The array of indices of the boundary points.
-
isBoundary
public abstract boolean isBoundary(int i)
An image element is a boundary point when it is on the boundary of the current region. This is an abstract function, because the identification of such points depends on the dimensionality of the image.- Parameters:
i
- The index of the image element.- Returns:
- The Boolean result indicating whether or not the image element is a boundary point.
-
iterate
public abstract void iterate()
Run one iteration of the fast marching algorithm. This is an abstract function, because the identification of such points depends on the dimensionality of the image.
-
initialize
protected void initialize(int iQuantity, int[] aiSeeds)
Partial initialization of the fast marching object. The visitation times are set to zero for the initial region (the seeds) but to Float.MAX_VALUE for all other points. Initially, none of the points are trial points.- Parameters:
iQuantity
- The number of image elements.aiSeeds
- The initial region points.
-
initializeSpeed
protected void initializeSpeed(float[] afSpeed)
Partial initialization of the fast marching object. The inverse speeds are computed for those speeds that are positive. If an input speed is zero, the inverse speed is set to Float.MAX_VALUE and the visitation time is set to -Float.MAX_VALUE as a flag that the corresponding image element should never be visited.- Parameters:
afSpeed
- The speeds for the image elements.
-
initializeSpeed
protected void initializeSpeed(float fSpeed)
Partial initialization of the fast marching object. The inverse speed is constnnt for all image elements and must be positive.- Parameters:
fSpeed
- The common speed for the image elements.
-
-