Package gov.nih.mipav.model.structures
Class ModelImage
- java.lang.Object
-
- gov.nih.mipav.model.structures.ModelSerialCloneable
-
- gov.nih.mipav.model.structures.ModelStorageBase
-
- gov.nih.mipav.model.structures.ModelImage
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class gov.nih.mipav.model.structures.ModelStorageBase
ModelStorageBase.DataType
-
-
Field Summary
Fields Modifier and Type Field Description private DTIParameters
dtiParameters
Reference to DWI bvalue and gradient information.private java.util.Vector<ViewImageUpdateInterface>
frameList
List of frames where this image is displayed.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.private java.lang.String
imageName
ImageName is patient's name when using DICOM images.private java.lang.String[]
imageNameArray
If imageNameArray is not null, then a different image name will appear on every sliceprivate int
imageOrder
Indicates the image order when two images are displayed in the same frame.private java.util.BitSet
mask
Mask is a binary object that is true interior to a VOI and false otherwise used in algorithms to process only on VOIs if indicated by the user.private java.util.BitSet
maskBU
Backup of mask for undoing.private MatrixHolder
matrixHolder
Holds all of the images associated matrices.private ProvenanceHolder
provenanceHolder
Holds the data provenance (image history) The transient keyword is used to indicate that the provenanceHolder should not be cloned when the image is cloned.private static long
serialVersionUID
Use serialVersionUID for interoperability.private TalairachTransformInfo
talairach
Reference to talairach transform information.private ViewUserInterface
UI
The user interface has a vector of all image models loaded into MIPAV.private boolean
useMask
private VOIVector
voiVector
List of VOIs that are displayed with this image.-
Fields inherited from class gov.nih.mipav.model.structures.ModelStorageBase
ARGB, ARGB_FLOAT, ARGB_FLOAT_STRING, ARGB_STRING, ARGB_UINTEGER, ARGB_UINTEGER_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, logMagDisp, LONG, LONG_STRING, NEAREST, RW_LOCKED, SHORT, SHORT_STRING, TAYLOR, UBYTE, UBYTE_STRING, UINTEGER, UINTEGER_STRING, UNLOCKED, USHORT, USHORT_STRING, W_LOCKED
-
-
Constructor Summary
Constructors Constructor Description ModelImage(int type, int[] dimExtents, java.lang.String name)
Creates a new ModelImage object, registering it to the default user interface.ModelImage(int type, int[] dimExtents, java.lang.String name, ViewUserInterface _UI)
Deprecated.Only one ViewUserInterface should be instantiated for an instance of MIPAV running, so _UI should be ViewUserInterface.getReference()ModelImage(ModelSimpleImage simpleImage, java.lang.String name)
Creates a new ModelImage object based on an existing ModelSimpleImage, only exists as a FLOAT datatype.ModelImage(ModelStorageBase.DataType type, int[] dimExtents, java.lang.String name)
Creates a new ModelImage object, registering it to the default user interface.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description 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
anonymize(boolean[] list, boolean doRename, boolean removeValue)
New version of anonymize that allows you to replace the original tag value with a blank string or zero depending on the data type.void
anonymizePublicSequenceTags(FileDicomKey[] keys, java.util.Vector<FileDicomSQItem> seqs, boolean removeValue)
Method to anonymize public tags not in the DICOM Supplement 55 that may appear in sequence tags.void
anonymizePublicTags(FileDicomKey[] keys, boolean removeValue)
Method to anonymize public tags that do not appear in the DICOM Supplement 55.void
anonymizeSequenceTags(boolean[] list, java.util.Vector<FileDicomSQItem> seqs, boolean removeValue)
Method to anonymize the tags found in the DICOM supplement 55 that may appear in sequence tags.private int
calcAxisOrientation(int[] newOrient, int[] axisOrder, boolean[] axisFlip)
Calculate the new image AxisOrientation, based on re-ordering the axes using axisOrder and axisFlip.void
calcMinMax()
Calculates the min and max values for the image array.private void
calcStartLocations(float[] newLoc, int[] axisOrder, boolean[] axisFlip)
Calculates the new start locations based on image orientation.void
changeExtents(int[] dimExtents)
Changes the image dimensionality or extents.void
clearMask()
Sets the entire mask object to false.java.lang.Object
clone()
Copies the image and all data associated with the image (i.e.java.lang.Object
clone(java.lang.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.private void
disposeThisImage()
Disposes of image memory and LUT Frame.ModelImage
export(int[] axisOrderOut, boolean[] axisFlipOut, boolean bClone, ViewJProgressBar progressBar, int startValue, int finalValue)
Exports data based on the mapping the current ModelImage to a new ModelImage oriented based on the axisOrder and axisFlip arrays.void
exportDataUseMask(int start, int length, boolean rescale, byte[] values)
Export data into values array.void
exportDataUseMask(int start, int length, float[] values)
Export data into values array.void
exportDiagonal(int tSlice, int slice, int[] extents, WildMagic.LibFoundation.Mathematics.Vector3f[] verts, float[] values, boolean bInterpolate, boolean bUseMask, java.util.Vector<java.util.BitSet> surfaceMask, boolean[] surfaceValues)
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.private void
fixFileTypeInfo(ModelImage image)
Fixes file information to resultant image structure.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].java.util.BitSet
generateVOIMask()
Generates a BitSet mask of all the VOIs and sets ImageModel mask.java.util.BitSet
generateVOIMask(boolean XOR)
Generates a BitSet mask of all the VOIs and sets ImageModel mask.java.util.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.static double
getConversionFactor(int newUnit, int oldUnit)
DTIParameters
getDTIParameters()
JFrameHistogram
getHistogramFrame()
Method that returns the Histogram frame if it exists else returns null.ViewJFrameHistoLUT
getHistoLUTFrame()
Deprecated.ViewJFrameHistoRGB
getHistoRGBFrame()
Deprecated.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.java.lang.String
getImageDirectory()
Returns the directory where the image file is located.java.lang.String
getImageFileName()
Returns the file name of the image.java.util.Vector<ViewImageUpdateInterface>
getImageFrameVector()
Accessor that returns.int
getImageModality()
Returns the type of image.java.lang.String
getImageName()
Accessor that returns the name of the image.java.lang.String[]
getImageNameArray()
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.java.util.BitSet
getMask()
Accessor that returns.java.util.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)
Deprecated.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)
Deprecated.see MipavCoordinateSystems.fileToScannervoid
getScannerCoordRAS(int x, int y, int z, float[] scannerCoord)
Deprecated.see MipavCoordinateSystems.fileToScannerTalairachTransformInfo
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.VOIVector
getVOIsCopy()
void
groupVOIs()
Forms a single VOI structure from all the active VOIs presently loaded in the imageModel.boolean
is2DImage()
boolean
is3DImage()
boolean
is4DImage()
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
isGE_GenesisImage()
Accessor that returns whether or not the image is a GE_GENESIS image.boolean
isGE_Signa4XImage()
Accessor that returns whether or not the image is a GE_SIGNA4X image.boolean
isMincImage()
Accessor that returns whether or not the image is a MINC image.boolean
isPowerOfTwo()
Returns true if the ModelImage 3D dimensions combine to be a power of two.int
isRegistered(VOI voi)
boolean
isSlicePowerOfTwo()
Returns true if the ModelImage 2D dimensions (slice size) combine to be a power of two.void
make2UnitsOfMeasureIdentical(int newUnitDim, int oldUnitDim)
static java.lang.String
makeImageName(java.lang.String imageName, java.lang.String ext)
Helper method for making the result image's name.void
makeUnitsOfMeasureIdentical()
Make all spatial units the same, all time units the same, and all frequency units the sameboolean
matched(int[] axisOrderOut, boolean[] axisFlipOut)
private static java.lang.String
matrixToDICOMString(TransMatrix matrix)
Convert the matrix to the String format (decimal string) to be stored in the DICOM tag (0020,0037) image (patient) orientation.void
notifyImageDisplayListeners()
Used to notify all frames that display this image model need to be updated.void
notifyImageDisplayListeners(boolean forceShow, int alphaBlend, ModelRGB RGBT)
Deprecated.void
notifyImageDisplayListeners(boolean forceShow, 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
notifyImageDisplayListeners_notTriFrame()
Used to notify all frames except the triImage frames that display this image model need to be updated.void
notifyImageExtentsListeners()
Used to notify all frames that display this image model that this image's extents have changed.private static java.lang.String
positionToDICOMString(double pt0, double pt1, double pt2)
Convert the image position to the String format (decimal string) to be stored in the DICOM tag (0020,0032) image (patient) orientation.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
reallocate(int type, boolean useDisplayError)
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
removePrivateSequenceTags(FileDicomKey[] keys, java.util.Vector<FileDicomSQItem> seqs)
Method to anonymize private tags that may appear in sequence tags.void
removePrivateSequenceTagsWhite(FileDicomKey[] keys, java.util.Vector<FileDicomSQItem> seqs)
void
removePrivateTags(FileDicomKey[] keys)
Method to remove private tags from the file.void
removePrivateTagsWhite(FileDicomKey[] keys)
void
resetVOIs()
Resets VOI vector for new VOIs.void
restoreVOIs(VOIVector VOIs)
Sets VOI vector for with new VOIs.static void
saveImage(ModelImage kImage)
static void
saveImage(ModelImage kImage, java.lang.String fName, java.lang.String dName)
Save the gradient magnitude image into the MIPAV default dir.static void
saveImage(ModelImage kImage, java.lang.String fName, java.lang.String dName, boolean displayProgressBar)
boolean
saveImage(java.lang.String directory, java.lang.String fileName, int fileType, boolean isActive)
Save the image to a file.boolean
saveImage(java.lang.String directory, java.lang.String fileName, int fileType, boolean isActive, boolean bDisplayProgress)
Save the image to a file.boolean
saveImage(java.lang.String directory, java.lang.String fileName, int fileType, boolean isActive, boolean bDisplayProgress, boolean quiet)
Save the image to a file.void
saveTransformMatrix(TransMatrix matrix)
Saves the transformation matrix to file.void
saveTransformMatrix(java.lang.String fileName, TransMatrix matrix)
Save the images transformation matrix in the working directory with the supplied fileName.private void
setClonedImageName(java.lang.String name)
Accessor that sets the name of the image without registering the image.void
setDTIParameters(DTIParameters dtiParameters)
Sets the DTIParamters objectvoid
setExtents(int[] dims)
Sets the dimExtents for this structure.void
setImageDirectory(java.lang.String dir)
Sets the image directory.void
setImageModality(int type)
Sets the image type (MRI, CT, ...).void
setImageName(java.lang.String name)
Accessor that sets the name of the image.void
setImageName(java.lang.String name, boolean updateFileName)
Accessor that sets the name of the image.void
setImageNameArray(java.lang.String[] imageNameArray)
Accesor to set imageNameArrayvoid
setImageNamePrivate(java.lang.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(java.util.BitSet _mask)
Sets the mask which indicate which pixels/voxels to process.void
setMaskBU(java.util.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.java.lang.String
toString()
Gives a readable representation of the ModelImage, including file name and extents.void
trimVOIs()
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.static boolean
updateFileInfo(ModelImage destImage, ModelImage srcImage, int[] axisOrder, boolean[] axisFlip, ViewJProgressBar progressBar, int startValue, int finalValue)
void
updateFileName(java.lang.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.void
updateVOIs()
boolean
useMask()
void
useMask(boolean bOn)
-
Methods inherited from class gov.nih.mipav.model.structures.ModelStorageBase
addSurfaceMask, allocateData, calcAvgIntenStdDev, calcMinMax, 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, exportDiagonal, exportDiagonal, exportDMagData, exportMagData, exportMagData, exportRGBData, exportRGBData, exportRGBData, exportRGBData, exportRGBData, exportRGBDataNoLock, exportRGBDataNoLock, exportSliceXY, exportSliceXY, exportSliceXY, exportSliceXY, exportSliceXY, exportSliceXY, findMax, 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, getDataSize, getDataType, getDouble, getDouble, getDouble, getDouble, getDouble, getDoubleBiLinear, getDoubleTriLinear, getExtents, getExtents, getExtents, getExtentsSize, getFileInfo, getFileInfo, getFilterType, getFloat, getFloat, getFloat, getFloat, getFloat, getFloatBiLinear, getFloatC, getFloatC, getFloatC, getFloatTriLinear, getFloatTriLinearBounds, getFloatTriLinearBounds, getFloatTriLinearBoundsTime, 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, getMaxA, getMaxB, getMaxG, getMaxR, getMin, getMinA, getMinB, getMinG, getMinR, getNDims, getNoLogMax, getNoLogMin, getNoLogMinNonZero, getNonZeroMax, getNonZeroMaxB, getNonZeroMaxG, getNonZeroMaxR, getNonZeroMin, getNonZeroMinB, getNonZeroMinG, getNonZeroMinR, getNumPixels, getOrigin, getOrigin, getOriginalCropCheckbox, getOriginalDoCrop, getOriginalEnd, getOriginalEpsilon, getOriginalExtents, getOriginalFilterConstruction, getOriginalFilterOrder, getOriginalKernelDimension, getOriginalRs, getOriginalStart, getRadiologicalView, getResolutions, 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, getUByte, getUByteBiLinear, getUByteTriLinear, getUInt, getUInt, getUInt, getUInt, getUInt, getUIntBiLinear, getUIntTriLinear, getUnequalDim, getUnitsOfMeasure, getUnitsOfMeasure, getUnitsOfMeasure, getUShort, getUShort, getUShort, getUShort, getUShort, getUShortBiLinear, getUShortTriLinear, getVolumeIterationFactors, getVolumeSize, getWidth, importComplexData, importData, importData, importData, importData, importData, importData, importData, importData, importData, importData, importDComplexData, importRGBData, importRGBData, 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, setComplex, setConvolve, setFileInfo, setFileInfo, setFilterType, setFreq1, setFreq2, setFreqU, setFreqV, setHaveWindowed, setImage25D, setLock, setLock, setLogMagDisplay, setMax, setMaxB, setMaxG, setMaxR, setMin, setMinB, setMinG, setMinR, setOriginalCropCheckbox, setOriginalDoCrop, setOriginalEnd, setOriginalEpsilon, setOriginalExtents, setOriginalFilterConstruction, setOriginalFilterOrder, setOriginalKernelDimension, setOriginalRs, setOriginalStart, setRadiologicalView, setResolutions, setResolutions, setShort, setShort, setSigmaU, setSigmaV, setTheta, setType, setType, setUByte, setUByte, setUByte, setUByte, setUByte, setUInt, setUInt, setUInt, setUInt, setUInt, setUnequalDim, setUShort, setUShort, setUShort, setUShort, setUShort
-
Methods inherited from class gov.nih.mipav.model.structures.ModelSerialCloneable
nativeClone
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Use serialVersionUID for interoperability.- See Also:
- Constant Field Values
-
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
-
frameList
private transient java.util.Vector<ViewImageUpdateInterface> frameList
List of frames where this image is displayed. This is an important list, for example when the LUT of table is changed the list is used to notify all the frames displaying this image that they should update their view of the image. The transient keyword is used to indicate that the frame list should NOT be cloned when the image is cloned. The new cloned image should build up its own list of frame(s) where it is displayed.
-
imageName
private java.lang.String imageName
ImageName is patient's name when using DICOM images. It is filename for any other image something other than filename must be used for DICOM because one DICOM image is made of many seperate files. ** Not necessarily the file name.
-
imageNameArray
private java.lang.String[] imageNameArray
If imageNameArray is not null, then a different image name will appear on every slice
-
imageOrder
private int imageOrder
Indicates the image order when two images are displayed in the same frame.
-
mask
private java.util.BitSet mask
Mask is a binary object that is true interior to a VOI and false otherwise used in algorithms to process only on VOIs if indicated by the user.
-
maskBU
private java.util.BitSet maskBU
Backup of mask for undoing.
-
useMask
private boolean useMask
-
matrixHolder
private MatrixHolder matrixHolder
Holds all of the images associated matrices.
-
provenanceHolder
private transient ProvenanceHolder provenanceHolder
Holds the data provenance (image history) The transient keyword is used to indicate that the provenanceHolder should not be cloned when the image is cloned. The new cloned image creates its own provenanceHolder
-
talairach
private TalairachTransformInfo talairach
Reference to talairach transform information.
-
dtiParameters
private DTIParameters dtiParameters
Reference to DWI bvalue and gradient information.
-
UI
private transient ViewUserInterface UI
The user interface has a vector of all image models loaded into MIPAV. I put the reference to it here so that when an image is created it can added tothe vector in the user interface.
-
voiVector
private VOIVector voiVector
List of VOIs that are displayed with this image.
-
-
Constructor Detail
-
ModelImage
public ModelImage(ModelStorageBase.DataType type, int[] dimExtents, java.lang.String name)
Creates a new ModelImage object, registering it to the default user interface.- Parameters:
type
- indicates type of buffer as DataType enum (ie. boolean, byte ...)dimExtents
- array indicating image extent in each dimension.name
- name of the image.
-
ModelImage
public ModelImage(int type, int[] dimExtents, java.lang.String name)
Creates a new ModelImage object, registering it to the default user interface.- 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, java.lang.String name, ViewUserInterface _UI)
Deprecated.Only one ViewUserInterface should be instantiated for an instance of MIPAV running, so _UI should be ViewUserInterface.getReference()Creates a new ModelImage object that is registered to the provided user interface. Should not be used when an instance of the interface exists.- Parameters:
type
- indicates type of buffer(ie. boolean, byte ...)dimExtents
- array indicating image extent in each dimension.name
- name of the image._UI
- should be ViewUserInterface.getReference()
-
ModelImage
public ModelImage(ModelSimpleImage simpleImage, java.lang.String name)
Creates a new ModelImage object based on an existing ModelSimpleImage, only exists as a FLOAT datatype.- Parameters:
simpleImage
- legacy ModelSimpleImagename
- name of the image.
-
-
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. Original version that passes into the new version so that backwards compatibility still exists.
-
anonymize
public void anonymize(boolean[] list, boolean doRename, boolean removeValue)
New version of anonymize that allows you to replace the original tag value with a blank string or zero depending on the data type. To blank out the value, removeValue should be set to true.
-
anonymizeSequenceTags
public void anonymizeSequenceTags(boolean[] list, java.util.Vector<FileDicomSQItem> seqs, boolean removeValue)
Method to anonymize the tags found in the DICOM supplement 55 that may appear in sequence tags. A list of sequence tags should be passed in so that you do not have to figure out which tags are sequences every time.
-
removePrivateTags
public void removePrivateTags(FileDicomKey[] keys)
Method to remove private tags from the file. No option is given to anonymize the values. Requires an array of DICOM keys.
-
removePrivateTagsWhite
public void removePrivateTagsWhite(FileDicomKey[] keys)
-
removePrivateSequenceTags
public final void removePrivateSequenceTags(FileDicomKey[] keys, java.util.Vector<FileDicomSQItem> seqs)
Method to anonymize private tags that may appear in sequence tags. A list of sequence tags should be passed in so that you do not have to figure out which tags are sequences every time.
-
removePrivateSequenceTagsWhite
public final void removePrivateSequenceTagsWhite(FileDicomKey[] keys, java.util.Vector<FileDicomSQItem> seqs)
-
anonymizePublicTags
public void anonymizePublicTags(FileDicomKey[] keys, boolean removeValue)
Method to anonymize public tags that do not appear in the DICOM Supplement 55. Like in the other anonymize methods, you may instead choose to replace the value with a blank string.
-
anonymizePublicSequenceTags
public final void anonymizePublicSequenceTags(FileDicomKey[] keys, java.util.Vector<FileDicomSQItem> seqs, boolean removeValue)
Method to anonymize public tags not in the DICOM Supplement 55 that may appear in sequence tags. A list of sequence tags should be passed in so that you do not have to figure out which tags are sequences every time.
-
calcMinMax
public void calcMinMax()
Calculates the min and max values for the image array.- Overrides:
calcMinMax
in classModelStorageBase
-
setExtents
public void setExtents(int[] dims)
Description copied from class:ModelStorageBase
Sets the dimExtents for this structure.- Overrides:
setExtents
in classModelStorageBase
- 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 java.lang.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 classModelStorageBase
- Returns:
- the new copy of the image
-
clone
public java.lang.Object clone(java.lang.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 displayedz
- 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 filexml
- 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 classModelStorageBase
-
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.
-
matched
public boolean matched(int[] axisOrderOut, boolean[] axisFlipOut)
-
export
public final ModelImage export(int[] axisOrderOut, boolean[] axisFlipOut, boolean bClone, ViewJProgressBar progressBar, int startValue, int finalValue)
Exports data based on the mapping the current ModelImage to a new ModelImage oriented based on the axisOrder and axisFlip arrays.- Parameters:
axisOrderOut
- The mapping of current ModelImage to the new ModelImage axes.axisFlip
- Invert flags for the new axes.- Returns:
- A new ModelImage. Extents, resolutions, units, origins and orientations are all updated.
-
calcStartLocations
private void calcStartLocations(float[] newLoc, int[] axisOrder, boolean[] axisFlip)
Calculates the new start locations based on image orientation.- Parameters:
newLoc
- float[] buffer to store the new start locations
-
calcAxisOrientation
private int calcAxisOrientation(int[] newOrient, int[] axisOrder, boolean[] axisFlip)
Calculate the new image AxisOrientation, based on re-ordering the axes using axisOrder and axisFlip.- Parameters:
newOrient
- new image AxisOrientation (R2L or L2R, P2A or A2P, etc...)axisOrder
- re-ordering of axesaxisFlip
- inverting new axes.
-
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 VOIonlyActive
- 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 regionsXOR
- indicates that nested VOI contours will be exclusive ORed with other contours of the VOIonlyActive
- 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 regionsXOR
- indicates that nested VOI contours will be exclusive ORed with other contours of the VOIonlyActive
- Only mask regions that are active (i.e. selected VOIs)- Returns:
- ModelImage mask image of type unsigned byte
-
generateVOIMask
public java.util.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 java.util.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 shortindex
- indicates a specific VOI used to create the mask- Returns:
- mask short mask of the VOI
-
generateVOIMask
public java.util.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 VOIonlyActive
- 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 shortindex
- indicates a specific VOI used to create the maskXOR
- 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
-
getHistogramFrame
public JFrameHistogram getHistogramFrame()
Method that returns the Histogram frame if it exists else returns null.- Returns:
- Histogram frame associated with this image, or null.
-
getHistoLUTFrame
public ViewJFrameHistoLUT getHistoLUTFrame()
Deprecated.Method that returns the HistoLUT frame if it exists else returns null.- Returns:
- histoLUTFrame
-
getHistoRGBFrame
public ViewJFrameHistoRGB getHistoRGBFrame()
Deprecated.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 java.lang.String getImageDirectory()
Returns the directory where the image file is located.- Returns:
- The directory where the image file resides.
-
getImageFileName
public java.lang.String getImageFileName()
Returns the file name of the image.- Returns:
- the String that represents the filename (as stored in the fileinfo)
-
getImageFrameVector
public java.util.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 java.lang.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 java.util.BitSet getMask()
Accessor that returns.- Returns:
- mask that indicates which pixels/voxels will be processed.
-
getMaskBU
public java.util.BitSet getMaskBU()
Accessor that returns.- Returns:
- a bakeup of mask that indicates which pixels/voxels will be processed.
-
useMask
public void useMask(boolean bOn)
-
useMask
public boolean useMask()
-
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)
Deprecated.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)
Deprecated.see MipavCoordinateSystems.fileToScannerTakes 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)
Deprecated.see MipavCoordinateSystems.fileToScannerTakes 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
-
getVOIsCopy
public VOIVector getVOIsCopy()
-
groupVOIs
public void groupVOIs()
Forms a single VOI structure from all the active VOIs presently loaded in the imageModel.
-
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()
-
is4DImage
public boolean is4DImage()
-
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.
-
isPowerOfTwo
public boolean isPowerOfTwo()
Returns true if the ModelImage 3D dimensions combine to be a power of two.- Returns:
- true if the ModelImage 3D dimensions combine to be a power of two.
-
isSlicePowerOfTwo
public boolean isSlicePowerOfTwo()
Returns true if the ModelImage 2D dimensions (slice size) combine to be a power of two.- Returns:
- true if the ModelImage 2D dimensions (slice size) combine to be a power of two.
-
isMincImage
public boolean isMincImage()
Accessor that returns whether or not the image is a MINC image.- Returns:
true
if MINC,false
if not MINC.
-
isGE_Signa4XImage
public boolean isGE_Signa4XImage()
Accessor that returns whether or not the image is a GE_SIGNA4X image.- Returns:
true
if GE_SIGNA4X,false
if not GE_SIGNA4X.
-
isGE_GenesisImage
public boolean isGE_GenesisImage()
Accessor that returns whether or not the image is a GE_GENESIS image.- Returns:
true
if GE_GENESIS,false
if not GE_GENESIS.
-
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)
Deprecated.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(boolean forceShow, 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 2interpMode
- 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 classModelStorageBase
- Parameters:
type
- new type of image that is to be allocated
-
reallocate
public void reallocate(int type, boolean useDisplayError)
Reallocates ModelImage with new type and all image data lost.- Parameters:
type
- new type of image that is to be allocateduseDisplayError
- if true, MipavUtil.displayError, if false, System.err.println
-
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
-
restoreVOIs
public void restoreVOIs(VOIVector VOIs)
Sets VOI vector for with new VOIs.- Parameters:
VOIs
- VOIs to image VOIs
-
isRegistered
public int isRegistered(VOI voi)
-
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(java.lang.String directory, java.lang.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.
-
saveImage
public boolean saveImage(java.lang.String directory, java.lang.String fileName, int fileType, boolean isActive, boolean bDisplayProgress)
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 threadbDisplayProgress
- when true display the progress bar for writing.- Returns:
- true if succeeded in saving.
-
saveImage
public boolean saveImage(java.lang.String directory, java.lang.String fileName, int fileType, boolean isActive, boolean bDisplayProgress, boolean quiet)
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 threadbDisplayProgress
- when true display the progress bar for writing.- 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, java.lang.String fName, java.lang.String dName)
Save the gradient magnitude image into the MIPAV default dir.- Parameters:
gmImage
- ModelImage gradient magnitude image to save
-
saveImage
public static void saveImage(ModelImage kImage, java.lang.String fName, java.lang.String dName, boolean displayProgressBar)
-
saveImage
public static void saveImage(ModelImage kImage)
-
saveTransformMatrix
public void saveTransformMatrix(java.lang.String fileName, TransMatrix matrix)
Save the images transformation matrix in the working directory with the supplied fileName.- Parameters:
fileName
- - fileName of transformation matrixmatrix
- DOCUMENT ME!
-
setImageDirectory
public void setImageDirectory(java.lang.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
-
setImageNameArray
public void setImageNameArray(java.lang.String[] imageNameArray)
Accesor to set imageNameArray- Parameters:
imageNameArray
-
-
getImageNameArray
public java.lang.String[] getImageNameArray()
-
setImageName
public void setImageName(java.lang.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(java.lang.String name, boolean updateFileName)
Accessor that sets the name of the image.- Parameters:
name
- the String representing the filenameupdateFileName
- whether to update the file name stored in the image's fileInfos to match the new image name
-
getDTIParameters
public DTIParameters getDTIParameters()
-
setDTIParameters
public void setDTIParameters(DTIParameters dtiParameters)
Sets the DTIParamters object- Parameters:
dti
- params object that stores dwi parameters (i.e. gradients and bvalues)
-
setImageNamePrivate
public void setImageNamePrivate(java.lang.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(java.util.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(java.util.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 java.lang.String toString()
Gives a readable representation of the ModelImage, including file name and extents.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the string representation
-
trimVOIs
public void trimVOIs()
-
updateVOIs
public void updateVOIs()
-
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
-
updateFileInfo
public static boolean updateFileInfo(ModelImage destImage, ModelImage srcImage, int[] axisOrder, boolean[] axisFlip, ViewJProgressBar progressBar, int startValue, int finalValue)
-
matrixToDICOMString
private static java.lang.String matrixToDICOMString(TransMatrix matrix)
Convert the matrix to the String format (decimal string) to be stored in the DICOM tag (0020,0037) image (patient) orientation.- Parameters:
matrix
- Transformation matrix to be converted.- Returns:
- The string version of the transformation matrix (i.e. the directional cosines for the first two rows of the matrix delimited by "\")
-
positionToDICOMString
private static java.lang.String positionToDICOMString(double pt0, double pt1, double pt2)
Convert the image position to the String format (decimal string) to be stored in the DICOM tag (0020,0032) image (patient) orientation.- Parameters:
pt0
- X position of patient.pt1
- Y position of patient.pt2
- Z position of patient.- Returns:
- The string version of the patient position delimited by "\".
-
updateFileName
public void updateFileName(java.lang.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.
-
getConversionFactor
public static double getConversionFactor(int newUnit, int oldUnit)
-
finalize
protected void finalize() throws java.lang.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 classModelStorageBase
- Throws:
java.lang.Throwable
- Throws an error if there is a problem with the finalization of this object.
-
makeImageName
public static java.lang.String makeImageName(java.lang.String imageName, java.lang.String ext)
Helper method for making the result image's name. Strips the current extension from the original name, adds the given extension, and returns the new name.- Parameters:
imageName
- Source image name that will be modified to have a new extension.ext
- Extension to add which gives information about what algorithm was performed on the image.- Returns:
- The new image name.
-
disposeThisImage
private void disposeThisImage()
Disposes of image memory and LUT Frame.
-
fixFileTypeInfo
private void fixFileTypeInfo(ModelImage image)
Fixes file information to resultant image structure. When one image's file information is copied to anothers this method sets the modality to OTHER and file directory to an empty string.- Parameters:
image
- source image
-
setClonedImageName
private void setClonedImageName(java.lang.String name)
Accessor that sets the name of the image without registering the image.- Parameters:
name
- the String representing the filename
-
exportDataUseMask
public final void exportDataUseMask(int start, int length, boolean rescale, byte[] values) throws java.io.IOException
Export data into values array.- Parameters:
start
- indicates starting position in data arraylength
- length of data to be copied from data arrayvalues
- array where data is to be deposited- Throws:
java.io.IOException
- Throws an error when there is a locking or bounds error.
-
exportDataUseMask
public final void exportDataUseMask(int start, int length, float[] values) throws java.io.IOException
Export data into values array.- Parameters:
start
- indicates starting position in data arraylength
- length of data to be copied from data arrayvalues
- array where data is to be deposited- Throws:
java.io.IOException
- Throws an error when there is a locking or bounds error.
-
exportDiagonal
public final void exportDiagonal(int tSlice, int slice, int[] extents, WildMagic.LibFoundation.Mathematics.Vector3f[] verts, float[] values, boolean bInterpolate, boolean bUseMask, java.util.Vector<java.util.BitSet> surfaceMask, boolean[] surfaceValues) throws java.io.IOException
- Throws:
java.io.IOException
-
-