gov.nih.mipav.model.structures
Class ModelImage

java.lang.Object
  extended by gov.nih.mipav.model.structures.ModelSerialCloneable
      extended by gov.nih.mipav.model.structures.ModelStorageBase
          extended by gov.nih.mipav.model.structures.ModelImage
All Implemented Interfaces:
Serializable, Cloneable

public class ModelImage
extends ModelStorageBase

This class extends the generic buffer class ModelStorageArray and is used to store n-dimensional images and buffer class that supports boolean, byte, short, int, long, float, double, etc. data types. After the buffer is created the minimum and maximum parameters are calculated. ModelImage is a specific buffer to addressing issues relating to images.

Version:
1.0
Author:
Matthew J. McAuliffe Ph.D.
See Also:
Serialized Form

Field Summary
static int IMAGE_A
          Used to indicate that this image object is Image A when two images are displayed in the same frame.
static int IMAGE_B
          Used to indicate that this image object is Image B when two images are displayed in the same frame.
 
Fields inherited from class gov.nih.mipav.model.structures.ModelStorageBase
ARGB, ARGB_FLOAT, ARGB_FLOAT_STRING, ARGB_STRING, ARGB_USHORT, ARGB_USHORT_STRING, BOOLEAN, BOOLEAN_STRING, bufferTypeStr, BYTE, BYTE_STRING, COMPLEX, COMPLEX_STRING, DCOMPLEX, DCOMPLEX_STRING, DOUBLE, DOUBLE_STRING, fileInfo, FLOAT, FLOAT_STRING, INTEGER, INTEGER_STRING, lastMax, lastMin, LINEAR, LONG, LONG_STRING, NEAREST, projectInfo, RW_LOCKED, SHORT, SHORT_STRING, TAYLOR, UBYTE, UBYTE_STRING, UINTEGER, UINTEGER_STRING, UNLOCKED, USHORT, USHORT_STRING, W_LOCKED
 
Constructor Summary
ModelImage(int type, int[] dimExtents, String name)
          Creates a new ModelImage object.
ModelImage(int type, int[] dimExtents, String name, ViewUserInterface _UI)
          Deprecated. DOCUMENT ME!
 
