Class AlgorithmMorphologicalFilter
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.filters.AlgorithmMorphologicalFilter
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmMorphologicalFilter extends AlgorithmBase
Performs morphological filtering on black and white images. This is a shading correction routine, that is, it corrects for non-uniform illumination and non-uniform camera sensitivity. A morphological filtered pixel = the original pixel - the morphological smoothed pixel + a constant to restore the original average image brightness. A morphological smoothed pixel is given by the min(max(max(min(original pixel)))), where the sizes[] array contains the dimensions of the region examined for the minimum and the maximum. Reference: 1.) "Shading Correction: Compensation for Illumination and Sensor Inhomogeneities" by Ian T. Young, July 19, 2000. www.ph.tn.tudelft.nl/People/albert/papers/YoungShading.pdf- Version:
- 0.1 Feb 17, 2005
- Author:
- William Gandler
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
entireImage
Flag, if true, indicates that the whole image should be processed.private int[]
sizes
Kernel dimensionality.private int
xDim
DOCUMENT ME!private int
yDim
DOCUMENT ME!private int
zDim
DOCUMENT 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, threadStopped
-
-
Constructor Summary
Constructors Constructor Description AlgorithmMorphologicalFilter(ModelImage srcImg, int[] sizes, boolean maskFlag, boolean img25D)
Constructs a Morphological filter object.AlgorithmMorphologicalFilter(ModelImage destImg, ModelImage srcImg, int[] sizes, boolean maskFlag, boolean img25D)
Constructs a Morphological filter object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
calcInPlace2D(int nImages)
Calculates the Morphological Filter image and replaces the source image with the new image.private void
calcInPlace3D()
Calculates the Morphological Filter and replaces the source image with the new image.private void
calcStoreInDest2D(int nImages)
This function produces the Morphological Filter of input image.private void
calcStoreInDest3D()
This function produces the Morphological Filter of input image.void
finalize()
Prepares this class for destruction.private float
max2DPt(int pix, float[] image)
A function that finds the maximum value in a local image rectangle.private float
max3DPt(int pix, float[] image)
A function that finds the maximum value in a local image volume.private float
min2DPt(int pix, float[] image)
A function that finds the minimum value in a local image rectangle.private float
min3DPt(int pix, float[] image)
A function that finds the minimum value in a local image volume.void
runAlgorithm()
Starts 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, windowOpened
-
Methods 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, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
entireImage
private boolean entireImage
Flag, if true, indicates that the whole image should be processed. If false on process the image over the mask areas.
-
sizes
private int[] sizes
Kernel dimensionality.
-
xDim
private int xDim
DOCUMENT ME!
-
yDim
private int yDim
DOCUMENT ME!
-
zDim
private int zDim
DOCUMENT ME!
-
-
Constructor Detail
-
AlgorithmMorphologicalFilter
public AlgorithmMorphologicalFilter(ModelImage srcImg, int[] sizes, boolean maskFlag, boolean img25D)
Constructs a Morphological filter object.- Parameters:
srcImg
- source image modelsizes
- Filter size in each dimensionmaskFlag
- Flag that indicates that the Morphological filter 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.
-
AlgorithmMorphologicalFilter
public AlgorithmMorphologicalFilter(ModelImage destImg, ModelImage srcImg, int[] sizes, boolean maskFlag, boolean img25D)
Constructs a Morphological filter object.- Parameters:
destImg
- image model where result image is to storedsrcImg
- source image modelsizes
- Filter size in each dimensionmaskFlag
- Flag that indicates that the Morphological filter 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
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalize
in classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()
Starts the program.- Specified by:
runAlgorithm
in classAlgorithmBase
-
calcInPlace2D
private void calcInPlace2D(int nImages)
Calculates the Morphological Filter image and replaces the source image with the new 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.
-
calcInPlace3D
private void calcInPlace3D()
Calculates the Morphological Filter and replaces the source image with the new image.
-
calcStoreInDest2D
private void calcStoreInDest2D(int nImages)
This function produces the Morphological Filter 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.
-
calcStoreInDest3D
private void calcStoreInDest3D()
This function produces the Morphological Filter of input image.
-
max2DPt
private float max2DPt(int pix, float[] image)
A function that finds the maximum value in a local image rectangle.- Parameters:
pix
- index indicating location of convolutionimage
- image data- Returns:
- DOCUMENT ME!
-
max3DPt
private float max3DPt(int pix, float[] image)
A function that finds the maximum value in a local image volume.- Parameters:
pix
- index indicating location of convolutionimage
- image data- Returns:
- DOCUMENT ME!
-
min2DPt
private float min2DPt(int pix, float[] image)
A function that finds the minimum value in a local image rectangle.- Parameters:
pix
- index indicating location of convolutionimage
- image data- Returns:
- DOCUMENT ME!
-
min3DPt
private float min3DPt(int pix, float[] image)
A function that finds the minimum value in a local image volume.- Parameters:
pix
- index indicating location of convolutionimage
- image data- Returns:
- DOCUMENT ME!
-
-