com.xinapse.multisliceimage.UNC
Class UNCImage

java.lang.Object
  extended by com.xinapse.multisliceimage.MultiSliceImage
      extended by com.xinapse.multisliceimage.UNC.UNCImage
All Implemented Interfaces:
LoadableImage, InfoStorer, java.lang.Cloneable

public class UNCImage
extends MultiSliceImage
implements InfoStorer

This class is a representation of a multi-dimensional image in the University of North Carolina (UNC) format. A UNCImage object may be either purely held in memory, or may have its pixel data kept on disk. Note that only big-endian byte ordering is implemented and supported.


Field Summary
static boolean DEFAULT_OVERWRITE
          The default setting for the whether UNC images can be overwritten.
static int N_DIMV
          The maximum dimensionality of an image.
static int N_HISTOGRAM
          The number of entries in an image histogram
 
Fields inherited from class com.xinapse.multisliceimage.MultiSliceImage
AUDIT_TRAIL_ACTION_TEXT, BIRTH_DATE_NAME, COLOUR_MAPPING_NAME, DEFAULT_IMAGE_CLASS, DW_B_MATRIX_NAME, DW_B_VALUE_NAME, DW_GRADIENT_VECTOR_NAME, ECHO_TIME_NAME, FLIP_ANGLE_NAME, FRAME_OF_REFERENCE_UID_NAME, IMAGE_ORIENTATION_PATIENT_NAME, IMAGE_POSITION_PATIENT_NAME, INTENSITY_RESCALE_INTERCEPT_NAME, INTENSITY_RESCALE_SLOPE_NAME, INTENSITY_RESCALE_UNITS_NAME, INVERSION_TIME_NAME, MAXDIM, MODALITY_NAME, mode, PATIENT_ID_NAME, PATIENT_NAME_NAME, PATIENT_POSITION_NAME, pixArray, PIXEL_SPACING_NAME, PIXEL_X_SIZE_NAME, PIXEL_Y_SIZE_NAME, PIXEL_Z_SIZE_NAME, PULSE_SEQUENCE_NAME, randomAccessFile, REPETITION_TIME_NAME, SCAN_DATE_NAME, SCANNING_SEQUENCE_NAME, SEQUENCE_VARIANT_NAME, SLICE_THICKNESS_NAME, TIME_BETWEEN_FRAMES_NAME
 
Constructor Summary
UNCImage(java.io.DataInputStream s, boolean skipPixelData)
          Creates an in-memory UNCImage, loading all information from the data input stream.
UNCImage(java.io.File f, java.lang.String mode)
          Opens an existing disk-based UNC image.
UNCImage(java.io.File f, UNCPixFormat pixform, int dimc, int[] dimv)
          Creates a disk-based UNCImage with the given type of pixel and dimensions.
UNCImage(java.io.InputStream s)
          Creates an in-memory UNCImage, loading information from an input stream.
UNCImage(java.io.InputStream s, boolean skipPixelData)
          Creates an in-memory UNCImage, loading information from the input stream.
UNCImage(java.lang.String filename, java.lang.String mode)
          Opens an existing disk-based UNC image.
UNCImage(java.lang.String filename, UNCPixFormat pixform, int dimc, int[] dimv)
          Creates a disk-based UNCImage with the given type of pixel and dimensions.
UNCImage(UNCPixFormat pixform, int dimc, int[] dimv)
          Creates an in-memory UNCImage with the given type of pixel and dimensions.
UNCImage(java.net.URL url)
          Creates an in-memory UNCImage, loading all information from a URL.
UNCImage(java.net.URL url, boolean skipPixelData)
          Creates an in-memory UNCImage, loading information from a URL.
 
Method Summary
 void appendAuditInfo(java.lang.String name, java.lang.String value)
          Appends audit trail information to this image.
 void appendInfoList(InfoList list)
          Appends an InfoList to the existing general file info of this image.
 void appendInfoList(InfoList list, int dim, int n)
          Appends an InfoList to that existing for a specific dimension of this image.
 UNCImage clone()
          Creates an in-memory copy of a UNCImage.
 void close()
          Closes a UNCImage and frees up resources.
 void copyInfo(UNCImage toImage)
          Copies all the info fields to another image.
 java.nio.ByteOrder getByteOrder()
          Returns the byte order for this image.
 int getBytesPerPixel()
          Returns the number of bytes per pixel for this image.
static java.lang.String getCommonName()
          Returns the common name for this type of image.
 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.
 int getDimc()
          Returns the dimensionality of this image.
 int[] getDims()
          Returns the MultiSliceImage dimensions of this image.
 int[] getDimv()
          Returns the dimensions 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.
 int getFileDataOffset()
          Returns the byte offset into the disk-based file format where pixel data begins.
 float getFlipAngle()
          Returns the excitation pulse flip angle for this 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.
 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.
 java.lang.String getInfo(java.lang.String name)
          Returns a string representing the value of this information item in the general image information.
 java.lang.String getInfo(java.lang.String name, int dim, int n)
          Returns a java.lang.String representing the value of this information item in a particular dimension of this image.
 InfoList getInfoList()
          Returns an InfoList object which is the general info for this image.
 InfoList getInfoList(int dim, int n)
          Returns an InfoList object applying to a particular dimension/element for this image.
 MultiSliceImage getInstance(java.lang.Class cl, int nSlices)
          Creates a new in-memory MultiSliceImage with the MultiSliceImage class given by the argument, possibly changing the number of slices in the image.
 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 modality with which this image was acquired.
 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 MultiSliceImage 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.
 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.
 UNCPixFormat getPixformat()
          Returns the pixel format (pixformat) of this image.
static boolean getPreferredOverwrite()
          Returns whether the user prefers to overwrite UNC images.
static PreviewIcon getPreviewIcon(java.io.File f)
          Returns the PreviewIcon for a UNC image, or null if the supplied File does not represent a UNC 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.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.String getSimpleName()
          Returns the simple name for this type of image - the String that should be seen by the users to identify this type of image.
 java.lang.String getSliceInfo(java.lang.String name, int slice)
          Returns a java.lang.String representing the value of this information item in a particular slice of this image.
 InfoList getSliceInfoList(int slice)
          Returns an InfoList object applying to a particular slice of this image.
 float getSliceThickness()
          Returns the slice thickness (in mm).
 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.
static boolean imageExists(java.lang.String filename)
          Tests whether a UNCImage with the given name already exists on disk.
 boolean isOpen()
          Tests whether this image is still open.
static boolean isUNCImage(java.io.File f)
          Returns true if the File is a UNC Image File.
static boolean isUNCImage(java.lang.String filename)
          Returns true if the filename is the name of a UNC Image file.
static boolean isUNCImage(java.net.URL url)
          Returns true if the URL produces a UNCImage input stream.
 void putInfo(java.lang.String name, float value)
          Adds an item to the general file info.
 void putInfo(java.lang.String name, float value, int dim, int n)
          Adds an item to the dimension-specific information.
 void putInfo(java.lang.String name, int value)
          Adds an item to the general file info.
 void putInfo(java.lang.String name, int value, int dim, int n)
          Adds an item to the dimension-specific information.
 void putInfo(java.lang.String name, java.lang.String value)
          Adds an item to the general file info.
 void putInfo(java.lang.String name, java.lang.String value, int dim, int n)
          Adds an item to the dimension-specific information.
 java.lang.Object putPix(java.lang.Object pix, int[] pixIdx)
          Puts a single pixel value to the image.
 void putPix(java.lang.Object array, int[] lowIdx, int[] highIdx)
          Put pixel values from a specified array to this image.
 void putSlice(java.lang.Object array, int slice)
          Puts the pixel values to one slice of an n-dimensional image, where n > 1.
 void putSliceInfo(InfoList infoList, int slice)
          Adds all the items in an InfoList to the slice-specific information.
 void putSliceInfo(java.lang.String name, java.lang.String value, int slice)
          Adds an item to the slice-specific information.
 void removeInfo(java.lang.String name)
          Removes an item from the general file information.
 void removeInfo(java.lang.String name, int dim, int n)
          Removes an item from the dimension-specific information.
