Class AlgorithmCrop
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.utilities.AlgorithmCrop
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmCrop extends AlgorithmBase
Crops 2D and 3D images using a supplied VOI. Crops 4D images.- Version:
- 1.0 June 11, 1999
- Author:
- Matthew J. McAuliffe, Ph.D.
-
-
Field Summary
Fields Modifier and Type Field Description private int
cushion
Extra space around VOI in x and y dimensions.private boolean
RGBImage
Flag for color or noncolor image.private int[]
x
Storage for VOI.private int[]
y
Storage for VOI.private int[]
z
Storage for VOI.-
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 AlgorithmCrop(ModelImage destImg, ModelImage srcImg, int _cushion, int[] _x, int[] _y, int[] _z)
Creates new algorithms to crop image by specified bounds.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
calcStoreInDest2D()
This function produces a new image that has been cropped!private void
calcStoreInDest3D()
This function produces a new image that has been cropped.private void
calcStoreInDest4D()
This function produces a new image that has been cropped.private void
calcStoreInPlace2D()
This function crops srcImage Must use getSrcImage after running.private void
calcStoreInPlace3D()
This function crops srcImage Must use getSrcImage after running.private void
calcStoreInPlace4D()
This function crops srcImage Must use getSrcImage after running.void
finalize()
Prepares this class for destruction.ModelImage
getSrcImage()
DOCUMENT ME!private float[]
originImg2LPS(float[] origImg, ModelImage img)
Switch origin order from image order to LPS order.private float[]
originLPS2Img(float[] origLPS, ModelImage img)
Switch origin order from LPS order to Img order.void
runAlgorithm()
Starts the program.private void
updateDICOM()
Update special case DICOM format tags.private void
updateFileInfoData()
Updates important image attributes (start locations, orientation ) for the new cropped file by modifing the fileinfo fo the new ( destination ) image.-
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, 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
-
-
-
-
Constructor Detail
-
AlgorithmCrop
public AlgorithmCrop(ModelImage destImg, ModelImage srcImg, int _cushion, int[] _x, int[] _y, int[] _z)
Creates new algorithms to crop image by specified bounds. Stores in destImg.- Parameters:
destImg
- image model where result image is to stored, use null to do in-place calculationsrcImg
- source image model_cushion
- extra space around VOI in x and y dimensions._x
- VOI xBounds: x[0] = min. bound and x[1] = max. bound_y
- VOI yBounds: y[0] = min. bound and y[1] = max. bound_z
- VOI zBounds: z[0] = min. bound and z[1] = max. bound
-
-
Method Detail
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalize
in classAlgorithmBase
-
getSrcImage
public ModelImage getSrcImage()
DOCUMENT ME!- Overrides:
getSrcImage
in classAlgorithmBase
- Returns:
- ModelImage
-
runAlgorithm
public void runAlgorithm()
Starts the program.- Specified by:
runAlgorithm
in classAlgorithmBase
-
calcStoreInDest2D
private void calcStoreInDest2D()
This function produces a new image that has been cropped!
-
calcStoreInDest3D
private void calcStoreInDest3D()
This function produces a new image that has been cropped.
-
calcStoreInDest4D
private void calcStoreInDest4D()
This function produces a new image that has been cropped.
-
calcStoreInPlace2D
private void calcStoreInPlace2D()
This function crops srcImage Must use getSrcImage after running.
-
calcStoreInPlace3D
private void calcStoreInPlace3D()
This function crops srcImage Must use getSrcImage after running.
-
calcStoreInPlace4D
private void calcStoreInPlace4D()
This function crops srcImage Must use getSrcImage after running.
-
originImg2LPS
private float[] originImg2LPS(float[] origImg, ModelImage img)
Switch origin order from image order to LPS order.- Parameters:
origImg
- DOCUMENT ME!img
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
originLPS2Img
private float[] originLPS2Img(float[] origLPS, ModelImage img)
Switch origin order from LPS order to Img order.- Parameters:
origLPS
- DOCUMENT ME!img
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
updateDICOM
private void updateDICOM()
Update special case DICOM format tags.
-
updateFileInfoData
private void updateFileInfoData()
Updates important image attributes (start locations, orientation ) for the new cropped file by modifing the fileinfo fo the new ( destination ) image.
-
-