Class AlgorithmSwapSlicesVolume
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.utilities.AlgorithmSwapSlicesVolume
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmSwapSlicesVolume extends AlgorithmBase
Title: AlgorithmSwapSlicesVolume
Description: Allows user to re-slice/re-volume and associates fileInfo. This allows for slice/volume duplication, deletion, or insertion.
- Version:
- 0.9
- Author:
- Justin Senseney
-
-
Field Summary
Fields Modifier and Type Field Description private int
extentDest
Internal sorting variables for sorting slices on images of greater than 3 dimensionsprivate int
extentSrc
Internal sorting variables for sorting slices on images of greater than 3 dimensionsprivate JDialogSwapSlicesVolumes.SwapMode
mode
Swap mode, either 3D or 4D.private int
nSlices
Number of slices in mode.private int[][]
sliceRenum
Reordering of slices/volumes.private int
sliceSize
Number of pixels used by a slice/volume, includes colorFactor.private boolean[]
sliceTouched
Slices that have been examined in recursive structure for swapping slices.private int[]
srcExtents
Original extents arrayprivate FileInfoBase[]
srcFileInfos
Original FileInfoBase array.-
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 AlgorithmSwapSlicesVolume(ModelImage destImage, JDialogSwapSlicesVolumes.SwapMode mode, int[][] sliceRenum, ModelImage srcImage)
Import source and destination images into the class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
allSlicesTouched()
private FileInfoBase[]
collectFileInfos(int in, int tDim)
Gets the fileInfos from the specified position.void
finalize()
Prepares this class for destruction.protected int
getColorFactor()
Calculates and returns the color factor based on the srcImage.ModelImage
getSwappedVolume()
Return the images extracted from the source image.private void
importFileInfos(ModelImage destImage, FileInfoBase[] fileIn, int in, int tDim)
Inserts the fileInfos into the specified position.private void
reallocate(ModelImage image)
Reallocate destImage so that fileInfo and buffer equal required lengthvoid
runAlgorithm()
Calculates the final output.private void
swapSlices()
Calculates the final output and stores it in the source image.private boolean
transferIn(int in)
Starts method of file/image transferringprivate boolean
transferIn(FileInfoBase[] fileIn, java.lang.Number[] bufferIn, int in, int tDim)
Transfers the given buffer into the given location.-
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
-
mode
private JDialogSwapSlicesVolumes.SwapMode mode
Swap mode, either 3D or 4D.
-
nSlices
private int nSlices
Number of slices in mode.
-
sliceRenum
private int[][] sliceRenum
Reordering of slices/volumes.
-
sliceSize
private int sliceSize
Number of pixels used by a slice/volume, includes colorFactor.
-
sliceTouched
private boolean[] sliceTouched
Slices that have been examined in recursive structure for swapping slices.
-
extentSrc
private int extentSrc
Internal sorting variables for sorting slices on images of greater than 3 dimensions
-
extentDest
private int extentDest
Internal sorting variables for sorting slices on images of greater than 3 dimensions
-
srcFileInfos
private FileInfoBase[] srcFileInfos
Original FileInfoBase array.
-
srcExtents
private int[] srcExtents
Original extents array
-
-
Constructor Detail
-
AlgorithmSwapSlicesVolume
public AlgorithmSwapSlicesVolume(ModelImage destImage, JDialogSwapSlicesVolumes.SwapMode mode, int[][] sliceRenum, ModelImage srcImage)
Import source and destination images into the class.- Parameters:
destImage
- destination imagesrcImage
- source image (image to extract from)sliceRenum
- list of locations for slices that should be extracted/movedmode
- type of swapping operation
-
-
Method Detail
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalize
in classAlgorithmBase
-
getSwappedVolume
public ModelImage getSwappedVolume()
Return the images extracted from the source image.- Returns:
- The extracted images.
-
runAlgorithm
public void runAlgorithm()
Calculates the final output.- Specified by:
runAlgorithm
in classAlgorithmBase
-
getColorFactor
protected int getColorFactor()
Calculates and returns the color factor based on the srcImage.- Returns:
- DOCUMENT ME!
-
allSlicesTouched
private boolean allSlicesTouched()
-
collectFileInfos
private FileInfoBase[] collectFileInfos(int in, int tDim)
Gets the fileInfos from the specified position.
-
importFileInfos
private void importFileInfos(ModelImage destImage, FileInfoBase[] fileIn, int in, int tDim)
Inserts the fileInfos into the specified position.
-
reallocate
private void reallocate(ModelImage image)
Reallocate destImage so that fileInfo and buffer equal required length- Parameters:
image
- ModelImage
-
swapSlices
private void swapSlices()
Calculates the final output and stores it in the source image.
-
transferIn
private boolean transferIn(int in)
Starts method of file/image transferring- Parameters:
in
- location to import data- Returns:
- whether import was successful
-
transferIn
private boolean transferIn(FileInfoBase[] fileIn, java.lang.Number[] bufferIn, int in, int tDim)
Transfers the given buffer into the given location. Also recursively transfers all the old data to the location(s) where the old data is used.- Parameters:
bufferIn
- relieves the symptoms of arthritisin
- location to import data- Returns:
- whether import was successful
-
-