static void savePreferredOverwrite(boolean b)
          Saves whether the user prefers to overwrite UNC images.
 void setDWBMatrix(float[] bMatrix, int slice)
          Sets the diffusion-weighting B-matrix for one slice of this image.
 void setDWbValue(float bValue, int slice)
          Sets the diffusion-weighting b-value for one slice of this image.
 void setDWGradientVector(javax.vecmath.Vector3f gradVec, int slice)
          Sets the diffusion-weighting gradient vector for one slice of this image.
 void setFlipAngle(float flipAngle)
          Sets the excitation pulse flip angle for this image.
 void setImageOrientationPatient(javax.vecmath.Vector3f[] dirCos, int slice)
          Sets the direction cosines of the row, column and slice directions (for increasing row, column and slice) of the image, in patient (LPS) coordinates.
 void setImageOrientationPositionPatient(javax.vecmath.Vector3f[] dirCos, javax.vecmath.Point3f position, boolean force)
          Sets the direction cosines of the row, column and slice directions of the image, the coordinates of the center of the first pixel of the image, in patient (LPS) coordinates.
 void setImagePositionPatient(javax.vecmath.Point3f position, int slice)
          Sets the coordinates of the center of the first pixel of the image, in mm, in patient (LPS) coordinates, for one slice of this image.
 void setInfoList(InfoList list)
          Sets a new InfoList to the general file info of this image.
 void setInfoList(InfoList list, int dim, int n)
          Sets a new InfoList a specific dimension of this image.
 void setIntensityRescale(float[] rescale)
          Sets the values m and b in the relationship between pixel intensity (I) values and the output units specified in setRescaleUnits() in the expression:
Output units = m*I + b.
 void setIntensityRescale(float[] rescale, int slice)
          Sets the values m and b in the relationship between pixel intensity (I) values and the output units specified in setRescaleUnits() in the expression:
Output units = m*I + b, for a particular slice.
 void setMinMax(int min, int max)
          Sets the min and max pixel intensity fields for this UNCImage.
 void setModality(Modality modality)
          Sets the modality with which this image was acquired.
 void setNativeColourMapping(ColourMapping colourMapping)
          Sets the ColourMapping for this image.
 void setPatientDoB(java.util.Date patientDoB)
          Sets the patient's date of birth for this image.
 void setPatientID(java.lang.String patientID)
          Sets the patient ID for this image.
 void setPatientName(java.lang.String patientName)
          Attempts to set the patient name for this image.
 void setPatientPosition(PatientPosition position)
          Sets the position in which the patient is lying in the scanning equipment for this MultiSliceImage.
 void setPixelSpacing(float[] spacing)
          Sets the distance (in mm) between pixel centres in the row, column and slice directions of the image.
 void setPixelXSize(float width)
          Sets the pixel size in the x (horizontal) direction for this image.
 void setPixelYSize(float height)
          Sets the pixel size in the y (vertical) direction for this image.
 void setPixelZSize(float thickness)
          Sets the pixel size in the z (slice) direction for this image.
 void setPulseSequence(java.lang.String seqName)
          Sets the pulse sequence name for this image.
 void setRescaleUnits(java.lang.String unitsString)
          Sets the output units of Intensity Rescale Slope and Intensity Rescale Intercept, retrieved by getIntensityRescale().
 void setScanDate(java.util.Date scanDate)
          Sets the scan date/time for this image.
 void setScanningSequence(PulseSequenceType seq)
          Sets the DICOM scanning sequence for this image.
 void setScanTE(float TE)
          Sets the scan echo time for this image, for single-echo-time images.
 void setScanTE(float TE, int slice)
          Sets the scan echo time for one slice of this image.
 void setScanTI(float TI)
          Sets the scan inversion time for this image.
 void setScanTR(float TR)
          Sets the scan repetition time for this image.
 void setSequenceVariant(PulseSequenceVariant seqVar)
          Sets the DICOM scanning sequence variant for this image.
 void setSliceInfoList(InfoList list, int slice)
          Sets a new InfoList a specific slice of this image.
 void setSliceThickness(float thickness)
          Sets the slice thickness (in mm).
 void setTimeBetweenFrames(float deltaT)
          Sets the time between frames in a 4- or higher dimensional image.
 void setTitle(java.lang.String newTitle)
          Sets the title of this image.
 java.lang.String toHTML()
          Returns an HTML string describing this image.
 java.lang.String toString()
          Returns a string describing this image.
 void write(java.io.DataOutputStream s)
          Writes this UNCImage to a DataOutputStream.
 java.lang.String write(java.lang.String filename)
          Writes this image to a disk-file given by the name.
 MultiSliceImage write(java.lang.String filename, java.lang.Class cl)
          Writes this image to a disk-file given by the filename, in one of the MultiSliceImage sub-class image formats.
 
Methods inherited from class com.xinapse.multisliceimage.MultiSliceImage
autoResample, checkMinMax, crop, deleteImage, exists, export, export, export, getClasses, getDateFormat, getFrameOfReferenceUID, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getMostLikePlane, getNPixels, getPix, getPix, getPix, getPix, getPix, getPreferredImageClass, getPreview, getROIs, getScanDateFormat, getSlice, getSlice, getSliceDim, getSuggestedFileName, isImage, isModified, main, pad, parseMultiValuedString, putPix, putPix, reorient, reorientRadiological, reSample, reSample, savePreferredImageClass, set3DBlockParameters, setMinMax, setModified, setOrientationPositionRadiological, setSuggestedFileName, toBufferedImage
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_OVERWRITE

public static final boolean DEFAULT_OVERWRITE
The default setting for the whether UNC images can be overwritten.

See Also:
Constant Field Values

N_DIMV

public static final int N_DIMV
The maximum dimensionality of an image.

See Also:
Constant Field Values

N_HISTOGRAM

public static final int N_HISTOGRAM
The number of entries in an image histogram

See Also:
Constant Field Values
Constructor Detail

UNCImage

public UNCImage(java.lang.String filename,
                UNCPixFormat pixform,
                int dimc,
                int[] dimv)
         throws MultiSliceImageException,
                java.io.IOException
Creates a disk-based UNCImage with the given type of pixel and dimensions. dimc should be greater that 1 and less than or equal to nDIMV.

Parameters:
filename - the name of the file to be created.
pixform - the type of image to be created (e.g. UNCPixFormat.GREY).
dimc - the dimensionality of the image.
dimv - an array of length at least dimc containing the number of picture elements in each dimension. For example, in a 3-dimensional image, dimv[0] is the number of slices, dimv[1] the number of rows, and dimv[2] the number of columns.
Throws:
MultiSliceImageException - if the image cannot be created.
java.io.IOException - if an I/O error occurs.

UNCImage

public UNCImage(java.io.File f,
                UNCPixFormat pixform,
                int dimc,
                int[] dimv)
         throws MultiSliceImageException,
                java.io.IOException
Creates a disk-based UNCImage with the given type of pixel and dimensions. dimc should be greater that 1 and less than or equal to nDIMV.

Parameters:
f - is File Object representing the path of the file to be created.
pixform - the type of image to be created (e.g. UNCPixFormat.GREY).
dimc - the dimensionality of the image.
dimv - an array of length at least dimc containing the number of picture elements in each dimension. For example, in a 3-dimensional image, dimv[0] is the number of slices, dimv[1] the number of rows, and dimv[2] the number of columns.
Throws:
MultiSliceImageException - if the image cannot be created.
java.io.IOException - if an I/O error occurs.

UNCImage

public UNCImage(UNCPixFormat pixform,
                int dimc,
                int[] dimv)
         throws MultiSliceImageException
Creates an in-memory UNCImage with the given type of pixel and dimensions. dimc should be greater that 1 and less than or equal to nDIMV.

Parameters:
pixform - the type of image to be created (e.g. UNCPixFormat.GREY).
dimc - the dimensionality of the image.
dimv - an array of length at least dimc containing the number of picture elements in each dimension. For example, in a 3-dimensional image, dimv[0] is the number of slices, dimv[1] the number of rows, and dimv[2] the number of columns.
Throws:
MultiSliceImageException - if the image cannot be created.

UNCImage

public UNCImage(java.net.URL url)
         throws MultiSliceImageException,
                UNCException,
                java.io.IOException
Creates an in-memory UNCImage, loading all information from a URL.

Parameters:
url - the URL that will give a UNC image data stream.
Throws:
MultiSliceImageException - if the image cannot be loaded.
UNCException - if the image cannot be loaded for UNC-specific reasons.
java.io.IOException - if an I/O error occurs while loading the image.

UNCImage

public UNCImage(java.net.URL url,
                boolean skipPixelData)
         throws MultiSliceImageException,
                UNCException,
                java.io.IOException
Creates an in-memory UNCImage, loading information from a URL. Optionally skips loading of the pixel data into memory. If skipPixelData is true, then the pixel data will not be accessible.

Parameters:
url - the URL that will give a UNC image data stream.
skipPixelData - if true then pixel data is not loaded and cannot later be accessed.
Throws:
MultiSliceImageException - if the image cannot be loaded.
UNCException - if the image cannot be loaded for UNC-specific reasons.
java.io.IOException - if an I/O error occurs while loading the image.

UNCImage

public UNCImage(java.lang.String filename,
                java.lang.String mode)
         throws MultiSliceImageException,
                java.io.IOException,
                java.io.FileNotFoundException
Opens an existing disk-based UNC image.

Parameters:
filename - the name of the image file.
mode - the open mode. Can be either "r" (read-only) or "rw" (read-write).
Throws:
MultiSliceImageException - if the mode is invalid or the image cannot be read.
java.io.FileNotFoundException - if the image file doesn't exist.
java.io.IOException - if an I/O error occurs.

UNCImage

public UNCImage(java.io.File f,
                java.lang.String mode)
         throws MultiSliceImageException,
                java.io.IOException,
                java.io.FileNotFoundException
Opens an existing disk-based UNC image.

Parameters:
f - a File object representing the path to this image file.
mode - the open mode. Can be either "r" (read-only) or "rw" (read-write).
Throws:
MultiSliceImageException - if the mode is invalid or the image cannot be read.
java.io.FileNotFoundException - if the image file doesn't exist.
java.io.IOException - if an I/O error occurs.

UNCImage

public UNCImage(java.io.InputStream s)
         throws MultiSliceImageException
Creates an in-memory UNCImage, loading information from an input stream.

Parameters:
s - the InputStream.
Throws:
UNCException - if the image cannot be loaded for UNC-specific reasons.
MultiSliceImageException - if the image cannot be loaded.

UNCImage

public UNCImage(java.io.InputStream s,
                boolean skipPixelData)
         throws MultiSliceImageException
Creates an in-memory UNCImage, loading information from the input stream. Optionally skips over loading of the pixel data.

Parameters:
s - the InputStream.
skipPixelData - if true then pixel data is not loaded and cannot later be accessed.
Throws:
MultiSliceImageException - if the image cannot be loaded.

UNCImage

public UNCImage(java.io.DataInputStream s,
                boolean skipPixelData)
         throws MultiSliceImageException
Creates an in-memory UNCImage, loading all information from the data input stream. Optionally skips over loading of the pixel data.

Parameters:
s - the DataInputStream.
skipPixelData - if true then pixel data is not loaded and cannot later be accessed.
Throws:
MultiSliceImageException - if the image cannot be loaded.
Method Detail

getByteOrder

public java.nio.ByteOrder getByteOrder()
Description copied from class: MultiSliceImage
Returns the byte order for this image.

Specified by:
getByteOrder in class MultiSliceImage
Returns:
the byte oder for this image, or null if the byte order is not defined yet (in-memory images only).

isUNCImage

public static boolean isUNCImage(java.net.URL url)
Returns true if the URL produces a UNCImage input stream. Returns false otherwise.

Parameters:
url - the URL to be tested
Returns:
true if the URL produces a UNCImage input stream; false otherwise.

getPreviewIcon

public static PreviewIcon getPreviewIcon(java.io.File f)
Returns the PreviewIcon for a UNC image, or null if the supplied File does not represent a UNC image.

Parameters:
f - the File to be tested.
Returns:
PreviewIcoo if the File produces a UNCImage; null otherwise.

imageExists

public static boolean imageExists(java.lang.String filename)
Tests whether a UNCImage with the given name already exists on disk.

Parameters:
filename - the name of the image file to test for existence.
Returns:
true if a UNCImage file with the specified name exists on disk; false otherwise.

isUNCImage

public static boolean isUNCImage(java.lang.String filename)
Returns true if the filename is the name of a UNC Image file. Returns false otherwise.

Parameters:
filename - the name of a file to be tested.
Returns:
true if a UNCImage file with the specified name exists on disk; false otherwise.

isUNCImage

public static boolean isUNCImage(java.io.File f)
Returns true if the File is a UNC Image File. Returns false otherwise.

Parameters:
f - the File to be tested.
Returns:
true if the File is a UNC Image File; false otherwise.

close

public void close()
           throws MultiSliceImageException
Closes a UNCImage and frees up resources. For in-memory UNCImages, this merely explicity frees resources so that the garbage collector can work more efficiently. However, for disk-based images it is essential to apply the close() method. Image data is written to disk during the put() methods, but other information - the title and the info fields are only written to disk by the close() method. If the close() method is not applied to a disk-based UNCImage, then any changes to the title and info fields will be lost. Any further operations to a closed UNCImage are not possible, and may cause an exception to be thrown.

Specified by:
close in interface LoadableImage
Throws:
MultiSliceImageException - if the file cannot be written or closed.

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.

write

public java.lang.String write(java.lang.String filename)
                       throws MultiSliceImageException
Description copied from class: MultiSliceImage
Writes this image to a disk-file given by the name.

Specified by:
write in class MultiSliceImage
Parameters:
filename - the file name.
Returns:
the actual file name with which the image was written, including any extension added by the particular image format.
Throws:
MultiSliceImageException - if the image cannot be written.

getPreferredOverwrite

public static boolean getPreferredOverwrite()
Returns whether the user prefers to overwrite UNC images.

Returns:
true if the user prefers to overwrite existsing UNC images; false if UNC will not be overwritten.

savePreferredOverwrite

public static void savePreferredOverwrite(boolean b)
Saves whether the user prefers to overwrite UNC images.

Parameters:
b - true if the user prefers to overwrite existsing UNC images; false if UNC are not to be overwritten.

write

public MultiSliceImage write(java.lang.String filename,
                             java.lang.Class cl)
                      throws java.io.IOException,
                             MultiSliceImageException
Description copied from class: MultiSliceImage
Writes this image to a disk-file given by the filename, in one of the MultiSliceImage sub-class image formats.

Specified by:
write in class MultiSliceImage
Parameters:
filename - the file name. If filename is null, then an in-memory MultiSliceImage will be returned.
cl - the class of image to be written (e.g. com.xinapse.multisliceimage.UNC.UNCImage).
Returns:
the MultiSliceImage that is written.
Throws:
java.io.IOException - if an I/O error occurs.
MultiSliceImageException - if the image cannot be written.

getInstance

public MultiSliceImage getInstance(java.lang.Class cl,
                                   int nSlices)
                            throws MultiSliceImageException,
                                   java.io.IOException
Description copied from class: MultiSliceImage
Creates a new in-memory MultiSliceImage with the MultiSliceImage class given by the argument, possibly changing the number of slices in the image. If the number of slices requested for the new image is is less than the original, only the first slices will be copied to the new image. If the number of slices requested for the new image is more than the original, the additional slices will be filled with zero pixel values, and the slice-specific information will be empty.

Specified by:
getInstance in class MultiSliceImage
Parameters:
cl - the class of image to be written (e.g. com.xinapse.multisliceimage.UNC.UNCImage.class).
nSlices - the number of slices in the image that is to be written.
Returns:
the new MultiSliceImage that is created.
Throws:
MultiSliceImageException - if the image cannot be written.
java.io.IOException - if an I/O error occurs.

write

public void write(java.io.DataOutputStream s)
           throws MultiSliceImageException
Writes this UNCImage to a DataOutputStream.

Parameters:
s - the DataOutputStream.
Throws:
MultiSliceImageException - if the image cannot be written.

getBytesPerPixel

public int getBytesPerPixel()
Returns the number of bytes per pixel for this image.

Returns:
the number of bytes per pixel.

toString

public java.lang.String toString()
Returns a string describing this image.

Overrides:
toString in class java.lang.Object
Returns:
a String that describes the image.

toHTML

public java.lang.String toHTML()
Returns an HTML string describing this image.

Returns:
a String that describes the image in HTML format.

setMinMax

public void setMinMax(int min,
                      int max)
               throws MultiSliceImageException
Sets the min and max pixel intensity fields for this UNCImage. Also sets the valid flag to true.

Specified by:
setMinMax in class MultiSliceImage
Parameters:
min - the minimum pixel value in the image.
max - the maximum pixel value in the image.
Throws:
MultiSliceImageException - if the image is read-only or if the supplied values are unsuitable for this image.

getDimc

public int getDimc()
Returns the dimensionality of this image.

Returns:
dimc, the dimensionality.

getNDim

public int getNDim()
Returns the MultiSliceImage dimensionality of this image.

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

getDimv

public int[] getDimv()
              throws java.lang.IllegalStateException
Returns the dimensions of this image. An integer array of length N_DIMV is returned with elements 0 to dimc-1 containing useful information about the numbers of pixels in each dimension of the image. The lowest array element contain the most slowly-varying image component. For example in a 3-dimensional image, dimv[0] is the number of slices, dimv[1] the number of rows, and dimv[2] the number of columns.

Returns:
dimc an array of image dimensions.
Throws:
java.lang.IllegalStateException - if there is something strange about the dimensionality of this image.

getDims

public int[] getDims()
              throws java.lang.IllegalStateException
Returns the MultiSliceImage dimensions of this image. An integer array dim is returned with elements 0 to getNDims() containing useful information about the numbers of pixels in each dimension of the image. The lowest array element contain the most slowly-varying image component. For example in a 3-dimensional image, dim[0] is the number of slices, dim[1] the number of rows, and dim[2] the number of columns.

Specified by:
getDims in class MultiSliceImage
Returns:
an array of image dimensions.
Throws:
java.lang.IllegalStateException - if there is something strange about the dimensionality of this image.

getPixformat

public UNCPixFormat getPixformat()
Returns the pixel format (pixformat) of this image. pixformat may be one of:
     UNCPixFormat.GREY           - a 16-bit short int image.
     UNCPixFormat.BYTE           - an 8-bit image.
     UNCPixFormat.SHORT          - also a 16-bit short int image.
     UNCPixFormat.LONG           - a 64-bit int image.
     UNCPixFormat.REAL           - a floating point image (32-bit).
     UNCPixFormat.COMPLEX        - real / imag pixel pairs in floating point format.
     UNCPixFormat.DOUBLE         - a double precision image (64-bit).
     UNCPixFormat.COLOR          - a 16-bit colour image.
     UNCPixFormat.COLORPACKED    - 4 times 8-bit image (r,g,b,alpha).
     UNCPixFormat.USERPACKED     - a 32-bit integer image.
     

Returns:
a UNCPixFormat representing a particular pixel format.

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.

getFileDataOffset

public int getFileDataOffset()
Returns the byte offset into the disk-based file format where pixel data begins.

Specified by:
getFileDataOffset in class MultiSliceImage
Returns:
the byte offset to the start of pixel data for images that are written to disk.

getTitle

public java.lang.String getTitle()
Returns the title of this image.

Specified by:
getTitle in interface LoadableImage
Returns:
the title String.

setTitle

public void setTitle(java.lang.String newTitle)
Sets the title of this image. If the new title String is longer than is allowed by the UNC format, then it is truncated before being applied. If the image is read-only, then this method does nothing.
N.B. For disk-based images, the changes in the title will not be reflected on disk unless the close() method is called.

Specified by:
setTitle in class MultiSliceImage
Parameters:
newTitle - the new title to be assigned to this image.

putPix

public void putPix(java.lang.Object array,
                   int[] lowIdx,
                   int[] highIdx)
            throws InvalidImageException
Description copied from class: MultiSliceImage
Put pixel values from a specified array to this image. array is an array of the correct type of element for this image from which pixel values will be copied; it must be cast to an Object and must have the right number of elements to copy to the pixel values requested. The lowIdx and highIdx int arrays should have at least nDim elements, and the elements specify the pixel number range for each dimension. For example, if an image has nDim = 3, and dims[] = {5, 256, 256}, then pixels for the middle slices 4 will be returned by setting lowIdx to {1, 0, 0} and highIdx to {4, 255, 255}.

Overrides:
putPix in class MultiSliceImage
Parameters:
array - a 1-dimensional array of pixel values of the correct java primitive data type to put to the image.
lowIdx - an array of int specifying the low index of pixel values to put.
highIdx - an array of int specifying the high index of pixel values to put.
Throws:
InvalidImageException - if the indices supplied extend beyond the image, the pixel values are of the wrong primitive data type or cannot be put for other reasons.

putPix

public java.lang.Object putPix(java.lang.Object pix,
                               int[] pixIdx)
                        throws InvalidImageException
