|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread gov.nih.mipav.model.algorithms.AlgorithmBase gov.nih.mipav.model.algorithms.AlgorithmEdgeNMSuppression
public class AlgorithmEdgeNMSuppression
Calculates the non-maximum suppression of an image at a scale defined by the user. This algorithm produces an edge map of the zero crossings of the non-maximum suppression for 2D images and 2.5D images. Edges are defined as the union of points for which the gradient magnitude assumes a maximum in the gradient direction. Introuduce a local orthonormal coordinate system (u,v) at any point P0, where the v-axis is parallel to the gradient direction at P0, and the u-axis is perpindicular. Iu = sin(a)*Ix - cos(a)*Iy Iv = cos(a)*Ix + sin(a)*Iy cos(a) = Ix/(sqrt(Ix*Ix + Iy*Iy)) evaluated at P0 sin(a) = Iy/(sqrt(Ix*Ix + Iy*Iy)) evaluated at P0 Iu = (Ix*Iy - Ix*Iy)/(sqrt(Ix*Ix + Iy*Iy)) = 0 Iv = (Ix*Ix + Iy*Iy)/(sqrt(Ix*Ix + Iy*Iy)) = sqrt(Ix*Ix + Iy*Iy) Iv*Iv = Ix*Ix + Iy*Iy Ivv = (cos(a)*Ix + sin(a)*Iy)(cos(a)*Ix + sin(a)*Iy) = cos(a)*cos(a)*Ixx + 2*cos(a)*sin(a)*Ixy + sin(a)*sin(a)*Iyy = (Ix*Ix*Ixx + 2*Ix*Iy*Ixy + Iy*Iy*Iyy)/(Ix*Ix + Iy*Iy) Iv*Iv*Ivv = Ix*Ix*Ixx + 2*Ix*Iy*Ixy + Iy*Iy*Iyy Ivvv = (cos(a)*cos(a)*Ixx + 2*cos(a)*sin(a)*Ixy + sin(a)*sin(a)*Iyy)(cos(a)*Ix + sin(a)*Iy) = cos(a)*cos(a)*cos(a)*Ixxx + 3*cos(a)*cos(a)*sin(a)*Ixxy + 3*cos(a)*sin(a)*sin(a)*Ixyy + sin(a)*sin(a)*sin(a)*Iyyy = (Ix*Ix*Ix*Ixxx + 3*Ix*Ix*Iy*Ixxy + 3*Ix*Iy*Iy*Ixyy + Iy*Iy*Iy*Iyyy)/((Ix*Ix + Iy*Iy)**3/2) Iv*Iv*Iv*Ivvv = Ix*Ix*Ix*Ixxx + 3*Ix*Ix*Iy*Ixxy + 3*Ix*Iy*Iy*Ixyy + Iy*Iy*Iy*Iyyy Assuming that the second and third-order directional derivatives of I in the v-direction are not simultaneously zero, a necessary and sufficient condition for P0 to be a gradient maximum in the gradient direction may be stated as: Ivv = 0, Ivvv < 0. Since only the sign information is important, this condition can be restated as: Iv*Iv*Ivv = 0, Iv*Iv*Iv*Ivvv < 0. Reference: Geometry-Driven Diffusion in Computer Vision, Bart M. ter Haar Romeny(Ed.), Chapter2:Linear Scale-Space II: Early Visual Operations by Tony Lindeberg and Bart M. ter Haar Romeny, Kluwer Academic Publishers, 1994, page 45.
For 3D a similar derivation: Iv = cos(a)*sin(b)*Ix + sin(a)*sin(b)*Iy + cos(b)*Iz where spherical coordinates are being used cos(a) = Ix/(sqrt(Ix*Ix + Iy*Iy)) evaluated at P0 sin(a) = Iy/(sqrt(Ix*Ix + Iy*Iy)) evaluated at P0 cos(b) = Iz/(sqrt(Ix*Ix + Iy*Iy + Iz*Iz)) evaluated at P0 sin(b) = sqrt(Ix*Ix + Iy*Iy)/(sqrt(Ix*Ix + Iy*Iy + Iz*Iz)) evaluated at P0 Iv = (Ix*Ix + Iy*Iy + Iz*Iz)/(sqrt(Ix*Ix + Iy*Iy + Iz*Iz)) = sqrt(Ix*Ix + Iy*Iy + Iz*Iz) Iv*Iv = Ix*Ix + Iy*Iy + Iz*Iz Ivv = (cos(a)*sin(b)*Ix + sin(a)*sin(b)*Iy + cos(b)*Iz)(cos(a)*sin(b)*Ix + sin(a)*sin(b)*Iy + cos(b)*Iz) = cos(a)*cos(a)*sin(b)*sin(b)*Ixx + 2*cos(a)*sin(a)*sin(b)*sin(b)*Ixy + 2*cos(a)*cos(b)*sin(b)*Ixz + s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Iz*Iyyz + 3*Iy*Iz*Iz*Iyzz + Iz*Iz*Iz*Izzz)/ ((Ix*Ix + Iy*Iy + Iz*Iz)**1.5) Iv*Iv*Iv*Ivvv = Ix*Ix*Ix*Ixxx + 3*Ix*Ix*Iy*Ixxy + 3*Ix*Ix*Iz*Ixxz + 3*Ix*Iy*Iy*Ixyy + 6*Ix*Iy*Iz*Ixyz + 3*Ix*Iz*Iz*Ixzz + Iy*Iy*Iy*Iyyy + 3*Iy*Iy*Iz*Iyyz + 3*Iy*Iz*Iz*Iyzz + Iz*Iz*Iz*Izzz
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
static int |
MARCHING_SQUARES
Perform zero crossing detection using the marching squares method. |
static int |
OLD_DETECTION
Perform zero crossing detection using Matt's old method. |
Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase |
---|
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, srcImage, threadStopped |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
AlgorithmEdgeNMSuppression(ModelImage destImg,
ModelImage srcImg,
float[] sigmas,
boolean maskFlag,
boolean img25D)
Creates a new AlgorithmEdgeNMSuppression object. |
Method Summary | |
---|---|
void |
algorithmPerformed(AlgorithmBase algorithm)
Called after an algorithm this listener is registered to exits (maybe successfully, maybe not). |
void |
finalize()
Prepares this class for destruction. |
static BitSet |
genLevelMask(int xDim,
int yDim,
float[] buffer,
float level,
int detectionType)
Generates a zero crossing mask for a 2D function sets a Bitset object to 1 is a zero crossing is detected. |
void |
genZeroXMask(int slice,
float[] buffer,
float[] buffer2,
int detectionType)
Generates a zero crossing mask for a 2D function sets a ModelImage to 255 if a zero crossing is detected. |
ModelImage |
getZeroXMask()
Accessor to return mask indicating zero crossings. |
void |
runAlgorithm()
Starts the program. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MARCHING_SQUARES
public static final int OLD_DETECTION
Constructor Detail |
---|
public AlgorithmEdgeNMSuppression(ModelImage destImg, ModelImage srcImg, float[] sigmas, boolean maskFlag, boolean img25D)
destImg
- image model where result image is to storedsrcImg
- source image modelsigmas
- Gaussian's standard deviations in the each dimensionmaskFlag
- Flag that indicates that the EdgeNMSup will be calculated for the whole image if equal to trueimg25D
- Flag, if true, indicates that each slice of the 3D volume should be processed independently. 2D
images disregard this flag.Method Detail |
---|
public static BitSet genLevelMask(int xDim, int yDim, float[] buffer, float level, int detectionType)
xDim
- the buffer's x dimensionyDim
- the buffer's y dimensionbuffer
- array in which to find zero crossinglevel
- the level to find the crossing of (usually will be 0)detectionType
- the type of zero crossing method to use
public void finalize()
finalize
in class AlgorithmBase
public void genZeroXMask(int slice, float[] buffer, float[] buffer2, int detectionType)
slice
- DOCUMENT ME!buffer
- array in which to find zero crossingbuffer2
- array which ensures that zero crossing is only counted if buffer2 value at that position
is less than zerodetectionType
- the type of zero crossing detection to performpublic ModelImage getZeroXMask()
public void runAlgorithm()
runAlgorithm
in class AlgorithmBase
public void algorithmPerformed(AlgorithmBase algorithm)
AlgorithmInterface
algorithmPerformed
in interface AlgorithmInterface
algorithm
- the algorithm which has just completed
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |