com.xinapse.loadableimage
Class LoadedImage

java.lang.Object
  extended by com.xinapse.loadableimage.LoadedImage
All Implemented Interfaces:
LoadableImage

public class LoadedImage
extends java.lang.Object
implements LoadableImage

This class is a representation of a loaded multi-dimensional image. A LoadedImage object may be either purely held in memory, or may have its pixel data kept on disk.


Field Summary
protected  javax.vecmath.Vector3f[] imageOrientationPatient
          The global image orientation in patient coordinates of a block of slices, or null if this image doesn't contain a block of parallel slices.
protected  javax.vecmath.Point3f imagePositionPatient
          The global image position in patient coordinates of a block of slices, or null if this image doesn't contain a block of parallel slices.
protected  javax.vecmath.Vector3f[][] sliceImageOrientationPatient
          The slice-by-slice image orientation in patient coordinates.
protected  javax.vecmath.Point3f[] sliceImagePositionPatient
          The slice-by-slice image position in patient coordinates.
 
Constructor Summary
protected LoadedImage(java.util.List<com.xinapse.importimage.ImportableImage> impImages, com.xinapse.importimage.TimePointSplitType splitType, boolean anonymised)
          Creates a LoadedImage from a List of ImportableImage.
  LoadedImage(LoadableImage im, MessageShower messageShower)
          Creates a LoadedImage from a LoadableImage.
 
Method Summary
 void appendAuditInfo(java.lang.String name, java.lang.String value)
          Appends audit trail information to this image.
 void close()
          Closes an image and frees up resources.
 java.lang.String getDescription()
          Returns a String description of this image.
 java.lang.String getDescription(int slice)
          Returns a description of a slice of this image.
 float[] getDWBMatrix(int slice)
          Returns the diffusion-weighting b-matrix for one slice of this image.
 float getDWbValue(int slice)
          Returns the diffusion-weighting b-value for one slice of this image.
 javax.vecmath.Vector3f getDWGradientVector(int slice)
          Returns the diffusion-weighting gradient-vector for one slice of this image.
 float getFlipAngle()
          Returns the excitation pulse flip angle for this image.
 com.xinapse.dicom.Uid getFrameOfReferenceUID()
          Returns the frame of reference UID that uniquely identifies the frame of reference for an image.
 java.lang.String getHTMLDescription()
          Returns a String description of this image in HTML format.
 java.lang.String getHTMLDescription(int slice)
          Returns a String description of a slice of this image in HTML format.
static javax.vecmath.Point3f getImageCentrePatient(LoadableImage image)
          Returns the coordinates of the center of the block of slices of an image, in mm, in patient coordinates.
 java.lang.Class getImageClass()
          Returns the class of image that this LoadedImage was loaded from, e.g.
 javax.vecmath.Vector3f[] getImageOrientationPatient()
          Returns the direction cosines of the row, column and slice directions (for increasing row, column and slice) of the image, in patient (L,P,S) coordinates.
 javax.vecmath.Vector3f[] getImageOrientationPatient(int slice)
          Returns the direction cosines of the row, column and slice directions (for increasing row, column and slice) of the image, in patient coordinates.
 javax.vecmath.Point3f getImagePositionPatient()
          Returns the coordinates of the center of the first pixel of the image, in mm, in patient coordinates.
 javax.vecmath.Point3f getImagePositionPatient(int slice)
          Returns the coordinates of the center of the first pixel of the specified slice of this image, in mm, in patient coordinates.
static java.util.List<LoadedImage> getInstances(java.io.File[] files, com.xinapse.importimage.TimePointSplitType splitType, boolean anonymised, MonitorWorker worker)
          Create a List of LoadedImages, from an array of individual files, where each file will (typically) contain a single slice of header and pixel data.
static java.util.List<LoadedImage> getInstances(java.util.List<com.xinapse.importimage.ImportableImage> importableImages, com.xinapse.importimage.TimePointSplitType splitType, boolean anonymised)
          Create a List of LoadedImages, from an array of ImportableImages, where each ImportableImage will (typically) contain a single slice of header and pixel data.
static java.util.List<LoadedImage> getInstances(java.lang.String[] fileNames, com.xinapse.importimage.TimePointSplitType splitType, boolean anonymised, MonitorWorker worker)
          Create a List of LoadedImages, from an array of individual file names, where each file will (typically) contain a single slice of header and pixel data.
 float[] getIntensityRescale()
          Returns the values m and b in the relationship between pixel intensity (I) values and the output units specified in getRescaleUnits() in the expression:
Output units = m*I + b.
 float[] getIntensityRescale(int slice)
          Returns the values m and b in the relationship between pixel intensity (I) values and the output units specified in getRescaleUnits() in the expression:
Output units = m*I + b
for a particular slice.
 java.lang.Double getMax()
          Returns the maximum pixel intensity in the image.
 java.lang.Double getMin()
          Returns the minimum pixel intensity in the image.
 Modality getModality()
          Returns the imaging modality with which this image was collected.
 MostLikePlane getMostLikePlane()
          Returns the imaging plane that this image is "most like".
 ColourMapping getNativeColourMapping()
          Returns a ColourMapping if this image has an associated colour mapping.
 int getNCols()
          Returns the number of image columns in this image.
 int getNDim()
          Returns the dimensionality of this image.
 int getNFrames()
          Returns the number of frames in a multi-frame image.
 int getNRows()
          Returns the number of image rows in this image.
 int getNSlices()
          Returns the number of physical slice locations in this image.
 java.util.Date getPatientDoB()
          Returns the patient date of birth for this image.
 java.lang.String getPatientID()
          Returns the patient ID for this image.
 java.lang.String getPatientName()
          Returns the patient name for this image.
 PatientPosition getPatientPosition()
          Returns the position in which the patient is lying in the scanning equipment.
 java.lang.Object getPix()
          Returns all the pixel values for this image in the order in which they are stored internally.
 java.lang.Object getPix(boolean radiological)
          Returns all the pixel values for this image, optionally returning them in the correct order in which they will be presented, where the first pixel should be presented at the top left corner of the display device.
 PixelDataType getPixelDataType()
          Returns a PixelDataType representing the data type of this image.
 float getPixelXSize()
          Returns the pixel size in the x (horizontal) direction for this image.
 float getPixelYSize()
          Returns the pixel size in the y (vertical) direction for this image.
 float getPixelZSize()
          Returns the separation between the centres of image planes for this image.
 java.lang.String getPulseSequence()
          Returns the name of the pulse sequence with which this image was collected.
 java.lang.String getRescaleUnits()
          Specifies the output units of Intensity Rescale Slope and Intensity Rescale Intercept, retrieved by getIntensityRescale().
 java.util.List<ROI> getROIs()
          Returns a List of ROIs that are stored with the image.
 java.util.Date getScanDate()
          Returns the scan Date for this image.
 PulseSequenceType getScanningSequence()
          Returns the DICOM Scanning Sequence with which this image was collected.
 float getScanTE()
          Returns the scan echo time for this image if it has a single echo-time.
 float getScanTE(int slice)
          Returns the scan echo time for one slice of this image.
 float getScanTI()
          Returns the scan inversion time for this image.
 float getScanTR()
          Returns the scan repetition time for this image.
 PulseSequenceVariant getSequenceVariant()
          Returns the DICOM Scanning Sequence Variant with which this image was collected.
 java.lang.Object getSlice(int slice)
          Returns the pixel values for one slice of an n-dimensional image, where n > 1.
static boolean getSlicesAreReversed(LoadableImage image)
          Tests whether the supplied image has slices which are in reverse order compared to standard radiological presentation order.
 float getSliceThickness()
          Returns the slice thickness (in mm).
 java.lang.String getSuggestedFileName()
          Returns the suggested file name for in-memory images that are to be saved to disk.
 float getTimeBetweenFrames()
          Returns the time between frames in a 4- or higher dimensional image.
 java.lang.String getTitle()
          Returns the title of this image.
 int getTotalNSlices()
          Returns the total number of slices in this image.
 boolean isOpen()
          Tests whether this image is still open.
 void saveAs(java.lang.Class outputImageClass, java.lang.String fileName)
          Saves this LoadedImage to a specfied class of multi-dimensional image.
 void saveAs(java.lang.Class outputImageClass, java.lang.String fileName, PixelDataType savePixelDataType, ComplexMode complexMode, java.awt.Component parentComponent)
          Saves this LoadedImage to a specfied class of multi-dimensional image, possibly changing the pixel data type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imagePositionPatient

protected javax.vecmath.Point3f imagePositionPatient
The global image position in patient coordinates of a block of slices, or null if this image doesn't contain a block of parallel slices.


imageOrientationPatient

protected javax.vecmath.Vector3f[] imageOrientationPatient
The global image orientation in patient coordinates of a block of slices, or null if this image doesn't contain a block of parallel slices.


sliceImagePositionPatient

protected javax.vecmath.Point3f[] sliceImagePositionPatient
The slice-by-slice image position in patient coordinates.


sliceImageOrientationPatient

protected javax.vecmath.Vector3f[][] sliceImageOrientationPatient
The slice-by-slice image orientation in patient coordinates.

Constructor Detail

LoadedImage