Description copied from class: MultiSliceImage
Puts a single pixel value to the image.

Overrides:
putPix in class MultiSliceImage
Parameters:
pix - the pixel value to put, as a suitable Object.
pixIdx - an int[] of length at least equal to nDim for this image where each element corresponds to an index to the pixel in each dimension. The first element of pixIdx refers to the slowest-varying dimension, and the last relevant element refers to the fastest-varuing dimension. For example, for a 3-D image, pixIdx[0] refers to the slice dimension, and pixIdx[2] refers to the column dimension.
Returns:
the same pixel as supplied. Pixel must be of the correct type cast to an Object. For example, for a short int image, the pixel will be a Short cast to Object.
Throws:
InvalidImageException - if the indices are inappropriate for this image, if the supplied pixel is of the wrong Class, or if the pixel value cannot be written to the image.

putSlice

public void putSlice(java.lang.Object array,
                     int slice)
              throws InvalidImageException
Description copied from class: MultiSliceImage
Puts the pixel values to one slice of an n-dimensional image, where n > 1.

N.B.Whenever the radiological orientation of the image can be determined, this method sets pixel values such that when the slice is viewed on-screen, the first pixel in the array 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).

Overrides:
putSlice in class MultiSliceImage
Parameters:
array - a 1-dimensional array of the correct primitive java data type for this image, with dimensions [nRows * nCols] containing the pixel values to put.
slice - the slice number. Must be 0 for a 2-dimensional image or from 0 to dims[0]-1 for a 3-dimensional image.
Throws:
InvalidImageException - if the image does not have the right dimensionality, if the slice number is inappropriate for this image, if the array is not of the correct primitive data type for this image, or if there is a problem accessing the pixel values.

getInfo

public java.lang.String getInfo(java.lang.String name)
                         throws InfoNotFoundException
Description copied from interface: InfoStorer
Returns a string representing the value of this information item in the general image information.

For example, if there is a item with a name "pixel_x_size" and a value "0.91162" in the general info, and name "pixel_x_size" is supplied, then this method will return "0.91162".

Specified by:
getInfo in interface InfoStorer
Parameters:
name - the name of this information field.
Returns:
a java.lang.String representation of the value of this information field.
Throws:
InfoNotFoundException - if the name is not found in the general info.

putInfo

public void putInfo(java.lang.String name,
                    int value)
             throws java.io.IOException
Description copied from interface: InfoStorer
Adds an item to the general file info.
N.B. For disk-based images, the changes in the info will not be reflected on disk unless the close() method is called.

Specified by:
putInfo in interface InfoStorer
Parameters:
name - the name of the information field to put.
value - an integer value to be associated with this name in the general file information.
Throws:
java.io.IOException - if the information cannot be added.

putInfo

public void putInfo(java.lang.String name,
                    float value)
             throws java.io.IOException
Description copied from interface: InfoStorer
Adds an item to the general file info. If an info item with the same name exists, then then value will be overwritten.
N.B. For disk-based images, the changes in the info will not be reflected on disk unless the close() method is called.

Specified by:
putInfo in interface InfoStorer
Parameters:
name - the name of the information to put.
value - a floating point value to be associated with this name in the general file information.
Throws:
java.io.IOException - if the information cannot be addded.

putInfo

public void putInfo(java.lang.String name,
                    java.lang.String value)
             throws java.io.IOException
Description copied from interface: InfoStorer
Adds an item to the general file info. If an info item with the same name exists, then then value will be overwritten.
N.B. For disk-based images, the changes in the info will not be reflected on disk unless the close() method is called.

Specified by:
putInfo in interface InfoStorer
Parameters:
name - the name of the information to put.
value - a java.lang.String to be associated with this name in the general file information.
Throws:
java.io.IOException - if the information cannot be addded.

getInfo

public java.lang.String getInfo(java.lang.String name,
                                int dim,
                                int n)
                         throws InfoNotFoundException
Description copied from interface: InfoStorer
Returns a java.lang.String representing the value of this information item in a particular dimension of this image. For example, if there is a item "pixel_x_size=0.91162" in the file info for this dimension, and a name "pixel_x_size" is supplied, then this method will return "0.91162".

Specified by:
getInfo in interface InfoStorer
Parameters:
name - the name of this information item.
dim - the dimension of this image to look for the information. For example in a 3-dimensional image you would look in dimension 0 for slice-specific info.
n - the element to look in. For example in a 3-dimensional image you would look in slice n to info that applied only to slice n.
Returns:
a java.lang.String representation of the value of this information.
Throws:
InfoNotFoundException - if the name is not found in this dimension/element info.

getSliceInfo

public java.lang.String getSliceInfo(java.lang.String name,
                                     int slice)
                              throws InfoNotFoundException
Description copied from interface: InfoStorer
Returns a java.lang.String representing the value of this information item in a particular slice of this image.

The slice number is referenced from 0 to (total number of slice - 1) regardless of the number of samples in the "slice" dimension of the image.

Specified by:
getSliceInfo in interface InfoStorer
Parameters:
name - the name of this information item.
slice - the slice number.
Returns:
a java.lang.String representation of the value of this information.
Throws:
InfoNotFoundException - if the name is not found for the specified slice.

putInfo

public void putInfo(java.lang.String name,
                    int value,
                    int dim,
                    int n)
             throws java.io.IOException
Description copied from interface: InfoStorer
Adds an item to the dimension-specific information. If an info item with the same name exists, then then value will be overwritten.
N.B. For disk-based images, the changes in the info will not be reflected on disk unless the close() method is called.

Specified by:
putInfo in interface InfoStorer
Parameters:
name - the name of the information item to put.
value - an integer value to be associated with this name in the general file information.
dim - the dimension of this image to put the information item. For example in a 3-dimensional image you would put to dimension 0 for slice-specific info.
n - the element to put to. For example in a 3-dimensional image you would put to slice n to info that applied only to slice n.
Throws:
java.io.IOException - if the information cannot be addded.

putInfo

public void putInfo(java.lang.String name,
                    float value,
                    int dim,
                    int n)
             throws java.io.IOException
Description copied from interface: InfoStorer
Adds an item to the dimension-specific information. If an info item with the same name exists, then then value will be overwritten.
N.B. For disk-based images, the changes in the info will not be reflected on disk unless the close() method is called.

Specified by:
putInfo in interface InfoStorer
Parameters:
name - the name of the information item to put.
value - an floating-point value to be associated with this name in the dimension-specific information.
dim - the dimension of this image to put the information. For example in a 3-dimensional image you would put to dimension 0 for slice-specific info.
n - the element to put to. For example in a 3-dimensional image you would put to slice n to info that applied only to slice n.
Throws:
java.io.IOException - if the information cannot be addded.

putInfo

public void putInfo(java.lang.String name,
                    java.lang.String value,
                    int dim,
                    int n)
             throws java.io.IOException
Description copied from interface: InfoStorer
Adds an item to the dimension-specific information. If an info item with the same name exists, then then value will be overwritten.
N.B. For disk-based images, the changes in the info will not be reflected on disk unless the close() method is called.

Specified by:
putInfo in interface InfoStorer
Parameters:
name - the name of the information item to put.
value - a String value to be associated with this name in the dimension-specific information.
dim - the dimension of this image to put the information. For example in a 3-dimensional image you would put to dimension 0 for slice-specific info.
n - the element to put to. For example in a 3-dimensional image you would put to slice n to info that applied only to slice n.
Throws:
java.io.IOException - if the information cannot be addded.

putSliceInfo

public void putSliceInfo(InfoList infoList,
                         int slice)
                  throws java.io.IOException
Description copied from interface: InfoStorer
Adds all the items in an InfoList to the slice-specific information. If an info item with the same name exists, then then value will be overwritten.

The slice number is referenced from 0 to (total number of slice - 1) regardless of the number of samples in the "slice" dimension of the image.
N.B. For disk-based images, the changes in the info will not be reflected on disk unless the close() method is called.

Specified by:
putSliceInfo in interface InfoStorer
Parameters:
infoList - the list of InfoItems to put.
slice - the slice number.
Throws:
java.io.IOException - if the information cannot be added.

putSliceInfo

public void putSliceInfo(java.lang.String name,
                         java.lang.String value,
                         int slice)
                  throws java.io.IOException
Description copied from interface: InfoStorer
Adds an item to the slice-specific information. If an info item with the same name exists, then then value will be overwritten.

The slice number is referenced from 0 to (total number of slice - 1) regardless of the number of samples in the "slice" dimension of the image.
N.B. For disk-based images, the changes in the info will not be reflected on disk unless the close() method is called.

Specified by:
putSliceInfo in interface InfoStorer
Parameters:
name - the name of the information item to put.
value - a String to be associated with this name in the slice-specific info.
slice - the slice number.
Throws:
java.io.IOException - if the information cannot be added.

removeInfo

public void removeInfo(java.lang.String name)
                throws java.io.IOException
Description copied from interface: InfoStorer
Removes an item from the general file information. If an info item with the given name is not present in the general info, then this method does nothing.
N.B. For disk-based images, the changes in the info will not be reflected on disk unless the close() method is called.

Specified by:
removeInfo in interface InfoStorer
Parameters:
name - the name of the information item to be removed.
Throws:
java.io.IOException - if the information cannot be removed.

removeInfo

public void removeInfo(java.lang.String name,
                       int dim,
                       int n)
                throws java.io.IOException
Description copied from interface: InfoStorer
Removes an item from the dimension-specific information. If an info item with the given name is not present in the dimension-specific, then this method does nothing.
N.B. For disk-based images, the changes in the info will not be reflected on disk unless the close() method is called.

Specified by:
removeInfo in interface InfoStorer
Parameters:
name - the name of the information item to put.
dim - the dimension of this image to from which to remove the information. For example in a 3-dimensional image you would put to dimension 0 for slice-specific info.
n - the element to from which to remove the info item. For example in a 3-dimensional image you would put to slice n to info that applied only to slice n.
Throws:
java.io.IOException - if the information cannot be removed.

copyInfo

public void copyInfo(UNCImage toImage)
              throws MultiSliceImageException
Copies all the info fields to another image. The general info will be copied to the toImage, overwriting any pre-existing info. Depending on the dimensionality of the two images, the dimension-specific info may also be copied.

Parameters:
toImage - the UNCImage to which info will be copied.
Throws:
MultiSliceImageException - if the image is read-only.

getInfoList

public InfoList getInfoList()
Description copied from interface: InfoStorer
Returns an InfoList object which is the general info for this image.

Specified by:
getInfoList in interface InfoStorer
Returns:
an InfoList which is the general file info for this InfoStorer.

getInfoList

public InfoList getInfoList(int dim,
                            int n)
                     throws java.lang.IndexOutOfBoundsException
Description copied from interface: InfoStorer
Returns an InfoList object applying to a particular dimension/element for this image.

Specified by:
getInfoList in interface InfoStorer
Parameters:
dim - the dimension for which to get the information list.
n - the element for which to get the information list.
Returns:
an InfoList object from a particular dimension of this InfoStorer.
Throws:
java.lang.IndexOutOfBoundsException - if the dimensions supplied do not match this image.

getSliceInfoList

public InfoList getSliceInfoList(int slice)
                          throws java.lang.IndexOutOfBoundsException
Description copied from interface: InfoStorer
Returns an InfoList object applying to a particular slice of this image.

Specified by:
getSliceInfoList in interface InfoStorer
Parameters:
slice - the slice number.
Returns:
an InfoList object from a particular slice of this InfoStorer.
Throws:
java.lang.IndexOutOfBoundsException - if the slice supplied does not match this image.

setInfoList

public void setInfoList(InfoList list)
                 throws java.io.IOException
Description copied from interface: InfoStorer
Sets a new InfoList to the general file info of this image.

Specified by:
setInfoList in interface InfoStorer
Parameters:
list - the InfoList object to set to the general file info for this image.
Throws:
java.io.IOException - if the InfoList cannot be set.

setInfoList

public void setInfoList(InfoList list,
                        int dim,
                        int n)
                 throws java.io.IOException
Description copied from interface: InfoStorer
Sets a new InfoList a specific dimension of this image.

Specified by:
setInfoList in interface InfoStorer
Parameters:
list - the InfoList to associate with this image/dimension.
dim - the dimension to which to set the information list.
n - the element to which to set the information list.
Throws:
java.io.IOException - if the InfoList cannot be set.

setSliceInfoList

public void setSliceInfoList(InfoList list,
                             int slice)
                      throws java.io.IOException
Description copied from interface: InfoStorer
Sets a new InfoList a specific slice of this image.

Specified by:
setSliceInfoList in interface InfoStorer
Parameters:
list - the InfoList to associate with this image/slice.
slice - the slice for which to set the information list.
Throws:
java.io.IOException - if the InfoList cannot be set.

appendInfoList

public void appendInfoList(InfoList list)
                    throws java.io.IOException
Description copied from interface: InfoStorer
Appends an InfoList to the existing general file info of this image.

Specified by:
appendInfoList in interface InfoStorer
Parameters:
list - the InfoList object to append to the general file info for this image.
Throws:
java.io.IOException - if the InfoList cannot be appended.

appendInfoList

public void appendInfoList(InfoList list,
                           int dim,
                           int n)
                    throws MultiSliceImageException
Description copied from interface: InfoStorer
Appends an InfoList to that existing for a specific dimension of this image.

Specified by:
appendInfoList in interface InfoStorer
Parameters:
list - the InfoList to append.
dim - the dimension to which to append the information list.
n - the element to which to append the information list.
Throws:
MultiSliceImageException

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.

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.

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.

setPixelXSize

public void setPixelXSize(float width)
                   throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the pixel size in the x (horizontal) direction for this image.

Specified by:
setPixelXSize in class MultiSliceImage
Parameters:
width - the width of a pixel.
Throws:
java.io.IOException - if and I/O error occurs.

setPixelYSize

public void setPixelYSize(float height)
                   throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the pixel size in the y (vertical) direction for this image.

Specified by:
setPixelYSize in class MultiSliceImage
Parameters:
height - the height of a pixel.
Throws:
java.io.IOException - if an I/O error occurs.

setPixelZSize

public void setPixelZSize(float thickness)
                   throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the pixel size in the z (slice) direction for this image.

Specified by:
setPixelZSize in class MultiSliceImage
Parameters:
thickness - the thickness of a pixel.
Throws:
java.io.IOException - if an I/O error occurs.

setTimeBetweenFrames

public void setTimeBetweenFrames(float deltaT)
                          throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the time between frames in a 4- or higher dimensional image.

Specified by:
setTimeBetweenFrames in class MultiSliceImage
Parameters:
deltaT - the time between frames (in seconds).
Throws:
java.io.IOException - if an I/O error occurs.

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)
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.

setImagePositionPatient

public void setImagePositionPatient(javax.vecmath.Point3f position,
                                    int slice)
Description copied from class: MultiSliceImage
Sets the coordinates of the center of the first pixel of the image, in mm, in patient (LPS) coordinates, for one slice of this image.

Specified by:
setImagePositionPatient in class MultiSliceImage
Parameters:
position - the Left,Posterior,Superior (LPS) coordinates of the first pixel of this specified slice in the image data matrix.
slice - the slice for which to set the position.

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.

setImageOrientationPositionPatient

public void setImageOrientationPositionPatient(javax.vecmath.Vector3f[] dirCos,
                                               javax.vecmath.Point3f position,
                                               boolean force)
Description copied from class: MultiSliceImage
Sets the direction cosines of the row, column and slice directions of the image, the coordinates of the center of the first pixel of the image, in patient (LPS) coordinates.

N.B. the actual position and orientation set by this method may not be those specified. For example, for NIFTI-1 images, the actual orientation and position may depend on the user Preferences for whether to put pixel values in an order that is compatible with SPM. After using this method, you should use the getImageOrientationPatient() and getImagePositionPatient() methods to obtain the real orientation and positions set.

If the orientation or position cannot be set for this image, this method does not report an error.

Specified by:
setImageOrientationPositionPatient in class MultiSliceImage
Parameters:
dirCos - the direction cosines of the image row, column and (optionally) slice directions respectively in Left,Posterior,Superior (LPS) coordinates. If dirCos is null, this method will attempt to clear any orientation information, if that is supported by the image format.
position - the Left,Posterior,Superior (LPS) coordinates of the centre of the first pixel in the image data matrix. If position is null, this method will attempt to clear any positional information, if that is supported by the image format.
force - if true, this method will force the orientation and position to be set as requested, regardless of the user Preferences. This can be useful if you read the orientation from an existing image, and you want to set the orientation exactly the same in a new image.

setImageOrientationPatient

public void setImageOrientationPatient(javax.vecmath.Vector3f[] dirCos,
                                       int slice)
                                throws java.lang.IndexOutOfBoundsException
Description copied from class: MultiSliceImage
Sets the direction cosines of the row, column and slice directions (for increasing row, column and slice) of the image, in patient (LPS) coordinates.

If the orientation cannot be set for this image, this method does nothing.

Specified by:
setImageOrientationPatient in class MultiSliceImage
Parameters:
dirCos - the direction cosines of the image row, column and (optionally) slice directions respectively in Left,Posterior,Superior (LPS) coordinates.
slice - the slice for which to set the orientation.
Throws:
java.lang.IndexOutOfBoundsException - if the cosines array does not have the correct dimensions.

setPixelSpacing

public void setPixelSpacing(float[] spacing)
                     throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the distance (in mm) between pixel centres in the row, column and slice directions of the image. The distances should always be positive values.

Specified by:
setPixelSpacing in class MultiSliceImage
Parameters:
spacing - a float[] of length 3, corresponding to the distance between pixel centres in the row, column and slice directions respectively. If this is a single-slice image, then spacing may (otionally) have length 2 to indicate the in-plane distance between pixel centres.
Throws:
java.io.IOException - if the pixel spacing cannot be set for this image.

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.

setSliceThickness

public void setSliceThickness(float thickness)
                       throws java.io.IOException
Description copied from class: MultiSliceImage
Sets 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:
setSliceThickness in class MultiSliceImage
Parameters:
thickness - the slice thickness in mm.
Throws:
java.io.IOException - if the slice thickness cannot be set for this image, or if the slice thickness is negative.

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.

setPatientPosition

public void setPatientPosition(PatientPosition position)
Description copied from class: MultiSliceImage
Sets the position in which the patient is lying in the scanning equipment for this MultiSliceImage.

Specified by:
setPatientPosition in class MultiSliceImage
Parameters:
position - the position in which the patient is lying in the scanning equipment. e.g. PatientPosition.HFS (head-first supine).

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.

setIntensityRescale

public void setIntensityRescale(float[] rescale)
                         throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the values m and b in the relationship between pixel intensity (I) values and the output units specified in setRescaleUnits() in the expression:
Output units = m*I + b.

Specified by:
setIntensityRescale in class MultiSliceImage
Parameters:
rescale - a float[] of length 2 where the first element is m and the second is b.
Throws:
java.io.IOException - if an I/O error occurs.

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.

setIntensityRescale

public void setIntensityRescale(float[] rescale,
                                int slice)
                         throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the values m and b in the relationship between pixel intensity (I) values and the output units specified in setRescaleUnits() in the expression:
Output units = m*I + b, for a particular slice.

Specified by:
setIntensityRescale in class MultiSliceImage
Parameters:
rescale - a float[] of length 2 where the first element is m and the second is b.
slice - a slice number for which to set the rescaling values.
Throws:
java.io.IOException - if an I/O error occurs.

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.

setRescaleUnits

public void setRescaleUnits(java.lang.String unitsString)
                     throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the output units of Intensity Rescale Slope and Intensity Rescale Intercept, retrieved by getIntensityRescale().

Specified by:
setRescaleUnits in class MultiSliceImage
Parameters:
unitsString - a String describing the physical meaning of the pixel intensity units. If the unitsString is null, future calls to getRescaleUnits() will return the String "arbitrary units".
Throws:
java.io.IOException - if the rescaling units cannot be set 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.

setPatientName

public void setPatientName(java.lang.String patientName)
                    throws java.io.IOException
Description copied from class: MultiSliceImage
Attempts to set the patient name for this image. If new patient name String is longer than is allowed by the image format, then it is truncated before being applied. No exception occurs if the image format does not support patient name recording.
N.B. For disk-based images, the changes in the patient name will not be reflected on disk unless the close() method is called.

Specified by:
setPatientName in class MultiSliceImage
Parameters:
patientName - the new patient name to be assigned to this image.
Throws:
java.io.IOException - if the patient name cannot be set.

setPatientID

public void setPatientID(java.lang.String patientID)
                  throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the patient ID for this image. If the new patient ID String is longer than is allowed by the image format, then it is truncated before being applied. No exception occurs if the image format does not support patient ID recording.
N.B. For disk-based images, the changes in the patient ID will not be reflected on disk unless the close() method is called.

Specified by:
setPatientID in class MultiSliceImage
Parameters:
patientID - the new patient ID to be assigned to this image.
Throws:
java.io.IOException - if the patient ID cannot be set.

setPatientDoB

public void setPatientDoB(java.util.Date patientDoB)
                   throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the patient's date of birth for this image. No exception occurs if the image format does not support patient date of birth recording.
N.B. For disk-based images, the changes in the patient's birth date will not be reflected on disk unless the close() method is called.

Specified by:
setPatientDoB in class MultiSliceImage
Parameters:
patientDoB - the new patient date of birth to be assigned to this image.
Throws:
java.io.IOException - if the patient date of birth cannot be set.

setScanDate

public void setScanDate(java.util.Date scanDate)
                 throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the scan date/time for this image.
N.B. For disk-based images, the changes in the scan date will not be reflected on disk unless the close() method is called.

Specified by:
setScanDate in class MultiSliceImage
Parameters:
scanDate - the new scan date/time to be assigned to this image.
Throws:
java.io.IOException - if the scan date cannot be set.

