|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.xinapse.loadableimage.LoadedImage
public class LoadedImage
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 |
|---|
protected javax.vecmath.Point3f imagePositionPatient
protected javax.vecmath.Vector3f[] imageOrientationPatient
protected javax.vecmath.Point3f[] sliceImagePositionPatient
protected javax.vecmath.Vector3f[][] sliceImageOrientationPatient
| Constructor Detail |
|---|
protected LoadedImage(java.util.List<com.xinapse.importimage.ImportableImage> impImages,
com.xinapse.importimage.TimePointSplitType splitType,
boolean anonymised)
throws com.xinapse.importimage.ImageCreationException
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.
com.xinapse.importimage.ImageCreationException - if the LoadableImage cannot be created from the List of
ImportableImages.
public LoadedImage(LoadableImage im,
MessageShower messageShower)
throws InvalidImageException,
CancelledException
im - the image to load.messageShower - the component that will display any error and warning messages.
InvalidImageException - if the LoadableImage is invalid.
CancelledException - if the loading of the LoadableImage is cancelled.| Method Detail |
|---|
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
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:
anonymised - if true the patient name is anonymised.
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
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
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:
anonymised - if true the patient name is anonymised.
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
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
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:
anonymised - if true the patient name is anonymised.
com.xinapse.importimage.ImageCreationException - if an LoadedImage cannot be created from the input files,
of if the splitType is not one of the above.public PixelDataType getPixelDataType()
LoadableImage
getPixelDataType in interface LoadableImagepublic int getNDim()
LoadableImage
getNDim in interface LoadableImagepublic int getNCols()
LoadableImage
getNCols in interface LoadableImagepublic int getNRows()
LoadableImage
getNRows in interface LoadableImagepublic int getNSlices()
LoadableImage
getNSlices in interface LoadableImagepublic int getNFrames()
LoadableImage
getNFrames in interface LoadableImagepublic int getTotalNSlices()
LoadableImage
getTotalNSlices in interface LoadableImage
public java.lang.Object getPix()
throws InvalidImageException
LoadableImage
getPix in interface LoadableImageInvalidImageException - if there is a problem accessing the pixel values.
public java.lang.Object getPix(boolean radiological)
throws InvalidImageException
LoadableImage
getPix in interface LoadableImageradiological - 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.
InvalidImageException - if there is a problem accessing the pixel values.
public java.lang.Object getSlice(int slice)
throws InvalidImageException,
java.lang.IndexOutOfBoundsException
LoadableImageN.B.The pixel values are always returned in a standard radiological orientation. Standard radiological orientation is:
getSlice in interface LoadableImageslice - 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.
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.
public void appendAuditInfo(java.lang.String name,
java.lang.String value)
LoadableImage
appendAuditInfo in interface LoadableImagename - 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.
public java.lang.Double getMin()
throws InvalidImageException
LoadableImage
getMin in interface LoadableImageInvalidImageException - if the intensity cannot be returned as a Double.
public java.lang.Double getMax()
throws InvalidImageException
LoadableImage
getMax in interface LoadableImageInvalidImageException - if the intensity cannot be returned as a Double.public ColourMapping getNativeColourMapping()
LoadableImage
getNativeColourMapping in interface LoadableImagepublic void close()
LoadableImage
close in interface LoadableImagepublic boolean isOpen()
LoadableImage
isOpen in interface LoadableImagepublic java.lang.String getTitle()
LoadableImage
getTitle in interface LoadableImagepublic java.lang.String getSuggestedFileName()
LoadableImage
getSuggestedFileName in interface LoadableImage
public float getPixelXSize()
throws ParameterNotSetException
LoadableImage
getPixelXSize in interface LoadableImageParameterNotSetException - if the pixel size can't be found.
public float getPixelYSize()
throws ParameterNotSetException
LoadableImage
getPixelYSize in interface LoadableImageParameterNotSetException - if the pixel size can't be found.
public float getPixelZSize()
throws ParameterNotSetException
LoadableImage
getPixelZSize in interface LoadableImageParameterNotSetException - if the pixel size can't be found.
public float getTimeBetweenFrames()
throws ParameterNotSetException
LoadableImage
getTimeBetweenFrames in interface LoadableImageParameterNotSetException - if the time between frames is not set, or if this
image doesn't have a dimensionality of at least 4.
public float getSliceThickness()
throws ParameterNotSetException
LoadableImage
getSliceThickness in interface LoadableImageParameterNotSetException - if the slice thickness is not set, or its value is corrupt.
public float getFlipAngle()
throws ParameterNotSetException
LoadableImage
getFlipAngle in interface LoadableImageParameterNotSetException - if the flip angle is not set.
public float getDWbValue(int slice)
throws ParameterNotSetException,
java.lang.IndexOutOfBoundsException
LoadableImage
getDWbValue in interface LoadableImageslice - the slice number for which to return the b-value.
ParameterNotSetException - if the b-value is not set.
java.lang.IndexOutOfBoundsException - if the slice number is bad for this image.
public javax.vecmath.Vector3f getDWGradientVector(int slice)
throws ParameterNotSetException,
java.lang.IndexOutOfBoundsException
LoadableImage
getDWGradientVector in interface LoadableImageslice - the slice number for which to return the gradient-vector.
ParameterNotSetException - if the gradient-vector is not set.
java.lang.IndexOutOfBoundsException - if the slice number is bad for this image.
public float[] getDWBMatrix(int slice)
throws ParameterNotSetException,
java.lang.IndexOutOfBoundsException
LoadableImage
getDWBMatrix in interface LoadableImageslice - the slice number for which to get the b-matrix.
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.IndexOutOfBoundsExceptionpublic Modality getModality()
LoadableImage
getModality in interface LoadableImage
public java.lang.String getPulseSequence()
throws ParameterNotSetException
LoadableImage
getPulseSequence in interface LoadableImageParameterNotSetException
public PulseSequenceType getScanningSequence()
throws ParameterNotSetException
LoadableImage
getScanningSequence in interface LoadableImageParameterNotSetException
public PulseSequenceVariant getSequenceVariant()
throws ParameterNotSetException
LoadableImage
getSequenceVariant in interface LoadableImageParameterNotSetException
public float getScanTR()
throws ParameterNotSetException
LoadableImage
getScanTR in interface LoadableImageParameterNotSetException - if the TR is not set.
public float getScanTI()
throws ParameterNotSetException
LoadableImage
getScanTI in interface LoadableImageParameterNotSetException - if the TI is not set.
public float getScanTE()
throws ParameterNotSetException
LoadableImage
getScanTE in interface LoadableImageParameterNotSetException - if the TE is not set.
public float getScanTE(int slice)
throws ParameterNotSetException,
java.lang.IndexOutOfBoundsException
LoadableImage
getScanTE in interface LoadableImageslice - the slice number for which to return the echo time.
ParameterNotSetException - if the TE is not set.
java.lang.IndexOutOfBoundsException - if the slice number is bad for this image.public java.lang.String getPatientName()
LoadableImage
getPatientName in interface LoadableImagepublic java.lang.String getPatientID()
LoadableImage
getPatientID in interface LoadableImagepublic java.util.Date getPatientDoB()
LoadableImage
getPatientDoB in interface LoadableImagepublic java.util.Date getScanDate()
LoadableImage
getScanDate in interface LoadableImagepublic PatientPosition getPatientPosition()
LoadableImage
getPatientPosition in interface LoadableImagepublic MostLikePlane getMostLikePlane()
LoadableImage
getMostLikePlane in interface LoadableImagepublic java.lang.String getDescription()
LoadableImage
getDescription in interface LoadableImage
public java.lang.String getDescription(int slice)
throws java.lang.IndexOutOfBoundsException
LoadableImage
getDescription in interface LoadableImageslice - the slice number.
o
java.lang.IndexOutOfBoundsException - if the slice number is bad for this image.public java.lang.String getHTMLDescription()
LoadableImage
getHTMLDescription in interface LoadableImage
public java.lang.String getHTMLDescription(int slice)
throws java.lang.IndexOutOfBoundsException
LoadableImage
getHTMLDescription in interface LoadableImageslice - the slice number.
java.lang.IndexOutOfBoundsException - if the slice is bad for this image.public java.lang.String getRescaleUnits()
LoadableImage
getRescaleUnits in interface LoadableImage
public float[] getIntensityRescale()
throws ParameterNotSetException
LoadableImage
getIntensityRescale in interface LoadableImageParameterNotSetException - if a single rescaling has not been set for
the whole image.
public float[] getIntensityRescale(int slice)
throws ParameterNotSetException,
java.lang.IndexOutOfBoundsException
LoadableImage
getIntensityRescale in interface LoadableImageslice - a slice number for which to retrieve the rescaling values.
ParameterNotSetException - if a single rescaling has not been set for
the image slice.
java.lang.IndexOutOfBoundsException - the slice number is bad for this image.public com.xinapse.dicom.Uid getFrameOfReferenceUID()
LoadableImage
getFrameOfReferenceUID in interface LoadableImagepublic javax.vecmath.Vector3f[] getImageOrientationPatient()
LoadableImage
getImageOrientationPatient in interface LoadableImagepublic javax.vecmath.Vector3f[] getImageOrientationPatient(int slice)
LoadableImage
getImageOrientationPatient in interface LoadableImageslice - the slice for which to return the image orientation.
public javax.vecmath.Point3f getImagePositionPatient()
LoadableImage
getImagePositionPatient in interface LoadableImage
public javax.vecmath.Point3f getImagePositionPatient(int slice)
throws java.lang.IndexOutOfBoundsException
LoadableImage
getImagePositionPatient in interface LoadableImagejava.lang.IndexOutOfBoundsException - if the slice number is bad for this image.
public static javax.vecmath.Point3f getImageCentrePatient(LoadableImage image)
throws InvalidImageException
image - the image for which to find the centre location.
InvalidImageException - if the image is invalid.public static boolean getSlicesAreReversed(LoadableImage image)
image - the image for which to test the slice order.
public java.lang.Class getImageClass()
public void saveAs(java.lang.Class outputImageClass,
java.lang.String fileName)
throws InvalidImageException,
java.io.IOException,
CancelledException
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.
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.
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
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.
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.
public java.util.List<ROI> getROIs()
throws java.io.IOException
LoadableImage
getROIs in interface LoadableImagejava.io.IOException - if an I/O error occurs while reading the ROIs.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||