protected LoadedImage(java.util.List<com.xinapse.importimage.ImportableImage> impImages,
                      com.xinapse.importimage.TimePointSplitType splitType,
                      boolean anonymised)
               throws com.xinapse.importimage.ImageCreationException
Creates a LoadedImage from a List of ImportableImage.

Parameters:
impImages - the images to import.
splitType - in cases where the List of ImportableImages contains multiple time points, the SplitType affects whether the LoadedImage is a 3-D or a 4-D image. splitType may not be TimePointSplitType.SEPARATE, since this constructor expects to create only a single LoadedImage.
anonymised - if true, the imported image information will be anonymised before it is copied to the LoadedImage.
Throws:
com.xinapse.importimage.ImageCreationException - if the LoadableImage cannot be created from the List of ImportableImages.

LoadedImage

public LoadedImage(LoadableImage im,
                   MessageShower messageShower)
            throws InvalidImageException,
                   CancelledException
Creates a LoadedImage from a LoadableImage.

Parameters:
im - the image to load.
messageShower - the component that will display any error and warning messages.
Throws:
InvalidImageException - if the LoadableImage is invalid.
CancelledException - if the loading of the LoadableImage is cancelled.
Method Detail

getInstances

public static java.util.List<LoadedImage> getInstances(java.lang.String[] fileNames,
                                                       com.xinapse.importimage.TimePointSplitType splitType,
                                                       boolean anonymised,
                                                       MonitorWorker worker)
                                                throws java.io.FileNotFoundException,
                                                       java.io.IOException,
                                                       com.xinapse.importimage.ImageCreationException,
                                                       CancelledException
Create a List of LoadedImages, from an array of individual file names, where each file will (typically) contain a single slice of header and pixel data.

Parameters:
fileNames - an array of individual file names of the files containing header and pixel data.
splitType - the way in which images with multiple time points should be created. Must be one of:
  • TimePointSplitType.THREE_D A three-dimensional image containing all time points as separate slices will be created.
  • TimePointSplitType.FOUR_D A four-dimensional image containing all time points will be created.
anonymised - if true the patient name is anonymised.
Throws:
java.io.FileNotFoundException - if any of the files does not exist.
java.io.IOException - if reading any of the files throws an IOException.
com.xinapse.importimage.ImageCreationException - if any of the LoadedImages cannot be created from the input files.
CancelledException

getInstances

public static java.util.List<LoadedImage> getInstances(java.io.File[] files,
                                                       com.xinapse.importimage.TimePointSplitType splitType,
                                                       boolean anonymised,
                                                       MonitorWorker worker)
                                                throws java.io.FileNotFoundException,
                                                       java.io.IOException,
                                                       com.xinapse.importimage.ImageCreationException,
                                                       CancelledException
Create a List of LoadedImages, from an array of individual files, where each file will (typically) contain a single slice of header and pixel data.

Parameters:
files - an array of individual files containing header and pixel data.
splitType - the way in which images with multiple time points should be created. Must be one of:
  • TimePointSplitType.THREE_D A three-dimensional image containing all time points as separate slices will be created.
  • TimePointSplitType.FOUR_D A four-dimensional image containing all time points will be created.
anonymised - if true the patient name is anonymised.
Throws:
java.io.FileNotFoundException - if any of the files does not exist.
java.io.IOException - if reading any of the files throws an IOException.
com.xinapse.importimage.ImageCreationException - if any of the LoadedImage cannot be created from the input files.
CancelledException

getInstances

public static java.util.List<LoadedImage> getInstances(java.util.List<com.xinapse.importimage.ImportableImage> importableImages,
                                                       com.xinapse.importimage.TimePointSplitType splitType,
                                                       boolean anonymised)
                                                throws com.xinapse.importimage.ImageCreationException
Create a List of LoadedImages, from an array of ImportableImages, where each ImportableImage will (typically) contain a single slice of header and pixel data.

Parameters:
importableImages - a java.util.List of ImportableImages that will be sorted to create the LoadedImage.
splitType - the way in which images with multiple time points should be created. Must be one of:
  • TimePointSplitType.THREE_D A three-dimensional image containing all time points as separate slices will be created.
  • TimePointSplitType.FOUR_D A four-dimensional image containing all time points will be created.
anonymised - if true the patient name is anonymised.
Throws:
com.xinapse.importimage.ImageCreationException - if an LoadedImage cannot be created from the input files, of if the splitType is not one of the above.

getPixelDataType

public PixelDataType getPixelDataType()
Description copied from interface: LoadableImage
Returns a PixelDataType representing the data type of this image.

Specified by:
getPixelDataType in interface LoadableImage
Returns:
the PixelDataType representing the data type of this image.

getNDim

public int getNDim()
Description copied from interface: LoadableImage
Returns the dimensionality of this image.

Specified by:
getNDim in interface LoadableImage
Returns:
the image dimensionality.

getNCols

public int getNCols()
Description copied from interface: LoadableImage
Returns the number of image columns in this image.

Specified by:
getNCols in interface LoadableImage
Returns:
the number of image columns.

getNRows

public int getNRows()
Description copied from interface: LoadableImage
Returns the number of image rows in this image.

Specified by:
getNRows in interface LoadableImage
Returns:
the number of image rows.

getNSlices

public int getNSlices()
Description copied from interface: LoadableImage
Returns the number of physical slice locations in this image. If the image dimensionality is greater than or equal to three, then this method returns the number of samples in the third dimension. If the dimensionality is less than 3 two, it returns 1.

Specified by:
getNSlices in interface LoadableImage
Returns:
the number of physical slice locations.

getNFrames

public int getNFrames()
Description copied from interface: LoadableImage
Returns the number of frames in a multi-frame image. If the image dimensionality is greater than or equal to four, then this method returns the number of samples in the fourth dimension. If the dimensionality is less than 4, it returns 1.

Specified by:
getNFrames in interface LoadableImage
Returns:
the number of image (movie) frames.

getTotalNSlices

public int getTotalNSlices()
Description copied from interface: LoadableImage
Returns the total number of slices in this image. If the image is less than 3-dimensional, this method returns 1; if it is 3-dimensional, it returns the number of slices; if it is 4- or more dimensional, it sums up the total number of planar slices in each dimension and returns the total. For example a 4-dimensional image with 4 slices and 10 frames, the total number of slices is 40.

Specified by:
getTotalNSlices in interface LoadableImage
Returns:
the number of planar image slices.

getPix

public java.lang.Object getPix()
                        throws InvalidImageException
Description copied from interface: LoadableImage
Returns all the pixel values for this image in the order in which they are stored internally.

Specified by:
getPix in interface LoadableImage
Throws:
InvalidImageException - if there is a problem accessing the pixel values.

getPix

public java.lang.Object getPix(boolean radiological)
                        throws InvalidImageException
Description copied from interface: LoadableImage
Returns all the pixel values for this image, optionally returning them in the correct order in which they will be presented, where the first pixel should be presented at the top left corner of the display device.

Specified by:
getPix in interface LoadableImage
Parameters:
radiological - trueif the pixels are to be returned in the correct order for presentation, where the first returned pixel is to be presented at the top left, and the last at the bottom right of the display device; false if the are to be return in the order in which they are stored internally.
Throws:
InvalidImageException - if there is a problem accessing the pixel values.

getSlice

public java.lang.Object getSlice(int slice)
                          throws InvalidImageException,
                                 java.lang.IndexOutOfBoundsException
Description copied from interface: LoadableImage
Returns the pixel values for one slice of an n-dimensional image, where n > 1.

N.B.The pixel values are always returned in a standard radiological orientation. Standard radiological orientation is:

Thus, when this slice is viewed on-screen, the first pixel in the array returned belongs at the top left of the screen, and the last pixel in the array belongs at the bottom right of the screen. This is regardless of the sub-class of image (for example, the flipping of Analyze images is taken care of by this method).

Specified by:
getSlice in interface LoadableImage
Parameters:
slice - the slice number. Must be 0 for a 2-dimensional image or from 0 to dims[0]-1 for a 3-dimensional image. For images of higher dimensionality, each extra dimension multiplies the number of available slices by the size in that dimension, so all images of higher dimensionality that 1 look like multi-slice images.
Returns:
a 1-dimensional array of the primitive java type appropriate for this image, and of size [nRows * nCols]. This array is cast to an Object before return.
Throws:
InvalidImageException - if there is a problem accessing the pixel values.
java.lang.IndexOutOfBoundsException - if the image does not have the right dimensionality or the slice number is inappropriate for this image.

appendAuditInfo

public void appendAuditInfo(java.lang.String name,
                            java.lang.String value)
Description copied from interface: LoadableImage
Appends audit trail information to this image.

Specified by:
appendAuditInfo in interface LoadableImage
Parameters:
name - a String describing the name of the action that was performed on this image.
value - a String describing the value of the action that was performed on this image.

getMin

public java.lang.Double getMin()
                        throws InvalidImageException
Description copied from interface: LoadableImage
Returns the minimum pixel intensity in the image.

Specified by:
getMin in interface LoadableImage
Returns:
the maximum pixel intensity as a Double, or null if the intensity min hasn't been calculated for this image.
Throws:
InvalidImageException - if the intensity cannot be returned as a Double.

getMax

public java.lang.Double getMax()
                        throws InvalidImageException
Description copied from interface: LoadableImage
Returns the maximum pixel intensity in the image.

Specified by:
getMax in interface LoadableImage
Returns:
the maximum pixel intensity as a Double, or null if the intensity max hasn't been calculated for this image.
Throws:
InvalidImageException - if the intensity cannot be returned as a Double.

getNativeColourMapping

public ColourMapping getNativeColourMapping()
Description copied from interface: LoadableImage
Returns a ColourMapping if this image has an associated colour mapping.

Specified by:
getNativeColourMapping in interface LoadableImage
Returns:
a ColourMapping if this image has an associated colour mapping. Returns null if it does not.

close

public void close()
Description copied from interface: LoadableImage
Closes an image and frees up resources. Any further operations to a closed image are not possible, and may cause an exception to be thrown.

Specified by:
close in interface LoadableImage

isOpen

public boolean isOpen()
Description copied from interface: LoadableImage
Tests whether this image is still open.

Specified by:
isOpen in interface LoadableImage
Returns:
true if the image is still open for reading and (if opened read/write) writing; false otherwise.

getTitle

public java.lang.String getTitle()
Description copied from interface: LoadableImage
Returns the title of this image.

Specified by:
getTitle in interface LoadableImage
Returns:
the title of this image.

getSuggestedFileName

public java.lang.String getSuggestedFileName()
Description copied from interface: LoadableImage
Returns the suggested file name for in-memory images that are to be saved to disk.

Specified by:
getSuggestedFileName in interface LoadableImage
Returns:
the suggested file name, or null if not set.

getPixelXSize

public float getPixelXSize()
                    throws ParameterNotSetException
Description copied from interface: LoadableImage
Returns the pixel size in the x (horizontal) direction for this image.

Specified by:
getPixelXSize in interface LoadableImage
Returns:
the pixel size in the x (horizontal) direction in mm.
Throws:
ParameterNotSetException - if the pixel size can't be found.

getPixelYSize

public float getPixelYSize()
                    throws ParameterNotSetException
Description copied from interface: LoadableImage
Returns the pixel size in the y (vertical) direction for this image.

Specified by:
getPixelYSize in interface LoadableImage
Returns:
the pixel size in the y (vertical) direction in mm.
Throws:
ParameterNotSetException - if the pixel size can't be found.

getPixelZSize

public float getPixelZSize()
                    throws ParameterNotSetException
Description copied from interface: LoadableImage
Returns the separation between the centres of image planes for this image.

Specified by:
getPixelZSize in interface LoadableImage
Returns:
the pixel size in the z (slice) direction in mm.
Throws:
ParameterNotSetException - if the pixel size can't be found.

getTimeBetweenFrames

public float getTimeBetweenFrames()
                           throws ParameterNotSetException
Description copied from interface: LoadableImage
Returns the time between frames in a 4- or higher dimensional image.

Specified by:
getTimeBetweenFrames in interface LoadableImage
Returns:
the time between frames in seconds.
Throws:
ParameterNotSetException - if the time between frames is not set, or if this image doesn't have a dimensionality of at least 4.

getSliceThickness

public float getSliceThickness()
                        throws ParameterNotSetException
Description copied from interface: LoadableImage
Returns the slice thickness (in mm). This method is necessary because the slice thickness may not be the same as the inter-slice pixel spacing, if there is a gap between slices.

Specified by:
getSliceThickness in interface LoadableImage
Returns:
the slice thickness in mm.
Throws:
ParameterNotSetException - if the slice thickness is not set, or its value is corrupt.

getFlipAngle

public float getFlipAngle()
                   throws ParameterNotSetException
Description copied from interface: LoadableImage
Returns the excitation pulse flip angle for this image.

Specified by:
getFlipAngle in interface LoadableImage
Returns:
the excitation pulse flip angle for this image.
Throws:
ParameterNotSetException - if the flip angle is not set.

getDWbValue

public float getDWbValue(int slice)
                  throws ParameterNotSetException,
                         java.lang.IndexOutOfBoundsException
Description copied from interface: LoadableImage
Returns the diffusion-weighting b-value for one slice of this image.

Specified by:
getDWbValue in interface LoadableImage
Parameters:
slice - the slice number for which to return the b-value.
Returns:
the diffusion-weighting b-value for the specified slice of this image.
Throws:
ParameterNotSetException - if the b-value is not set.
java.lang.IndexOutOfBoundsException - if the slice number is bad for this image.

getDWGradientVector

public javax.vecmath.Vector3f getDWGradientVector(int slice)
                                           throws ParameterNotSetException,
                                                  java.lang.IndexOutOfBoundsException
Description copied from interface: LoadableImage
Returns the diffusion-weighting gradient-vector for one slice of this image.