Method Summary
 void addImageDisplayListener(ViewImageUpdateInterface obj)
          Add a listener to this class so that notifyListener can be used to notify all listeners to update the display of the image.
 void addVOIs(VOIVector VOIs)
          adds VOI vector for with new VOIs.
 void anonymize(boolean[] list, boolean doRename)
          Anonymize the image by altering the sensitive data of each slice to something generic.
 void calcMinMax()
          Calculates the min and max values for the image array.
 void changeExtents(int[] dimExtents)
          Changes the image dimensionality or extents.
 void clearMask()
          Sets the entire mask object to false.
 Object clone()
          Copies the image and all data associated with the image (i.e.
 Object clone(String newName)
          Copies the image and all data associated with the image (i.e.
 void copyFileTypeInfo(ModelImage fromImage)
          Deep copies the file type info from the fromImage to the current image object.
 void createMask(int length)
          Creates mask and maskBU of new length.
 void displayAboutInfo(JDialogBase dialog, int z, int t, boolean dicom, boolean xml)
          Displays all information about an image.
 void disposeLocal()
          Unregisters image and disposes of image memory and associated objects.
 void disposeLocal(boolean garbageCollect)
          Unregisters image and disposes of image memory and associated objects.
protected  void finalize()
          Calls disposeLocal of this class to ensure this class nulls the references to global class variables so that memory will be recovered.
 ModelImage generateBinaryImage()
          Forms a solid (without holes) binary image from all VOIs in the image.
 ModelImage generateBinaryImage(boolean XOR, boolean onlyActive)
          Forms a binary image from VOIs.
 ModelImage generateShortImage(int offset)
          Generates a solid (no holes) short image of regions defined by VOIs.
 ModelImage generateShortImage(int offset, boolean XOR, boolean onlyActive)
          Exports a short mask of the VOI[index].
 ModelImage generateUnsignedByteImage(int offset)
          Generates a solid (no holes) unsigned byte image of regions defined by VOIs.
 ModelImage generateUnsignedByteImage(int offset, boolean XOR, boolean onlyActive)
          Exports an unsigned byte mask of the VOI[index].
 BitSet generateVOIMask()
          Generates a BitSet mask of all the VOIs and sets ImageModel mask.
 BitSet generateVOIMask(boolean XOR)
          Generates a BitSet mask of all the VOIs and sets ImageModel mask.
 BitSet generateVOIMask(boolean XOR, boolean onlyActive)
          Generates a BitSet mask of all the VOIs and sets ImageModel mask.
 short[] generateVOIMask(short[] mask, int index)
          Generates a mask of the type short - without XORing VOI contours.
 short[] generateVOIMask(short[] mask, int index, boolean XOR)
          Exports a short mask of the VOI[index].
 ViewJFrameAnimate getAnimateFrame()
          Method that returns the animate frame if it exists else returns null.
 ViewJFrameHistoLUT getHistoLUTFrame()
          Method that returns the HistoLUT frame if it exists else returns null.
 ViewJFrameHistoRGB getHistoRGBFrame()
          Method that returns the HistoRGB frame if it exists else returns null.
 WildMagic.LibFoundation.Mathematics.Vector3f getImageCenter()
          Calculates translation offset for transforming image about the center of the image.
 WildMagic.LibFoundation.Mathematics.Vector3f getImageCentermm(boolean useScanner)
          Calculates translation offset for transforming image about the center of the image in the resolution space.
 String getImageDirectory()
          Returns the directory where the image file is located.
 String getImageFileName()
          Returns the file name of the image.
 Vector<ViewImageUpdateInterface> getImageFrameVector()
          Accessor that returns.
 int getImageModality()
          Returns the type of image.
 String getImageName()
          Accessor that returns the name of the image.
 int getImageOrder()
          For multiple image viewers this indicates order of the image.
 ViewJFrameLightBox getLightBoxFrame()
          Method that returns the lightbox frame if it exists else returns null.
 BitSet getMask()
          Accessor that returns.
 BitSet getMaskBU()
          Accessor that returns.
 TransMatrix getMatrix()
          Accessor that returns transformation matrix.
 MatrixHolder getMatrixHolder()
          DOCUMENT ME!
 int getPackedColor(int iIndex)
          If no LUT or RGB color table is defined, this returns the packed int value for the color at iIndexs for the input ModelImage kImage:
 ViewJFrameImage getParentFrame()
          Returns the parent frame of this image.
 float[] getPlane(WildMagic.LibFoundation.Mathematics.Vector3f topLeft, WildMagic.LibFoundation.Mathematics.Vector3f topRight, WildMagic.LibFoundation.Mathematics.Vector3f botLeft, WildMagic.LibFoundation.Mathematics.Vector3f botRight)
          Extract an arbitrary slice plane from the image using tri-linear interpolation.
 ProvenanceHolder getProvenanceHolder()
           
 ViewJFrameRegistration getRegistrationFrame()
          Method that returns the registration frame if it exists else returns null.
 void getScannerCoordLPS(int x, int y, int z, float[] scannerCoord)
          Takes input x,y,z coordinate and returns that point transformed into the scanner's (DICOM) coordinate system.
 void getScannerCoordRAS(int x, int y, int z, float[] scannerCoord)
          Takes input x,y,z coordinate and returns that point transformed into the RAS coordinate system.
 TalairachTransformInfo getTalairachTransformInfo()
          Accessor that returns the talairach transform information.
 ViewJFrameTriImage getTriImageFrame()
          Method that returns the tri image frame if it exists else returns null.
 ViewUserInterface getUserInterface()
          Deprecated. DOCUMENT ME!
 VOIVector getVOIs()
          Accessor that returns.
 void groupVOIs()
          Forms a single VOI structure from all the VOIs presently loaded in the imageModel.
 void groupVOIs(ViewVOIVector newVOIVector, int[] where, String name)
          Forms a single VOI structure from all the VOIs presently loaded in the imageModel.
 boolean is2DImage()
           
 boolean is3DImage()
           
 boolean isColorImage()
          Accessor that returns whether or not the image is a color image.
static boolean isColorImage(int dataType)
          Accessor that returns whether or not the given data type is a color data type.
 boolean isComplexImage()
          Accessor that returns whether or not the image is a COMPLEX or DCOMPLEX image.
 boolean isDicomImage()
          Accessor that returns whether or not the image is a DICOM image.
 boolean isMincImage()
          Accessor that returns whether or not the image is a MINC image.
 void make2UnitsOfMeasureIdentical(int newUnitDim, int oldUnitDim)
           
 void makeUnitsOfMeasureIdentical()
          Make all spatial units the same, all time units the same, and all frequency units the same
 void notifyImageDisplayListeners_notTriFrame()
          Used to notify all frames except the triImage frames that display this image model need to be updated.
 void notifyImageDisplayListeners()
          Used to notify all frames that display this image model need to be updated.
 void notifyImageDisplayListeners(boolean forceShow, int alphaBlend, ModelRGB RGBT)
          Used to notify all frames that display this image model need to be updated for RGB (color) images.
 void notifyImageDisplayListeners(ModelLUT LUT, boolean forceShow)
          Used to notify all frames that display this image model need to be updated.
 void notifyImageDisplayListeners(ModelLUT LUT, boolean forceShow, int alphaBlend, int interpMode)
          Used to notify all listeners that the image is to be redisplayed.
 void notifyImageExtentsListeners()
          Used to notify all frames that display this image model that this image's extents have changed.
 void print()
          Prints basic image parameters to the System.out.
 TransMatrix readTransformMatrix(boolean composite)
          Read matrix from a file.
 void reallocate(int type)
          Reallocates ModelImage with new type and all image data lost.
 void registerVOI(VOI voi)
          Method that register an VOI to this image.
 void removeImageDisplayListener(ViewImageUpdateInterface obj)
          Remove a listener from the class.
 void resetVOIs()
          Resets VOI vector for new VOIs.
static void saveImage(ModelImage kImage)
          Save the gradient magnitude image into the MIPAV default dir.
 boolean saveImage(String directory, String fileName, int fileType, boolean isActive)
          Save the image to a file.
 void saveTransformMatrix(String fileName, TransMatrix matrix)
          Save the images transformation matrix in the working directory with the supplied fileName.
 void saveTransformMatrix(TransMatrix matrix)
          Saves the transformation matrix to file.
 void setExtents(int[] dims)
          Sets the dimExtents for this structure.
 void setImageDirectory(String dir)
          Sets the image directory.
 void setImageModality(int type)
          Sets the image type (MRI, CT, ...).
 void setImageName(String name)
          Accessor that sets the name of the image.
 void setImageName(String name, boolean updateFileName)
          Accessor that sets the name of the image.
 void setImageNamePrivate(String name)
          Accessor that sets the name of the image.
 void setImageOrder(int order)
          For multiple image viewers this indicates order of the image.
 void setImageOrientation(int orient)
          Sets the image orientation (sagittal, axial, ...).
 void setMask(BitSet _mask)
          Sets the mask which indicate which pixels/voxels to process.
 void setMaskBU(BitSet mask)
          Sets the mask which indicate which pixels/voxels to process.
 void setMatrix(TransMatrix matrix)
          Accessor that adds a matrix to the matrix holder.
 void setSlice(int slice)
          Sets the slice in all frames displaying this image.
 void setTalairachTransformInfo(TalairachTransformInfo tal)
          Accessor that sets the talairach transform information.
 void setTimeSlice(int tSlice)
          Sets the time slice in all frames displaying this image.
 void setUserInterface(ViewUserInterface _UI)
          Sets user interface.
 void setVOIs(VOIVector VOIs)
          Sets VOI vector for with new VOIs.
 String toString()
          Gives a readable representation of the ModelImage, including file name and extents.
 void ungroupVOIs()
          Forms separate VOIs from all the VOI structures presently loaded in the imageModel.
 void unregisterAllVOIs()
          Unregisters all VOIs from this image model.
 void unRegisterImage()
          Unregisters the image from the user interface.
 void unregisterVOI(VOI voi)
          Method that unregisters an VOI.
 void updateFileName(String newImageName)
          Give the image a new image name, updates frame (if not null), and file infos.
 void updateImageOrigin(TransMatrix xfrm)
          Updates the images origin.
 
Methods inherited from class gov.nih.mipav.model.structures.ModelStorageBase
addSurfaceMask, allocateData, calcAvgIntenStdDev, calcMinMaxMag, calcMinMaxNonZero, computeDataSize, construct, convertToFloat, export, export, exportComplexData, exportComplexSliceXY, exportData, exportData, exportData, exportData, exportData, exportData, exportData, exportData, exportData, exportData, exportDataNoLock, exportDataNoLock, exportDataNoLock, exportDataNoLock, exportDataNoLock, exportDataNoLock, exportDataNoLock, exportDataNoLock, exportDComplexData, exportDiagonal, exportDMagData, exportMagData, exportRGBData, exportRGBData, exportRGBData, exportRGBData, exportRGBDataNoLock, exportSliceXY, exportSliceXY, exportSliceXY, exportSliceXY, exportSliceXY, exportSliceXY, get, get, get, get, get, getAvgInten, getAvgIntenB, getAvgIntenG, getAvgIntenR, getAxisOrientation, getBiLinear, getBoolean, getBoolean, getBoolean, getBoolean, getBoolean, getBufferTypeStr, getByte, getByte, getByte, getByte, getByte, getByteBiLinear, getByteTriLinear, getC, getConvolve, getDouble, getDouble, getDouble, getDouble, getDouble, getDoubleBiLinear, getDoubleTriLinear, getExtents, getExtents, getFileInfo, getFileInfo, getFilterType, getFloat, getFloat, getFloat, getFloat, getFloat, getFloatBiLinear, getFloatC, getFloatC, getFloatC, getFloatTriLinear, getFloatTriLinearBounds, getFloatTriLinearBounds, getFreq1, getFreq2, getFreqU, getFreqV, getHaveWindowed, getHeight, getImage25D, getImageOrientation, getInt, getInt, getInt, getInt, getInt, getIntBiLinear, getIntTriLinear, getLockStatus, getLogMagDisplay, getLong, getLong, getLong, getLong, getLong, getLongBiLinear, getLongTriLinear, getMax, getMaxB, getMaxG, getMaxR, getMin, getMinB, getMinG, getMinR, getNDims, getNoLogMax, getNoLogMin, getNoLogMinNonZero, getNonZeroMax, getNonZeroMaxB, getNonZeroMaxG, getNonZeroMaxR, getNonZeroMin, getNonZeroMinB, getNonZeroMinG, getNonZeroMinR, getNumPixels, getOrigin, getOrigin, getOriginalButterworthOrder, getOriginalCropCheckbox, getOriginalDoCrop, getOriginalEnd, getOriginalExtents, getOriginalFilterConstruction, getOriginalKernelDimension, getOriginalMaximum, getOriginalMinimum, getOriginalStart, getProjectInfo, getRadiologicalView, getResolutions, getResolutions, getShort, getShort, getShort, getShort, getShort, getShortBiLinear, getShortTriLinear, getSigmaU, getSigmaV, getSize, getSliceSize, getSmallestMagnitudeNegative, getSmallestMagnitudeNegativeB, getSmallestMagnitudeNegativeG, getSmallestMagnitudeNegativeR, getSmallestMagnitudePositive, getSmallestMagnitudePositiveB, getSmallestMagnitudePositiveG, getSmallestMagnitudePositiveR, getStdDeviation, getStdDeviationB, getStdDeviationG, getStdDeviationR, getSumPixelInten, getSumPixelIntenB, getSumPixelIntenG, getSumPixelIntenR, getSurfaceMask, getSurfaceMaskColor, getTheta, getTriLinear, getType, getTypeMax, getTypeMin, getTypeString, getUByte, getUByte, getUByte, getUByte, getUByteBiLinear, getUByteTriLinear, getUInt, getUInt, getUInt, getUInt, getUInt, getUIntBiLinear, getUIntTriLinear, getUnequalDim, getUnitsOfMeasure, getUnitsOfMeasure, getUnitsOfMeasure, getUShort, getUShort, getUShort, getUShort, getUShort, getUShortBiLinear, getUShortTriLinear, getVolumeIterationFactors, getWidth, importComplexData, importData, importData, importData, importData, importData, importData, importData, importData, importData, importDComplexData, importRGBData, importUData, importUData, importUData, reallocate, reallocate, recomputeDataSize, releaseLock, removeSurfaceMask, removeSurfaceMasks, restoreSurfaceMasks, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, setAll, setAll, setAll, setAll, setAll, setAllUByte, setAllUShort, setC, setC, setC, setC, setC, setConvolve, setFileInfo, setFileInfo, setFilterType, setFreq1, setFreq2, setFreqU, setFreqV, setHaveWindowed, setImage25D, setLock, setLock, setLogMagDisplay, setMax, setMin, setOriginalButterworthOrder, setOriginalCropCheckbox, setOriginalDoCrop, setOriginalEnd, setOriginalExtents, setOriginalFilterConstruction, setOriginalKernelDimension, setOriginalMaximum, setOriginalMinimum, setOriginalStart, setProjectInfo, setRadiologicalView, setResolutions, setShort, setShort, setSigmaU, setSigmaV, setTheta, setType, setUByte, setUByte, setUByte, setUByte, setUByte, setUInt, setUInt, setUInt, setUInt, setUInt, setUnequalDim, setUShort, setUShort, setUShort, setUShort, setUShort
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IMAGE_A

public static final int IMAGE_A
Used to indicate that this image object is Image A when two images are displayed in the same frame. See also imageOrder in this class.

See Also:
Constant Field Values

IMAGE_B

public static final int IMAGE_B
Used to indicate that this image object is Image B when two images are displayed in the same frame. See also imageOrder in this class.

See Also:
Constant Field Values
Constructor Detail

ModelImage

public ModelImage(int type,
                  int[] dimExtents,
                  String name)
Creates a new ModelImage object.

Parameters:
type - indicates type of buffer(ie. boolean, byte ...)
dimExtents - array indicating image extent in each dimension.
name - name of the image.

ModelImage

public ModelImage(int type,
                  int[] dimExtents,
                  String name,
                  ViewUserInterface _UI)
Deprecated. DOCUMENT ME!

Creates a new ModelImage object.

Parameters:
type - indicates type of buffer(ie. boolean, byte ...)
dimExtents - DOCUMENT ME!
name - DOCUMENT ME!
_UI - DOCUMENT ME!
Method Detail

isColorImage

public static boolean isColorImage(int dataType)
Accessor that returns whether or not the given data type is a color data type.

Parameters:
dataType - The data type from a ModelImage to determine if it is of one of the three types of color images supported.
Returns:
true if color, false if not color.

addImageDisplayListener

public void addImageDisplayListener(ViewImageUpdateInterface obj)
Add a listener to this class so that notifyListener can be used to notify all listeners to update the display of the image.

Parameters:
obj - "object' to be added to the list

addVOIs

public void addVOIs(VOIVector VOIs)
adds VOI vector for with new VOIs.

Parameters:
VOIs - VOIs to add to image

anonymize

public void anonymize(boolean[] list,
                      boolean doRename)
Anonymize the image by altering the sensitive data of each slice to something generic.

See Also:
FileInfoDicom.anonymize(boolean[])

calcMinMax

public void calcMinMax()
Calculates the min and max values for the image array.

Overrides:
calcMinMax in class ModelStorageBase

setExtents

public void setExtents(int[] dims)
Description copied from class: ModelStorageBase
Sets the dimExtents for this structure.

Overrides:
setExtents in class ModelStorageBase
Parameters:
dims - new dimensions for image

changeExtents

public void changeExtents(int[] dimExtents)
Changes the image dimensionality or extents.

Parameters:
dimExtents - new dimensions for mask, maskBU, and fileInfo

clearMask

public void clearMask()
Sets the entire mask object to false.


clone

public Object clone()
Copies the image and all data associated with the image (i.e. VOIs). Invokes the clone(String newName) method with newName set to null;

Overrides:
clone in class ModelStorageBase
Returns:
the new copy of the image

clone

public Object clone(String newName)
Copies the image and all data associated with the image (i.e. VOIs). Sets the name of the new image to newName.

Parameters:
newName - String containing the name for the cloned image. If null then 'this' image name is appended with "_clone".
Returns:
the new copy of the image

copyFileTypeInfo

public void copyFileTypeInfo(ModelImage fromImage)
Deep copies the file type info from the fromImage to the current image object.

Parameters:
fromImage - image from which to copy file type info

createMask

public void createMask(int length)
Creates mask and maskBU of new length.

Parameters:
length - int

displayAboutInfo

public void displayAboutInfo(JDialogBase dialog,
                             int z,
                             int t,
                             boolean dicom,
                             boolean xml)
Displays all information about an image.

Parameters:
dialog - dialog object where image information is to be displayed
z - index of file information -- each image slice can have separate file information (i.e. like DICOM).
t - t slice of the fileinfo to display.
dicom - boolean indicating if this is a DICOM file
xml - boolean indicating if this is a XML file

disposeLocal

public void disposeLocal()
Unregisters image and disposes of image memory and associated objects.

Overrides:
disposeLocal in class ModelStorageBase

disposeLocal

public void disposeLocal(boolean garbageCollect)
Unregisters image and disposes of image memory and associated objects.

Parameters:
garbageCollect - boolean - A flag indicating whether or not garbage collection is invoked.

generateBinaryImage

public ModelImage generateBinaryImage()
Forms a solid (without holes) binary image from all VOIs in the image.

Returns:
image image of boolean type with VOI objects = 1 and background = 0

generateBinaryImage

public ModelImage generateBinaryImage(boolean XOR,
                                      boolean onlyActive)
Forms a binary image from VOIs.

Parameters:
XOR - indicates that nested VOI contours will be exclusive ORed with other contours of the VOI
onlyActive - Only mask regions that are active (i.e. selected VOIs)
Returns:
image image of boolean type with VOI objects = 1 and background = 0

generateShortImage

public ModelImage generateShortImage(int offset)
Generates a solid (no holes) short image of regions defined by VOIs.

Parameters:
offset - offset value added to ID - normally 1 used to label the masked regions
Returns:
ModelImage mask image of type short

generateShortImage

public ModelImage generateShortImage(int offset,
                                     boolean XOR,
                                     boolean onlyActive)
Exports a short mask of the VOI[index]. VOI[0] = 1 ... VOI[n] = n

Parameters:
offset - offset value added to ID - normally 1. ID is used to label the masked regions
XOR - indicates that nested VOI contours will be exclusive ORed with other contours of the VOI
onlyActive - Only mask regions that are active (i.e. selected VOIs)
Returns:
ModelImage mask image of type short

generateUnsignedByteImage

public ModelImage generateUnsignedByteImage(int offset)
Generates a solid (no holes) unsigned byte image of regions defined by VOIs.

Parameters:
offset - offset value added to ID - normally 1. ID is used to label the masked regions
Returns:
ModelImage mask image of type unsigned byte

generateUnsignedByteImage

public ModelImage generateUnsignedByteImage(int offset,
                                            boolean XOR,
                                            boolean onlyActive)
Exports an unsigned byte mask of the VOI[index]. VOI[0] = 1 ... VOI[n] = n

Parameters:
offset - offset value added to ID - normally 1. ID is used to label the masked regions
XOR - indicates that nested VOI contours will be exclusive ORed with other contours of the VOI
onlyActive - Only mask regions that are active (i.e. selected VOIs)
Returns:
ModelImage mask image of type unsigned byte

generateVOIMask

public BitSet generateVOIMask()
Generates a BitSet mask of all the VOIs and sets ImageModel mask.

Returns:
binary mask of all VOIs returned as a BitSet object

generateVOIMask

public BitSet generateVOIMask(boolean XOR)
Generates a BitSet mask of all the VOIs and sets ImageModel mask.

Parameters:
XOR - indicates that nested VOI contours will be exclusive ORed with other contours of the VOI
Returns:
binary mask of all VOIs returned as a BitSet object

generateVOIMask

public short[] generateVOIMask(short[] mask,
                               int index)
Generates a mask of the type short - without XORing VOI contours.

Parameters:
mask - mask of VOI of type short
index - indicates a specific VOI used to create the mask
Returns:
mask short mask of the VOI

generateVOIMask

public BitSet generateVOIMask(boolean XOR,
                              boolean onlyActive)
Generates a BitSet mask of all the VOIs and sets ImageModel mask.

Parameters:
XOR - indicates that nested VOI contours will be exclusive ORed with other contours of the VOI
onlyActive - Only mask regions that are active (i.e. selected )
Returns:
binary mask of all VOIs returned as a BitSet object

generateVOIMask

public short[] generateVOIMask(short[] mask,
                               int index,
                               boolean XOR)
Exports a short mask of the VOI[index].

Parameters:
mask - mask of VOI of type short
index - indicates a specific VOI used to create the mask
XOR - indicates that nested VOI contours will be exclusive ORed with other contours of the VOI
Returns:
mask short mask of the VOI

getAnimateFrame

public ViewJFrameAnimate getAnimateFrame()
Method that returns the animate frame if it exists else returns null.

Returns:
animate frame

getHistoLUTFrame

public ViewJFrameHistoLUT getHistoLUTFrame()
Method that returns the HistoLUT frame if it exists else returns null.

Returns:
histoLUTFrame

getHistoRGBFrame

public ViewJFrameHistoRGB getHistoRGBFrame()
Method that returns the HistoRGB frame if it exists else returns null.

Returns:
histoRGBFrame

getImageCenter

public WildMagic.LibFoundation.Mathematics.Vector3f getImageCenter()
Calculates translation offset for transforming image about the center of the image.

Returns:
Center of image in pixels.

getImageCentermm

public WildMagic.LibFoundation.Mathematics.Vector3f getImageCentermm(boolean useScanner)
Calculates translation offset for transforming image about the center of the image in the resolution space.

Parameters:
useScanner - DOCUMENT ME!
Returns:
Center of the image in millimeters (or other physical dimension).

getImageDirectory

public String getImageDirectory()
Returns the directory where the image file is located.

Returns:
The directory where the image file resides.

getImageFileName

public String getImageFileName()
Returns the file name of the image.

Returns:
the String that represents the filename (as stored in the fileinfo)

getImageFrameVector

public Vector<ViewImageUpdateInterface> getImageFrameVector()
Accessor that returns.

Returns:
image frame vector

getImageModality

public int getImageModality()
Returns the type of image.

Returns:
type of image (MRI, CT, ...)

getImageName

public String getImageName()
Accessor that returns the name of the image.

Returns:
the String representing the filename if DICOM image then ImageName is the patients' name else, imageName is the file name (see the contructor for more)

getImageOrder

public int getImageOrder()
For multiple image viewers this indicates order of the image.

Returns:
integer indicating image order

getLightBoxFrame

public ViewJFrameLightBox getLightBoxFrame()
Method that returns the lightbox frame if it exists else returns null.

Returns:
lightbox frame

getMask

public BitSet getMask()
Accessor that returns.

Returns:
mask that indicates which pixels/voxels will be processed.

getMaskBU

public BitSet getMaskBU()
Accessor that returns.

Returns:
a bakeup of mask that indicates which pixels/voxels will be processed.

getMatrix

public TransMatrix getMatrix()
Accessor that returns transformation matrix.

Returns:
transformation matrix

getMatrixHolder

public MatrixHolder getMatrixHolder()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getProvenanceHolder

public ProvenanceHolder getProvenanceHolder()

getPackedColor

public final int getPackedColor(int iIndex)
If no LUT or RGB color table is defined, this returns the packed int value for the color at iIndexs for the input ModelImage kImage:

Parameters:
iIndex - pixel index
Returns:
RGB color value.

getParentFrame

public ViewJFrameImage getParentFrame()
Returns the parent frame of this image. Should always exist.

Returns:
The parent frame of this image.

getPlane

public final float[] getPlane(WildMagic.LibFoundation.Mathematics.Vector3f topLeft,
                              WildMagic.LibFoundation.Mathematics.Vector3f topRight,
                              WildMagic.LibFoundation.Mathematics.Vector3f botLeft,
                              WildMagic.LibFoundation.Mathematics.Vector3f botRight)
Extract an arbitrary slice plane from the image using tri-linear interpolation. Performs bounds checking and returns a full plane of the image (up to the slicesize * 2).

Parameters:
topLeft - the top left point of the plane; must be in the image coord system.
topRight - the top right point of the plane; must be in the image coord system.
botLeft - the bottom left point of the plane; must be in the image coord system.
botRight - the bottom right point of the plane; must be in the image coord system. not really used..
Returns:
a float buffer containing the extracted plane (size == image.getSliceSize() 2).

getRegistrationFrame

public ViewJFrameRegistration getRegistrationFrame()
Method that returns the registration frame if it exists else returns null.

Returns:
registration frame

getScannerCoordLPS

public void getScannerCoordLPS(int x,
                               int y,
                               int z,
                               float[] scannerCoord)
Takes input x,y,z coordinate and returns that point transformed into the scanner's (DICOM) coordinate system. L = Left - first axis is positive to the left P = Posterior - second axis is positive to the posterior S = Superior - third axis is positive to the superior

Parameters:
x - Absolute x value in slice.
y - Absolute y value in slice.
z - Absolute z value in slice.
scannerCoord - the point transformed into the scanner's (DICOM) coordinate system.

getScannerCoordRAS

public void getScannerCoordRAS(int x,
                               int y,
                               int z,
                               float[] scannerCoord)
Takes input x,y,z coordinate and returns that point transformed into the RAS coordinate system. R = Right - first axis is positive to the right A = Anterior - second axis is positive to the anterior S = Superior - third axis is positive to the superior

Parameters:
x - Absolute x value in slice.
y - Absolute y value in slice.
z - Absolute z value in slice.
scannerCoord - the point transformed into the scanner's (DICOM) coordinate system.

getTalairachTransformInfo

public TalairachTransformInfo getTalairachTransformInfo()
Accessor that returns the talairach transform information.

Returns:
TalairachTransformInfo talairach info

getTriImageFrame

public ViewJFrameTriImage getTriImageFrame()
Method that returns the tri image frame if it exists else returns null.

Returns:
tri image frame

getUserInterface

public ViewUserInterface getUserInterface()
Deprecated. DOCUMENT ME!

Returns the reference to the user interface.

Returns:
the reference to the user interface.

getVOIs

public VOIVector getVOIs()
Accessor that returns.

Returns:
VOI vector

groupVOIs

public void groupVOIs()
Forms a single VOI structure from all the VOIs presently loaded in the imageModel.


groupVOIs

public void groupVOIs(ViewVOIVector newVOIVector,
                      int[] where,
                      String name)
Forms a single VOI structure from all the VOIs presently loaded in the imageModel.

Parameters:
newVOIVector - a new ViewVOIVector to hold the grouped VOIs
where - int array telling where to sort
name - the name of the VOI

isColorImage

public boolean isColorImage()
Accessor that returns whether or not the image is a color image.

Returns:
true if color, false if not color.

is2DImage

public boolean is2DImage()

is3DImage

public boolean is3DImage()

isComplexImage

public boolean isComplexImage()
Accessor that returns whether or not the image is a COMPLEX or DCOMPLEX image.

Returns:
true if complex, false if not complex.

isDicomImage

public boolean isDicomImage()
Accessor that returns whether or not the image is a DICOM image.

Returns:
true if DICOM, false if not DICOM.

isMincImage

public boolean isMincImage()
Accessor that returns whether or not the image is a MINC image.

Returns:
true if MINC, false if not MINC.

notifyImageDisplayListeners

public void notifyImageDisplayListeners()
Used to notify all frames that display this image model need to be updated.


notifyImageDisplayListeners_notTriFrame

public void notifyImageDisplayListeners_notTriFrame()
Used to notify all frames except the triImage frames that display this image model need to be updated.


notifyImageDisplayListeners

public void notifyImageDisplayListeners(ModelLUT LUT,
                                        boolean forceShow)
Used to notify all frames that display this image model need to be updated.

Parameters:
LUT - new LUT used to display image (can be null);
forceShow - force the display method(s) to reload image data and display image slower but needed if image model changes.

notifyImageDisplayListeners

public void notifyImageDisplayListeners(boolean forceShow,
                                        int alphaBlend,
                                        ModelRGB RGBT)
Used to notify all frames that display this image model need to be updated for RGB (color) images.

Parameters:
forceShow - force the display method(s) to reload image data and display image slower but needed if image model changes.
alphaBlend - the amount to blend between two images displayed in the same frame.
RGBT - ModelRGB

notifyImageDisplayListeners

public void notifyImageDisplayListeners(ModelLUT LUT,
                                        boolean forceShow,
                                        int alphaBlend,
                                        int interpMode)
Used to notify all listeners that the image is to be redisplayed.

Parameters:
LUT - new LUT used to display image (can be null);
forceShow - force the display method(s) to reload image data and display image slower but needed if image model changes.
alphaBlend - indicates the amount of blending between two images (image 1's blending value) 1.0 - all of image 1; 0.5 - half image 1 and half image 2
interpMode - image interpolation method (Nearest or Smooth)

notifyImageExtentsListeners

public void notifyImageExtentsListeners()
Used to notify all frames that display this image model that this image's extents have changed. The display of this image may also need to be updated.


print

public void print()
Prints basic image parameters to the System.out.


readTransformMatrix

public TransMatrix readTransformMatrix(boolean composite)
Read matrix from a file.

Parameters:
composite - if true make a composite matrix of the by multipling this matrix with the one to be read from the file. If false replace this object matrix with a new matrix read from the file.
Returns:
DOCUMENT ME!

reallocate

public void reallocate(int type)
Reallocates ModelImage with new type and all image data lost.

Overrides:
reallocate in class ModelStorageBase
Parameters:
type - new type of image that is to be allocated

registerVOI

public void registerVOI(VOI voi)
Method that register an VOI to this image.

Parameters:
voi - Region of interest (VOI) to be registered with the image model

removeImageDisplayListener

public void removeImageDisplayListener(ViewImageUpdateInterface obj)
Remove a listener from the class.

Parameters:
obj - "object' to be added to the list

resetVOIs

public void resetVOIs()
Resets VOI vector for new VOIs.


saveImage

public boolean saveImage(String directory,
                         String fileName,
                         int fileType,
                         boolean isActive)
Save the image to a file. The file type the image is to be save in is passed into this method.

Parameters:
directory - location where the image is to stored.
fileName - the name of the file (without the extension).
fileType - The format of the image file (i.e. Analyze, XML, DICOM etc.)
isActive - Whether saving is being done in a separate thread
Returns:
true if succeeded in saving.

saveTransformMatrix

public void saveTransformMatrix(TransMatrix matrix)
Saves the transformation matrix to file.

Parameters:
matrix - DOCUMENT ME!

saveImage

public static void saveImage(ModelImage kImage)
Save the gradient magnitude image into the MIPAV default dir.

Parameters:
gmImage - ModelImage gradient magnitude image to save

saveTransformMatrix

public void saveTransformMatrix(String fileName,
                                TransMatrix matrix)
Save the images transformation matrix in the working directory with the supplied fileName.

Parameters:
fileName - - fileName of transformation matrix
matrix - DOCUMENT ME!

setImageDirectory

public void setImageDirectory(String dir)
Sets the image directory.

Parameters:
dir - string representing the directory

setImageModality

public void setImageModality(int type)
Sets the image type (MRI, CT, ...).

Parameters:
type - integer representing the type

setImageName

public void setImageName(String name)
Accessor that sets the name of the image. This method also updates the file name in the fileInfos to match the new image name.

Parameters:
name - the String representing the filename

setImageName

public void setImageName(String name,
                         boolean updateFileName)
Accessor that sets the name of the image.

Parameters:
name - the String representing the filename
updateFileName - whether to update the file name stored in the image's fileInfos to match the new image name

setImageNamePrivate

public void setImageNamePrivate(String name)
Accessor that sets the name of the image. NOT TO BE USED BY ANYONE EXCEPT ViewUserInterface.registerImage. Use setImageName instead!!!

Parameters:
name - the String representing the filename

setImageOrder

public void setImageOrder(int order)
For multiple image viewers this indicates order of the image.

Parameters:
order - integer indicating image order

setImageOrientation

public void setImageOrientation(int orient)
Sets the image orientation (sagittal, axial, ...).

Parameters:
orient - integer representing the orientation

setMask

public void setMask(BitSet _mask)
Sets the mask which indicate which pixels/voxels to process.

Parameters:
_mask - mask in the form of a BitSet, 1 indicates pixel should be processed 0 indicates pixel should not be processed

setMaskBU

public void setMaskBU(BitSet mask)
Sets the mask which indicate which pixels/voxels to process.

Parameters:
mask - mask in the form of a BitSet, 1 indicates pixel should be processed 0 indicates pixel should not be processed

setMatrix

public void setMatrix(TransMatrix matrix)
Accessor that adds a matrix to the matrix holder.

Parameters:
matrix - transformation matrix structure.

setSlice

public void setSlice(int slice)
Sets the slice in all frames displaying this image.

Parameters:
slice - Indicates the z dim. slice that should be displayed.

setTalairachTransformInfo

public void setTalairachTransformInfo(TalairachTransformInfo tal)
Accessor that sets the talairach transform information.

Parameters:
tal - TalairachTransformInfo talairach info

setTimeSlice

public void setTimeSlice(int tSlice)
Sets the time slice in all frames displaying this image.

Parameters:
tSlice - Indicates the t (time) dim. slice that should be displayed.

setUserInterface

public void setUserInterface(ViewUserInterface _UI)
Sets user interface.

Parameters:
_UI - reference to user interface

setVOIs

public void setVOIs(VOIVector VOIs)
Sets VOI vector for with new VOIs.

Parameters:
VOIs - VOIs to image VOIs

toString

public String toString()
Gives a readable representation of the ModelImage, including file name and extents.

Overrides:
toString in class Object
Returns:
the string representation

ungroupVOIs

public void ungroupVOIs()
Forms separate VOIs from all the VOI structures presently loaded in the imageModel.


unregisterAllVOIs

public void unregisterAllVOIs()
Unregisters all VOIs from this image model.


unRegisterImage

public void unRegisterImage()
Unregisters the image from the user interface.


unregisterVOI

public void unregisterVOI(VOI voi)
Method that unregisters an VOI.

Parameters:
voi - Volume of interest (VOI) to be removed from the image model

updateFileName

public void updateFileName(String newImageName)
Give the image a new image name, updates frame (if not null), and file infos.

Parameters:
newImageName - The new name for the image

updateImageOrigin

public void updateImageOrigin(TransMatrix xfrm)
Updates the images origin.

Parameters:
xfrm - the transformation maxtrix used to transform the origin

makeUnitsOfMeasureIdentical

public void makeUnitsOfMeasureIdentical()
Make all spatial units the same, all time units the same, and all frequency units the same


make2UnitsOfMeasureIdentical

public void make2UnitsOfMeasureIdentical(int newUnitDim,
                                         int oldUnitDim)
Parameters:
newUnitDim -
oldUnitDim - dimension which will have unit of measure converted to unit of measure of dimension newUnitDim and will have the resolution correspondingly converted.

finalize

protected void finalize()
                 throws Throwable
Calls disposeLocal of this class to ensure this class nulls the references to global class variables so that memory will be recovered.

Overrides:
finalize in class ModelStorageBase
Throws:
Throwable - Throws an error if there is a problem with the finalization of this object.