Class AlgorithmEdgeNMSuppression
- All Implemented Interfaces:
AlgorithmInterface,ActionListener,WindowListener,Runnable,EventListener
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 + sin(a)*sin(a)*sin(b)*sin(b)*Iyy + 2*sin(a)*cos(b)*sin(b)*Iyz + cos(b)*cos(b)*Izz = (Ix*Ix*Ixx + 2*Ix*Iy*Ixy + 2*Ix*Iz*Ixz + Iy*Iy*Iyy + 2*Iy*Iz*Iyz + Iz*Iz*Izz)/ (Ix*Ix + Iy*Iy + Iz*Iz) Iv*Iv*Ivv = Ix*Ix*Ixx + 2*Ix*Iy*Ixy + 2*Ix*Iz*Ixz + Iy*Iy*Iyy + 2*Iy*Iz*Iyz + Iz*Iz*Izz Ivvv = (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 + sin(a)*sin(a)*sin(b)*sin(b)*Iyy + 2*sin(a)*cos(b)*sin(b)*Iyz + cos(b)*cos(b)*Izz)(cos(a)*sin(b)*Ix + sin(a)*sin(b)*Iy + cos(b)*Iz) = cos(a)*cos(a)*cos(a)*sin(b)*sin(b)*sin(b)*Ixxx + 3*cos(a)*cos(a)*sin(a)*sin(b)*sin(b)*sin(b)*Ixxy + 3*cos(a)*cos(a)*cos(b)*sin(b)*sin(b)*Ixxz + 3*cos(a)*sin(a)*sin(a)*sin(b)*sin(b)*sin(b)*Ixyy + 6*cos(a)*sin(a)*cos(b)*sin(b)*sin(b)*Ixyz + 3*cos(a)*cos(b)*cos(b)*sin(b)*Ixzz + sin(a)*sin(a)*sin(a)*sin(b)*sin(b)*sin(b)*Iyyy + 3*sin(a)*sin(a)*cos(b)*sin(b)*sin(b)*Iyyz + 3*sin(a)*cos(b)*cos(b)*sin(b)*Iyzz + cos(b)*cos(b)*cos(b)*Izzz = (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)/ ((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.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanDOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private int[]DOCUMENT ME!static final intPerform zero crossing detection using the marching squares method.static final intPerform zero crossing detection using Matt's old method.private float[]private float[]DOCUMENT ME!private intThe type of zero crossing detection to use.private ModelImageDOCUMENT 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, threadStoppedFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionAlgorithmEdgeNMSuppression(ModelImage destImg, ModelImage srcImg, float[] sigmas, boolean maskFlag, boolean img25D) Creates a new AlgorithmEdgeNMSuppression object. -
Method Summary
Modifier and TypeMethodDescriptionvoidalgorithmPerformed(AlgorithmBase algorithm) Called after an algorithm this listener is registered to exits (maybe successfully, maybe not).private voidcalcStoreInDest2D(int nImages, int detectionType) This function produces the EdgeNMSup of input image.private voidcalcStoreInDest3D(int detectionType) This function produces the Non-maximum suppression of input image.voidfinalize()Prepares this class for destruction.static BitSetgenLevelMask(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.voidgenZeroXMask(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.Accessor to return mask indicating zero crossings.private voidCreates Gaussian derivative kernels.private voidCreates Gaussian derivative kernels.voidStarts the program.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, windowOpenedMethods 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, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
MARCHING_SQUARES
public static final int MARCHING_SQUARESPerform zero crossing detection using the marching squares method.- See Also:
-
OLD_DETECTION
public static final int OLD_DETECTIONPerform zero crossing detection using Matt's old method.- See Also:
-
entireImage
private boolean entireImageDOCUMENT ME! -
GxData
private float[] GxDataDOCUMENT ME! -
GxxData
private float[] GxxDataDOCUMENT ME! -
GxxxData
private float[] GxxxDataDOCUMENT ME! -
GxxyData
private float[] GxxyDataDOCUMENT ME! -
GxxzData
private float[] GxxzDataDOCUMENT ME! -
GxyData
private float[] GxyDataDOCUMENT ME! -
GxyyData
private float[] GxyyDataDOCUMENT ME! -
GxyzData
private float[] GxyzDataDOCUMENT ME! -
GxzData
private float[] GxzDataDOCUMENT ME! -
GxzzData
private float[] GxzzDataDOCUMENT ME! -
GyData
private float[] GyDataDOCUMENT ME! -
GyyData
private float[] GyyDataDOCUMENT ME! -
GyyyData
private float[] GyyyDataDOCUMENT ME! -
GyyzData
private float[] GyyzDataDOCUMENT ME! -
GyzData
private float[] GyzDataDOCUMENT ME! -
GyzzData
private float[] GyzzDataDOCUMENT ME! -
GzData
private float[] GzDataDOCUMENT ME! -
GzzData
private float[] GzzDataDOCUMENT ME! -
GzzzData
private float[] GzzzDataDOCUMENT ME! -
kExtents
private int[] kExtentsDOCUMENT ME! -
sigmas
private float[] sigmasDOCUMENT ME! -
zeroDetectionType
private int zeroDetectionTypeThe type of zero crossing detection to use. -
zXMask
DOCUMENT ME! -
outputBuffer
private float[] outputBuffer
-
-
Constructor Details
-
AlgorithmEdgeNMSuppression
public AlgorithmEdgeNMSuppression(ModelImage destImg, ModelImage srcImg, float[] sigmas, boolean maskFlag, boolean img25D) Creates a new AlgorithmEdgeNMSuppression object.- Parameters:
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 Details
-
genLevelMask
public 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.- Parameters:
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- Returns:
- DOCUMENT ME!
-
finalize
public void finalize()Prepares this class for destruction.- Overrides:
finalizein classAlgorithmBase
-
genZeroXMask
public 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.- Parameters:
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 perform
-
getZeroXMask
Accessor to return mask indicating zero crossings.- Returns:
- ModelImage of zero crossings (2D function); 255 = indicates zero crossing
-
runAlgorithm
public void runAlgorithm()Starts the program.- Specified by:
runAlgorithmin classAlgorithmBase
-
calcStoreInDest2D
private void calcStoreInDest2D(int nImages, int detectionType) This function produces the EdgeNMSup of input image.- Parameters:
nImages- number of images to be blurred. If 2D image then nImage = 1, if 3D image where each image is to processed independently then nImages equals the number of images in the volume.detectionType- the type of zero crossing detection to perform
-
calcStoreInDest3D
private void calcStoreInDest3D(int detectionType) This function produces the Non-maximum suppression of input image.- Parameters:
detectionType- the type of zero crossing detection to perform
-
makeKernels2D
private void makeKernels2D()Creates Gaussian derivative kernels. -
makeKernels3D
private void makeKernels3D()Creates Gaussian derivative kernels. -
algorithmPerformed
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
-