setPulseSequence

public void setPulseSequence(java.lang.String seqName)
                      throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the pulse sequence name for this image.
N.B. For disk-based images, the changes in the scanning sequence will not be reflected on disk unless the close() method is called.

Specified by:
setPulseSequence in class MultiSliceImage
Parameters:
seqName - the new name of the pulse sequence to be assigned to this image.
Throws:
java.io.IOException - if the pulse sequence name cannot be set.

setScanningSequence

public void setScanningSequence(PulseSequenceType seq)
                         throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the DICOM scanning sequence for this image.
N.B. For disk-based images, the changes in the scanning sequence will not be reflected on disk unless the close() method is called.

Specified by:
setScanningSequence in class MultiSliceImage
Parameters:
seq - the new scanning sequence to be assigned to this image.
Throws:
java.io.IOException - if the scanning sequence cannot be set.

setSequenceVariant

public void setSequenceVariant(PulseSequenceVariant seqVar)
                        throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the DICOM scanning sequence variant for this image.
N.B. For disk-based images, the changes in the scanning sequence variant will not be reflected on disk unless the close() method is called.

Specified by:
setSequenceVariant in class MultiSliceImage
Parameters:
seqVar - the new scanning sequence variant to be assigned to this image.
Throws:
java.io.IOException - if the scanning sequence variant cannot be set.

setModality

public void setModality(Modality modality)
                 throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the modality with which this image was acquired. No exception occurs if the image format does not support modality recording.
N.B. For disk-based images, the changes in the modality will not be reflected on disk unless the close() method is called.

Specified by:
setModality in class MultiSliceImage
Parameters:
modality - the new imaging modality to be assigned to this image.
Throws:
java.io.IOException - if modality cannot be set.

getModality

public Modality getModality()
Description copied from class: MultiSliceImage
Returns the modality with which this image was acquired.

Specified by:
getModality in interface LoadableImage
Specified by:
getModality in class MultiSliceImage
Returns:
the modality with which this image was collected. Returns Modality.UNKNOWN if the modality cannot be found of is not one of the recognised modalities.

setScanTR

public void setScanTR(float TR)
               throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the scan repetition time for this image. No exception occurs if the image format does not support scan TR recording.
N.B. For disk-based images, the changes in the scan TR will not be reflected on disk unless the close() method is called.

Specified by:
setScanTR in class MultiSliceImage
Parameters:
TR - the new scan TR to be assigned to this image.
Throws:
java.io.IOException - if the scan TR cannot be set.

setScanTI

public void setScanTI(float TI)
               throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the scan inversion time for this image. No exception occurs if the image format does not support scan TI recording.
N.B. For disk-based images, the changes in the scan TI will not be reflected on disk unless the close() method is called.

Specified by:
setScanTI in class MultiSliceImage
Parameters:
TI - the new scan TI to be assigned to this image.
Throws:
java.io.IOException - if the scan TI cannot be set.

setScanTE

public void setScanTE(float TE)
               throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the scan echo time for this image, for single-echo-time images. No exception occurs if the image format does not support scan TE recording.
N.B. For disk-based images, the changes in the scan TE will not be reflected on disk unless the close() method is called.

Specified by:
setScanTE in class MultiSliceImage
Parameters:
TE - the new scan TE to be assigned to this image.
Throws:
java.io.IOException - if the scan TE cannot be set.

setScanTE

public void setScanTE(float TE,
                      int slice)
               throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the scan echo time for one slice of this image. No exception occurs if the image format does not support a scan TE recording.
N.B. For disk-based images, the changes in the scan TE will not be reflected on disk unless the close() method is called.

Specified by:
setScanTE in class MultiSliceImage
Parameters:
TE - the new scan TE to be assigned to this image.
slice - the slice number for which to set the echo time.
Throws:
java.io.IOException - if the scan TE cannot be set.

setFlipAngle

public void setFlipAngle(float flipAngle)
                  throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the excitation pulse flip angle for this image. No exception occurs if the image format does not support flip angle recording.
N.B. For disk-based images, the changes in the scan flip angle will not be reflected on disk unless the close() method is called.

Specified by:
setFlipAngle in class MultiSliceImage
Parameters:
flipAngle - the new scan flip angle to be assigned to this image.
Throws:
java.io.IOException - if the scan flip angle cannot be set.

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.

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.

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.

setDWbValue

public void setDWbValue(float bValue,
                        int slice)
                 throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the diffusion-weighting b-value for one slice of this image. No exception occurs if the image format does not support recording the b-value.
N.B. For disk-based images, the changes in the b-value will not be reflected on disk unless the close() method is called.

Specified by:
setDWbValue in class MultiSliceImage
Parameters:
bValue - the new b-value to be assigned to this image.
slice - the slice number for which to set the b-value.
Throws:
java.io.IOException - if the scan b-value cannot be set.

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.

setDWGradientVector

public void setDWGradientVector(javax.vecmath.Vector3f gradVec,
                                int slice)
                         throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the diffusion-weighting gradient vector for one slice of this image. No exception occurs if the image format does not support recording the gradient vector.
N.B. For disk-based images, the changes in the gradient vector will not be reflected on disk unless the close() method is called.

Specified by:
setDWGradientVector in class MultiSliceImage
Parameters:
gradVec - the new gradient vector to be assigned to this image.
slice - the slice number for which to set the gradient vector.
Throws:
java.io.IOException - if the scan gradient vector cannot be set.

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

setDWBMatrix

public void setDWBMatrix(float[] bMatrix,
                         int slice)
                  throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the diffusion-weighting B-matrix for one slice of this image. No exception occurs if the image format does not support recording the B-matrix.
N.B. For disk-based images, the changes in the B-matrix will not be reflected on disk unless the close() method is called.

Specified by:
setDWBMatrix in class MultiSliceImage
Parameters:
bMatrix - the new B-matrix to be assigned to this image.
slice - the slice number for which to set the B-matrix.
Throws:
java.io.IOException - if the scan B-matrix cannot be set.

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.

clone

public UNCImage clone()
Creates an in-memory copy of a UNCImage.

Overrides:
clone in class MultiSliceImage
Returns:
a copy of the UNCImage object.

getNativeColourMapping

public ColourMapping getNativeColourMapping()
                                     throws InvalidColourMappingException
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.
Throws:
InvalidColourMappingException - if this image has an associated ColourMapping, but the ColourMapping cannot be successfully retrieved.

setNativeColourMapping

public void setNativeColourMapping(ColourMapping colourMapping)
                            throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the ColourMapping for this image. No exception occurs if the image format does not support a colour mapping.
N.B. For disk-based images, the changes in the ColourMapping will not be reflected on disk unless the close() method is called.

Specified by:
setNativeColourMapping in class MultiSliceImage
Parameters:
colourMapping - the new ColourMapping to be assigned to this image.
Throws:
java.io.IOException - if the ColourMapping cannot be set for 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.

getSimpleName

public java.lang.String getSimpleName()
Description copied from class: MultiSliceImage
Returns the simple name for this type of image - the String that should be seen by the users to identify this type of image.

Specified by:
getSimpleName in class MultiSliceImage
Returns:
a simple name for the image type.

getCommonName

public static java.lang.String getCommonName()
Returns the common name for this type of image.

Returns:
the String "UNC".


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