Specified by:
getDWGradientVector in interface LoadableImage
Parameters:
slice - the slice number for which to return the gradient-vector.
Returns:
the diffusion-weighting gradient-vector for the specified slice of this image.
Throws:
ParameterNotSetException - if the gradient-vector is not set.
java.lang.IndexOutOfBoundsException - if the slice number is bad for this image.

getDWBMatrix

public float[] getDWBMatrix(int slice)
                     throws ParameterNotSetException,
                            java.lang.IndexOutOfBoundsException
Description copied from interface: LoadableImage
Returns the diffusion-weighting b-matrix for one slice of this image.

Specified by:
getDWBMatrix in interface LoadableImage
Parameters:
slice - the slice number for which to get the b-matrix.
Returns:
the diffusion-weighting b-matrix for this image if it is a magnetic resonance image. The 6 unique matrix elements are returned as a float[] with elements in the order bXX, bXY, bXZ, bYY, bYZ, bZZ
Throws:
ParameterNotSetException - if the b-matrix cannot be found, or if the modality used to collect the image doesn't have a b-matrix defined.
java.lang.IndexOutOfBoundsException

getModality

public Modality getModality()
Description copied from interface: LoadableImage
Returns the imaging modality with which this image was collected.

Specified by:
getModality in interface LoadableImage
Returns:
the Modality used to collect this image.

getPulseSequence

public java.lang.String getPulseSequence()
                                  throws ParameterNotSetException
Description copied from interface: LoadableImage
Returns the name of the pulse sequence with which this image was collected.

Specified by:
getPulseSequence in interface LoadableImage
Returns:
the name of the pulse sequence used to collect this image.
Throws:
ParameterNotSetException

getScanningSequence

public PulseSequenceType getScanningSequence()
                                      throws ParameterNotSetException
Description copied from interface: LoadableImage
Returns the DICOM Scanning Sequence with which this image was collected.

Specified by:
getScanningSequence in interface LoadableImage
Returns:
the DICOM Scanning Sequence used to collect this image.
Throws:
ParameterNotSetException

getSequenceVariant

public PulseSequenceVariant getSequenceVariant()
                                        throws ParameterNotSetException
Description copied from interface: LoadableImage
Returns the DICOM Scanning Sequence Variant with which this image was collected.

Specified by:
getSequenceVariant in interface LoadableImage
Returns:
the DICOM Scanning Sequence Variant used to collect this image.
Throws:
ParameterNotSetException

getScanTR

public float getScanTR()
                throws ParameterNotSetException
Description copied from interface: LoadableImage
Returns the scan repetition time for this image.

Specified by:
getScanTR in interface LoadableImage
Returns:
the scan TR for this image.
Throws:
ParameterNotSetException - if the TR is not set.

getScanTI

public float getScanTI()
                throws ParameterNotSetException
Description copied from interface: LoadableImage
Returns the scan inversion time for this image.

Specified by:
getScanTI in interface LoadableImage
Returns:
the scan TI for this image.
Throws:
ParameterNotSetException - if the TI is not set.

getScanTE

public float getScanTE()
                throws ParameterNotSetException
Description copied from interface: LoadableImage
Returns the scan echo time for this image if it has a single echo-time.

Specified by:
getScanTE in interface LoadableImage
Returns:
the scan TE for this image.
Throws:
ParameterNotSetException - if the TE is not set.

getScanTE

public float getScanTE(int slice)
                throws ParameterNotSetException,
                       java.lang.IndexOutOfBoundsException
Description copied from interface: LoadableImage
Returns the scan echo time for one slice of this image.

Specified by:
getScanTE in interface LoadableImage
Parameters:
slice - the slice number for which to return the echo time.
Returns:
the scan TE for the specified slice of this image.
Throws:
ParameterNotSetException - if the TE is not set.
java.lang.IndexOutOfBoundsException - if the slice number is bad for this image.

getPatientName

public java.lang.String getPatientName()
Description copied from interface: LoadableImage
Returns the patient name for this image.

Specified by:
getPatientName in interface LoadableImage
Returns:
the patient name for this image, or null if the patient name can't be found.

getPatientID

public java.lang.String getPatientID()
Description copied from interface: LoadableImage
Returns the patient ID for this image.

Specified by:
getPatientID in interface LoadableImage
Returns:
the patientID for this image, or null if the patientID can't be found.

getPatientDoB

public java.util.Date getPatientDoB()
Description copied from interface: LoadableImage
Returns the patient date of birth for this image.

Specified by:
getPatientDoB in interface LoadableImage
Returns:
the patient's date of birth for this image, or null if the patient's dob can't be found.

getScanDate

public java.util.Date getScanDate()
Description copied from interface: LoadableImage
Returns the scan Date for this image.

Specified by:
getScanDate in interface LoadableImage
Returns:
the date/time at which this scan was performed, or null if the scan date can't be found.

getPatientPosition

public PatientPosition getPatientPosition()
Description copied from interface: LoadableImage
Returns the position in which the patient is lying in the scanning equipment. For example, PatientPosition.HFS (head-first supine).

Specified by:
getPatientPosition in interface LoadableImage
Returns:
the position in which the patient is lying in the scanning equipment.

getMostLikePlane

public MostLikePlane getMostLikePlane()
Description copied from interface: LoadableImage
Returns the imaging plane that this image is "most like".

Specified by:
getMostLikePlane in interface LoadableImage
Returns:
the plane that is "most" like the imaging plane for this image. Returns MostLikePlane.UNKNOWN if the imaging plane cannot be determined, or if the image does not contain a set of parallel slices.

getDescription

public java.lang.String getDescription()
Description copied from interface: LoadableImage
Returns a String description of this image.

Specified by:
getDescription in interface LoadableImage
Returns:
a String describing this image.

getDescription

public java.lang.String getDescription(int slice)
                                throws java.lang.IndexOutOfBoundsException
Description copied from interface: LoadableImage
Returns a description of a slice of this image.

Specified by:
getDescription in interface LoadableImage
Parameters:
slice - the slice number. o
Returns:
a String describing this image slice.
Throws:
java.lang.IndexOutOfBoundsException - if the slice number is bad for this image.

getHTMLDescription

public java.lang.String getHTMLDescription()
Description copied from interface: LoadableImage
Returns a String description of this image in HTML format.

Specified by:
getHTMLDescription in interface LoadableImage
Returns:
a String describing this image.

getHTMLDescription

public java.lang.String getHTMLDescription(int slice)
                                    throws java.lang.IndexOutOfBoundsException
Description copied from interface: LoadableImage
Returns a String description of a slice of this image in HTML format.

Specified by:
getHTMLDescription in interface LoadableImage
Parameters:
slice - the slice number.
Returns:
a String describing this image slice.
Throws:
java.lang.IndexOutOfBoundsException - if the slice is bad for this image.

getRescaleUnits

public java.lang.String getRescaleUnits()
Description copied from interface: LoadableImage
Specifies the output units of Intensity Rescale Slope and Intensity Rescale Intercept, retrieved by getIntensityRescale().

Specified by:
getRescaleUnits in interface LoadableImage
Returns:
a String describing the physical meaning of the pixel intensity units. Returns the String "arbitrary units" if the physical meaning is unknown, or arbitrary.

getIntensityRescale

public float[] getIntensityRescale()
                            throws ParameterNotSetException
Description copied from interface: LoadableImage
Returns the values m and b in the relationship between pixel intensity (I) values and the output units specified in getRescaleUnits() in the expression:
Output units = m*I + b.

Specified by:
getIntensityRescale in interface LoadableImage
Returns:
an array will be of length 2 where the first element is m and the second is b.
Throws:
ParameterNotSetException - if a single rescaling has not been set for the whole image.

getIntensityRescale

public float[] getIntensityRescale(int slice)
                            throws ParameterNotSetException,
                                   java.lang.IndexOutOfBoundsException
Description copied from interface: LoadableImage
Returns the values m and b in the relationship between pixel intensity (I) values and the output units specified in getRescaleUnits() in the expression:
Output units = m*I + b
for a particular slice.

Specified by:
getIntensityRescale in interface LoadableImage
Parameters:
slice - a slice number for which to retrieve the rescaling values.
Returns:
an array will be of length 2 where the first element is m and the second is b, for the specified slice.
Throws:
ParameterNotSetException - if a single rescaling has not been set for the image slice.
java.lang.IndexOutOfBoundsException - the slice number is bad for this image.

getFrameOfReferenceUID

public com.xinapse.dicom.Uid getFrameOfReferenceUID()
Description copied from interface: LoadableImage
Returns the frame of reference UID that uniquely identifies the frame of reference for an image.

Specified by:
getFrameOfReferenceUID in interface LoadableImage
Returns:
the frame of reference UID, or null if this image does not have frame of reference UID.

getImageOrientationPatient

public javax.vecmath.Vector3f[] getImageOrientationPatient()
Description copied from interface: LoadableImage
Returns the direction cosines of the row, column and slice directions (for increasing row, column and slice) of the image, in patient (L,P,S) coordinates.

Specified by:
getImageOrientationPatient in interface LoadableImage
Returns:
a Point3f[], corresponding to the direction cosines of the image row, column and slice directions in Left,Posterior,Superior (LPS) coordinates. Returns null if the direction cosines cannot be retrieved from this image.

getImageOrientationPatient

public javax.vecmath.Vector3f[] getImageOrientationPatient(int slice)
Description copied from interface: LoadableImage
Returns the direction cosines of the row, column and slice directions (for increasing row, column and slice) of the image, in patient coordinates.

Specified by:
getImageOrientationPatient in interface LoadableImage
Parameters:
slice - the slice for which to return the image orientation.
Returns:
a Point3f[], corresponding to the direction cosines of the image row, column and slice directions in Left,Posterior,Superior (LPS) coordinates. Returns null if the direction cosines cannot be retrieved from this image.

getImagePositionPatient

public javax.vecmath.Point3f getImagePositionPatient()
Description copied from interface: LoadableImage
Returns the coordinates of the center of the first pixel of the image, in mm, in patient coordinates. This method will only return if the image pixels form a regular array of pixels with parallel image planes; otherwise a ParameterNotSetException is thrown.

Specified by:
getImagePositionPatient in interface LoadableImage
Returns:
the Left,Posterior,Superior (LPS) coordinates of the first pixel in the image data matrix. Returns null if the position cannot be retrieved from this image.

getImagePositionPatient

public javax.vecmath.Point3f getImagePositionPatient(int slice)
                                              throws java.lang.IndexOutOfBoundsException
Description copied from interface: LoadableImage
Returns the coordinates of the center of the first pixel of the specified slice of this image, in mm, in patient coordinates.

Specified by:
getImagePositionPatient in interface LoadableImage
Returns:
the Left,Posterior,Superior (LPS) coordinates of the first pixel in the specified slice of this image. Returns null if the position cannot be retrieved from this image.
Throws:
java.lang.IndexOutOfBoundsException - if the slice number is bad for this image.

getImageCentrePatient

public static javax.vecmath.Point3f getImageCentrePatient(LoadableImage image)
                                                   throws InvalidImageException
Returns the coordinates of the center of the block of slices of an image, in mm, in patient coordinates.

Parameters:
image - the image for which to find the centre location.
Returns:
a the Point3f corresponding to the Left,Posterior,Superior (LPS) coordinates of the centre of the block of slices for the image. Returns null if the position cannot be retrieved from the image.
Throws:
InvalidImageException - if the image is invalid.

getSlicesAreReversed

public static boolean getSlicesAreReversed(LoadableImage image)
Tests whether the supplied image has slices which are in reverse order compared to standard radiological presentation order.

Parameters:
image - the image for which to test the slice order.
Returns:
true if the slices are in reverse order compared to standard radiological presentation order; false otherwise.

getImageClass

public java.lang.Class getImageClass()
Returns the class of image that this LoadedImage was loaded from, e.g. com.xinapse.multisliceimage.UNC.

Returns:
the class of image that this LoadedImage was loaded from.

saveAs

public void saveAs(java.lang.Class outputImageClass,
                   java.lang.String fileName)
            throws InvalidImageException,
                   java.io.IOException,
                   CancelledException
Saves this LoadedImage to a specfied class of multi-dimensional image.

Parameters:
outputImageClass - the class of the output image (e.g., com.xinapse.multisliceimage.Analyze75Image.class).
fileName - the name of the disk file to which the image wil be saved.
Throws:
InvalidImageException - if the image cannot be created.
java.io.IOException - if an I/O error occurs during the save to disk.
CancelledException - if the save operation is cancelled.

saveAs

public void saveAs(java.lang.Class outputImageClass,
                   java.lang.String fileName,
                   PixelDataType savePixelDataType,
                   ComplexMode complexMode,
                   java.awt.Component parentComponent)
            throws InvalidImageException,
                   java.io.IOException,
                   CancelledException
Saves this LoadedImage to a specfied class of multi-dimensional image, possibly changing the pixel data type.

Parameters:
outputImageClass - the class of the output image (e.g., com.xinapse.multisliceimage.Analyze75Image.class).
fileName - the name of the disk file to which the image wil be saved.
savePixelDataType - the PixelDataType with which the image will be saved.
complexMode - the ComplexMode if this is a Complex image, and the savePixelDataType is not complex.
parentComponent - if nonnull, a java.awt.Component used when positioning pop-up message dialogs.
Throws:
InvalidImageException - if the image cannot be created.
java.io.IOException - if an I/O error occurs during the save to disk.
CancelledException - if the save operation is cancelled.

getROIs

public java.util.List<ROI> getROIs()
                            throws java.io.IOException
Description copied from interface: LoadableImage
Returns a List of ROIs that are stored with the image.

Specified by:
getROIs in interface LoadableImage
Returns:
null if there are no ROIs stored with the image.
Throws:
java.io.IOException - if an I/O error occurs while reading the ROIs.


Copyright 2006-2011 Xinapse Systems Limited. All Rights Reserved.