Package gov.nih.mipav.model.algorithms
Class AlgorithmGrayScaleMorphology25D
java.lang.Object
java.lang.Thread
gov.nih.mipav.model.algorithms.AlgorithmBase
gov.nih.mipav.model.algorithms.AlgorithmGrayScaleMorphology25D
- All Implemented Interfaces:
ActionListener,WindowListener,Runnable,EventListener
2.5D mathematical morphology class applied to Gray scale images. (2D morphology on 3D volumes). Kernels of 3x3 (4 or 8 connected) and 5x5 (12
connected) are available or user defined kernels can be supplied.
Supported methods include:
- Bottom hat
- close
- dilate
- erode
- Morphological gradient
- Morphological laplacian
- open
- Top hat
Adapted from AlgoritmMorphology2D by Matthew J. McAuliffe, Ph.D.
- Version:
- 1.0 June 8, 2004
- Author:
- Evan McCreedy
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intDOCUMENT ME!static final intDOCUMENT ME!static final intprivate floatDOCUMENT ME!static final intDOCUMENT ME!static final intstatic final intDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!private booleanDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!static final intstatic final intprivate intSize of geodesic erosions and dilationsstatic final intDOCUMENT ME!private double[]DOCUMENT ME!private double[]private intDOCUMENT ME!static final intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private BitSetDOCUMENT ME!private intprivate double[]private ModelImageUsed in geodesic dilation, geodesic erosion, morphological reconstruction by dilation, and morphological reconstruction by erosion Not used in opening by reconstruction and closing by reconstructionstatic final intstatic final intstatic final intstatic final intprivate intNumber pixels to prune.static final intDOCUMENT ME!static final intstatic final intDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!private double[]DOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!private intDOCUMENT ME!static final intstatic final intDOCUMENT 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
ConstructorsConstructorDescriptionAlgorithmGrayScaleMorphology25D(ModelImage srcImg, int kernelType, float circleDiameter, int method, int iterD, int iterE, int pruningPix, int edType, boolean entireImage) Creates a new AlgorithmMorphology25D object.AlgorithmGrayScaleMorphology25D(ModelImage srcImg, ModelImage maskImage, int kernelType, float circleDiameter, int method, int geodesicSize, int iterD, int iterE, boolean entireImage) Creates a new AlgorithmGrayScaleMorphology25D object. -
Method Summary
Modifier and TypeMethodDescriptionprivate voiddilate(boolean returnFlag, int iters) Dilates an image using the indicated kernel and the indicated number of executions.private voiddilate2D(int indexZ, int iters) Dilates an image slice using the indicated kernel and the indicated number of executions.private voiderode(boolean returnFlag, int iters) Erodes an image using the indicated kernel and the indicated number of executions.private voiderode2D(int indexZ, int iters) Erodes an image slice using the indicated kernel and the indicated number of executions.voidfinalize()Prepares this class for destruction.private voidgeodesicDilation(boolean returnFlag, int geodesicSize) geodesic dilation of a boolean, unsigned byte or unsigned short image using the indicated kernel and the indicated number of executions.private voidgeodesicErosion(boolean returnFlag, int geodesicSize) geodesic erosion of a boolean, unsigned byte or unsigned short image using the indicated kernel and the indicated number of executions.private voidmakeCircularKernel(float circDiameter) Generates a circular kernel of a specific diameter.private voidmakeKernel(int kernelType) Generates a kernel of the indicated type.voidStarts the program.voidsetAlgorithm(int method) Sets the algorithm type (i.e. erode, dilate)voidsetImage(ModelImage img) Sets the algorithm to new image of boolean type.voidsetIterations(int itersD, int itersE) Sets number of iterations for closing or opening.voidSets user defined square kernels.voiddisplay kernel as 1 or 0 in the debug window.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
-
ERODE
public static final int ERODEDOCUMENT ME!- See Also:
-
DILATE
public static final int DILATEDOCUMENT ME!- See Also:
-
CLOSE
public static final int CLOSEDOCUMENT ME!- See Also:
-
OPEN
public static final int OPENDOCUMENT ME!- See Also:
-
ID_OBJECTS
public static final int ID_OBJECTSDOCUMENT ME!- See Also:
-
DELETE_OBJECTS
public static final int DELETE_OBJECTSDOCUMENT ME!- See Also:
-
DISTANCE_MAP
public static final int DISTANCE_MAPDOCUMENT ME!- See Also:
-
BG_DISTANCE_MAP
public static final int BG_DISTANCE_MAPDOCUMENT ME!- See Also:
-
ULTIMATE_ERODE
public static final int ULTIMATE_ERODEDOCUMENT ME!- See Also:
-
PARTICLE_ANALYSIS
public static final int PARTICLE_ANALYSISDOCUMENT ME!- See Also:
-
SKELETONIZE
public static final int SKELETONIZEDOCUMENT ME!- See Also:
-
FIND_EDGES
public static final int FIND_EDGESDOCUMENT ME!- See Also:
-
PARTICLE_ANALYSIS_NEW
public static final int PARTICLE_ANALYSIS_NEWDOCUMENT ME!- See Also:
-
FILL_HOLES
public static final int FILL_HOLESDOCUMENT ME!- See Also:
-
MORPHOLOGICAL_GRADIENT
public static final int MORPHOLOGICAL_GRADIENT- See Also:
-
TOP_HAT
public static final int TOP_HAT- See Also:
-
BOTTOM_HAT
public static final int BOTTOM_HAT- See Also:
-
MORPHOLOGICAL_LAPLACIAN
public static final int MORPHOLOGICAL_LAPLACIAN- See Also:
-
GEODESIC_DILATION
public static final int GEODESIC_DILATION- See Also:
-
GEODESIC_EROSION
public static final int GEODESIC_EROSION- See Also:
-
MORPHOLOGICAL_RECONSTRUCTION_BY_DILATION
public static final int MORPHOLOGICAL_RECONSTRUCTION_BY_DILATION- See Also:
-
MORPHOLOGICAL_RECONSTRUCTION_BY_EROSION
public static final int MORPHOLOGICAL_RECONSTRUCTION_BY_EROSION- See Also:
-
OPENING_BY_RECONSTRUCTION
public static final int OPENING_BY_RECONSTRUCTION- See Also:
-
CLOSING_BY_RECONSTRUCTION
public static final int CLOSING_BY_RECONSTRUCTION- See Also:
-
SIZED_CIRCLE
public static final int SIZED_CIRCLEDOCUMENT ME!- See Also:
-
CONNECTED4
public static final int CONNECTED4DOCUMENT ME!- See Also:
-
CONNECTED8
public static final int CONNECTED8DOCUMENT ME!- See Also:
-
CONNECTED12
public static final int CONNECTED12DOCUMENT ME!- See Also:
-
OUTER_EDGING
public static final int OUTER_EDGINGDOCUMENT ME!- See Also:
-
INNER_EDGING
public static final int INNER_EDGINGDOCUMENT ME!- See Also:
-
algorithm
private int algorithmDOCUMENT ME! -
circleDiameter
private float circleDiameterDOCUMENT ME! -
entireImage
private boolean entireImageDOCUMENT ME! -
imgBuffer
private double[] imgBufferDOCUMENT ME! -
imgBuffer2
private double[] imgBuffer2 -
maskBuffer
private double[] maskBuffer -
imgLength
private int imgLengthDOCUMENT ME! -
iterationsD
private int iterationsDDOCUMENT ME! -
iterationsE
private int iterationsEDOCUMENT ME! -
kDim
private int kDimDOCUMENT ME! -
kernel
DOCUMENT ME! -
kernelType
private int kernelType -
numPruningPixels
private int numPruningPixelsNumber pixels to prune. -
processBuffer
private double[] processBufferDOCUMENT ME! -
sliceLength
private int sliceLengthDOCUMENT ME! -
maskImage
Used in geodesic dilation, geodesic erosion, morphological reconstruction by dilation, and morphological reconstruction by erosion Not used in opening by reconstruction and closing by reconstruction -
geodesicSize
private int geodesicSizeSize of geodesic erosions and dilations
-
-
Constructor Details
-
AlgorithmGrayScaleMorphology25D
public AlgorithmGrayScaleMorphology25D(ModelImage srcImg, int kernelType, float circleDiameter, int method, int iterD, int iterE, int pruningPix, int edType, boolean entireImage) Creates a new AlgorithmMorphology25D object.- Parameters:
srcImg- source image modelkernelType- kernel size (i.e. connectedness)circleDiameter- only valid if kernelType == SIZED_CIRCLE and represents the width of a circle in the resolution of the imagemethod- setup the algorithm method (i.e. erode, dilate)iterD- number of times to dilateiterE- number of times to erodepruningPix- the number of pixels to pruneedType- the type of edging to perform (inner or outer)entireImage- if true, indicates that the VOIs should NOT be used and that entire image should be processed
-
AlgorithmGrayScaleMorphology25D
public AlgorithmGrayScaleMorphology25D(ModelImage srcImg, ModelImage maskImage, int kernelType, float circleDiameter, int method, int geodesicSize, int iterD, int iterE, boolean entireImage) Creates a new AlgorithmGrayScaleMorphology25D object.- Parameters:
srcImg- source image modelkernelType- dilation kernel size (i.e. connectedness)circleDiameter- dilation only valid if kernelType == SIZED_CIRCLE and represents the width of a circle in the resolution of the imagemethod- setup the algorithm method (i.e. erode, dilate)geodesicSize-iterD- number of times to dilateiterE- number of times to erodeentireImage- if true, indicates that the VOIs should NOT be used and that entire image should be processed
-
-
Method Details
-
finalize
public void finalize()Prepares this class for destruction.- Overrides:
finalizein classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()Starts the program.- Specified by:
runAlgorithmin classAlgorithmBase
-
setAlgorithm
public void setAlgorithm(int method) Sets the algorithm type (i.e. erode, dilate)- Parameters:
method- algorithm type
-
setImage
Sets the algorithm to new image of boolean type.- Parameters:
img- image model of boolean type
-
setIterations
public void setIterations(int itersD, int itersE) Sets number of iterations for closing or opening.- Parameters:
itersD- number of dilationsitersE- number of erosions
-
setKernel
Sets user defined square kernels.- Parameters:
kernel- user defined kerneldim- length of one dimension (kernel should be square)
-
showKernel
public void showKernel()display kernel as 1 or 0 in the debug window. -
dilate
private void dilate(boolean returnFlag, int iters) Dilates an image using the indicated kernel and the indicated number of executions. The grayscale dilation is the maximum value over the reflected kernel region. For symmetric kernels the reflected kernel is the same as the kernel.- Parameters:
returnFlag- if true then this operation is a step in the morph process (i.e. close)iters- number of dilations
-
geodesicDilation
private void geodesicDilation(boolean returnFlag, int geodesicSize) geodesic dilation of a boolean, unsigned byte or unsigned short image using the indicated kernel and the indicated number of executions.- Parameters:
returnFlag- if true then this operation is a step in the morph process (i.e. close)geodesicSize-
-
dilate2D
private void dilate2D(int indexZ, int iters) Dilates an image slice using the indicated kernel and the indicated number of executions. The grayscale dilation is the maximum value over the reflected kernel region. For symmetric kernels the reflected kernel is the same as the kernel.- Parameters:
indexZ-iters- number of dilations
-
geodesicErosion
private void geodesicErosion(boolean returnFlag, int geodesicSize) geodesic erosion of a boolean, unsigned byte or unsigned short image using the indicated kernel and the indicated number of executions.- Parameters:
returnFlag- if true then this operation is a step in the morph process (i.e. close)geodesicSize-
-
erode2D
private void erode2D(int indexZ, int iters) Erodes an image slice using the indicated kernel and the indicated number of executions. The grayscale erosion is the minimum value over the kernel region.- Parameters:
indexZ-iters- number of erosion iterations.
-
erode
private void erode(boolean returnFlag, int iters) Erodes an image using the indicated kernel and the indicated number of executions. The grayscale erosion is the minimum value over the kernel region.- Parameters:
returnFlag- if true then this operation is a step in the morph process (i.e. open)iters- number of erosion iterations.
-
makeCircularKernel
private void makeCircularKernel(float circDiameter) Generates a circular kernel of a specific diameter.- Parameters:
circDiameter- represents the width of a circle in the resolution of the image
-
makeKernel
private void makeKernel(int kernelType) Generates a kernel of the indicated type.- Parameters:
kernelType- type of kernel to be generated.
-