|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gov.nih.mipav.model.structures.ModelSerialCloneable gov.nih.mipav.model.structures.ModelStorageBase gov.nih.mipav.model.structures.ModelImage
public class ModelImage
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.
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 java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int IMAGE_A
public static final int IMAGE_B
Constructor Detail |
---|
public ModelImage(int type, int[] dimExtents, String name)
type
- indicates type of buffer(ie. boolean, byte ...)dimExtents
- array indicating image extent in each dimension.name
- name of the image.public ModelImage(int type, int[] dimExtents, String name, ViewUserInterface _UI)
type
- indicates type of buffer(ie. boolean, byte ...)dimExtents
- DOCUMENT ME!name
- DOCUMENT ME!_UI
- DOCUMENT ME!Method Detail |
---|
public static boolean isColorImage(int dataType)
dataType
- The data type from a ModelImage to determine if it is of one of the three types of color
images supported.
true
if color, false
if not color.public void addImageDisplayListener(ViewImageUpdateInterface obj)
obj
- "object' to be added to the listpublic void addVOIs(VOIVector VOIs)
VOIs
- VOIs to add to imagepublic void anonymize(boolean[] list, boolean doRename)
FileInfoDicom.anonymize(boolean[])
public void calcMinMax()
calcMinMax
in class ModelStorageBase
public void setExtents(int[] dims)
ModelStorageBase
setExtents
in class ModelStorageBase
dims
- new dimensions for imagepublic void changeExtents(int[] dimExtents)
dimExtents
- new dimensions for mask, maskBU, and fileInfopublic void clearMask()
public Object clone()
clone
in class ModelStorageBase
public Object clone(String newName)
newName
- String containing the name for the cloned image. If null then 'this' image name is appended
with "_clone".
public void copyFileTypeInfo(ModelImage fromImage)
fromImage
- image from which to copy file type infopublic void createMask(int length)
length
- intpublic void displayAboutInfo(JDialogBase dialog, int z, int t, boolean dicom, boolean xml)
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 filepublic void disposeLocal()
disposeLocal
in class ModelStorageBase
public void disposeLocal(boolean garbageCollect)
garbageCollect
- boolean - A flag indicating whether or not garbage collection is invoked.public ModelImage generateBinaryImage()
public ModelImage generateBinaryImage(boolean XOR, boolean onlyActive)
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)
public ModelImage generateShortImage(int offset)
offset
- offset value added to ID - normally 1 used to label the masked regions
public ModelImage generateShortImage(int offset, boolean XOR, boolean onlyActive)
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)
public ModelImage generateUnsignedByteImage(int offset)
offset
- offset value added to ID - normally 1. ID is used to label the masked regions
public ModelImage generateUnsignedByteImage(int offset, boolean XOR, boolean onlyActive)
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)
public BitSet generateVOIMask()
public BitSet generateVOIMask(boolean XOR)
XOR
- indicates that nested VOI contours will be exclusive ORed with other contours of the VOI
public short[] generateVOIMask(short[] mask, int index)
mask
- mask of VOI of type shortindex
- indicates a specific VOI used to create the mask
public BitSet generateVOIMask(boolean XOR, boolean onlyActive)
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 )
public short[] generateVOIMask(short[] mask, int index, boolean XOR)
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
public ViewJFrameAnimate getAnimateFrame()
public ViewJFrameHistoLUT getHistoLUTFrame()
public ViewJFrameHistoRGB getHistoRGBFrame()
public WildMagic.LibFoundation.Mathematics.Vector3f getImageCenter()
public WildMagic.LibFoundation.Mathematics.Vector3f getImageCentermm(boolean useScanner)
useScanner
- DOCUMENT ME!
public String getImageDirectory()
public String getImageFileName()
public Vector<ViewImageUpdateInterface> getImageFrameVector()
public int getImageModality()
public String getImageName()
public int getImageOrder()
public ViewJFrameLightBox getLightBoxFrame()
public BitSet getMask()
public BitSet getMaskBU()
public TransMatrix getMatrix()
public MatrixHolder getMatrixHolder()
public ProvenanceHolder getProvenanceHolder()
public final int getPackedColor(int iIndex)
iIndex
- pixel index
public ViewJFrameImage getParentFrame()
public final float[] getPlane(WildMagic.LibFoundation.Mathematics.Vector3f topLeft, WildMagic.LibFoundation.Mathematics.Vector3f topRight, WildMagic.LibFoundation.Mathematics.Vector3f botLeft, WildMagic.LibFoundation.Mathematics.Vector3f botRight)
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..
public ViewJFrameRegistration getRegistrationFrame()
public void getScannerCoordLPS(int x, int y, int z, float[] scannerCoord)
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.public void getScannerCoordRAS(int x, int y, int z, float[] scannerCoord)
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.public TalairachTransformInfo getTalairachTransformInfo()
public ViewJFrameTriImage getTriImageFrame()
public ViewUserInterface getUserInterface()
public VOIVector getVOIs()
public void groupVOIs()
public void groupVOIs(ViewVOIVector newVOIVector, int[] where, String name)
newVOIVector
- a new ViewVOIVector to hold the grouped VOIswhere
- int array telling where to sortname
- the name of the VOIpublic boolean isColorImage()
true
if color, false
if not color.public boolean is2DImage()
public boolean is3DImage()
public boolean isComplexImage()
true
if complex, false
if not complex.public boolean isDicomImage()
true
if DICOM, false
if not DICOM.public boolean isMincImage()
true
if MINC, false
if not MINC.public void notifyImageDisplayListeners()
public void notifyImageDisplayListeners_notTriFrame()
public void notifyImageDisplayListeners(ModelLUT LUT, boolean forceShow)
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.public void notifyImageDisplayListeners(boolean forceShow, int alphaBlend, ModelRGB RGBT)
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
- ModelRGBpublic void notifyImageDisplayListeners(ModelLUT LUT, boolean forceShow, int alphaBlend, int interpMode)
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)public void notifyImageExtentsListeners()
public void print()
public TransMatrix readTransformMatrix(boolean composite)
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.
public void reallocate(int type)
reallocate
in class ModelStorageBase
type
- new type of image that is to be allocatedpublic void registerVOI(VOI voi)
voi
- Region of interest (VOI) to be registered with the image modelpublic void removeImageDisplayListener(ViewImageUpdateInterface obj)
obj
- "object' to be added to the listpublic void resetVOIs()
public boolean saveImage(String directory, String fileName, int fileType, boolean isActive)
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
public void saveTransformMatrix(TransMatrix matrix)
matrix
- DOCUMENT ME!public static void saveImage(ModelImage kImage)
gmImage
- ModelImage gradient magnitude image to savepublic void saveTransformMatrix(String fileName, TransMatrix matrix)
fileName
- - fileName of transformation matrixmatrix
- DOCUMENT ME!public void setImageDirectory(String dir)
dir
- string representing the directorypublic void setImageModality(int type)
type
- integer representing the typepublic void setImageName(String name)
name
- the String representing the filenamepublic void setImageName(String name, boolean updateFileName)
name
- the String representing the filenameupdateFileName
- whether to update the file name stored in the image's fileInfos to match the new image
namepublic void setImageNamePrivate(String name)
name
- the String representing the filenamepublic void setImageOrder(int order)
order
- integer indicating image orderpublic void setImageOrientation(int orient)
orient
- integer representing the orientationpublic void setMask(BitSet _mask)
_mask
- mask in the form of a BitSet, 1 indicates pixel should be processed 0 indicates pixel should not
be processedpublic void setMaskBU(BitSet mask)
mask
- mask in the form of a BitSet, 1 indicates pixel should be processed 0 indicates pixel should not be
processedpublic void setMatrix(TransMatrix matrix)
matrix
- transformation matrix structure.public void setSlice(int slice)
slice
- Indicates the z dim. slice that should be displayed.public void setTalairachTransformInfo(TalairachTransformInfo tal)
tal
- TalairachTransformInfo talairach infopublic void setTimeSlice(int tSlice)
tSlice
- Indicates the t (time) dim. slice that should be displayed.public void setUserInterface(ViewUserInterface _UI)
_UI
- reference to user interfacepublic void setVOIs(VOIVector VOIs)
VOIs
- VOIs to image VOIspublic String toString()
toString
in class Object
public void ungroupVOIs()
public void unregisterAllVOIs()
public void unRegisterImage()
public void unregisterVOI(VOI voi)
voi
- Volume of interest (VOI) to be removed from the image modelpublic void updateFileName(String newImageName)
newImageName
- The new name for the imagepublic void updateImageOrigin(TransMatrix xfrm)
xfrm
- the transformation maxtrix used to transform the originpublic void makeUnitsOfMeasureIdentical()
public void make2UnitsOfMeasureIdentical(int newUnitDim, int oldUnitDim)
newUnitDim
- oldUnitDim
- dimension which will have unit of measure converted to unit of measure
of dimension newUnitDim and will have the resolution correspondingly
converted.protected void finalize() throws Throwable
finalize
in class ModelStorageBase
Throwable
- Throws an error if there is a problem with the finalization of this object.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |