com.xinapse.multisliceimage.Analyze
Class ANZImage

java.lang.Object
  extended by com.xinapse.multisliceimage.MultiSliceImage
      extended by com.xinapse.multisliceimage.Analyze.ANZImage
All Implemented Interfaces:
LoadableImage, java.lang.Cloneable
Direct Known Subclasses:
Analyze75Image, NIFTIImage

public abstract class ANZImage
extends MultiSliceImage

This is an abstract class that is the superclass of a multi-dimensional image in the Analyze 7.5 format or the new NIFTI-1 format.

Image data for images loaded from disk remains on disk, and is accessed as required; image data loaded from streams or created afresh resides in memory. Image data loaded from compressed (gzipped) disk-files also resides in memory.

Both big-endian and little-endian byte ordering are implemented and supported. When reading existing images, the byte order is auto detected from the header file. When existing images are copied or modified, the original byte order is retained. For images newly-created from scratch by this package, the byte ordering is the native byte order.

N.B. The Analyze format requires that for BINARY images, individual slices must begin on a byte boundary. In this implementation, that restriction is removed. If you wish to maintain compatibility with Analyze and other programs that maintain this restriction, please ensure that a multi-slice/multi-frame images have slices with a number of pixels that is a multiple of 8 (bits).


Field Summary
static java.lang.String COMPRESSED_EXTENSION
          The file extension for Analyze image files in lower case form.
static java.lang.String COMPRESSED_UPPERCASE_EXTENSION
          The file extension for Analyze image files in upper case form.
static java.lang.String EXTENSION
          The file extension for Analyze image files in lower case form.
static java.lang.String UPPERCASE_EXTENSION
          The file extension for Analyze image files in upper case form.
 
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
 
Method Summary
 ANZImage clone()
          Creates an in-memory clone of an Analyze image.
 void close()
          Closes an ANZImage and frees up resources.
 java.nio.ByteOrder getByteOrder()
          Returns the byte order for this image.
 ANZPixFormat getDataType()
          Returns the data type (ANZPixFormat) of this 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[] getDims()
          Returns the dimensions of this image.
 int getFileDataOffset()
          Returns the byte offset into the disk-based file format where pixel data begins.
 ANZHeader getHeader()
          Returns the ANZHeader image header 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.
abstract  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(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.
 ColourMapping getNativeColourMapping()
          Returns a ColourMapping if this Analyze image has an associated colour mapping.
 int getNCols()
          Returns the number of image columns in this image.
 int getNDim()
          Returns the dimensionality of this image.
 int getNFrames()
          Returns the number of frames in a multi-frame image.
 int getNRows()
          Returns the number of image rows in this image.
 int getNSlices()
          Returns the number of physical slice locations in this image.
 PixelDataType getPixelDataType()
          Returns a PixelDataType representing the data type of this image.
 float getPixelXSize()
          Returns the pixel size in the x (horizontal) direction for this image.
 float getPixelYSize()
          Returns the pixel size in the y (vertical) direction for this image.
 float getPixelZSize()
          Returns the separation between the centres of image planes for this image.
 java.lang.String getRescaleUnits()
          Specifies the output units of Intensity Rescale Slope and Intensity Rescale Intercept, retrieved by getIntensityRescale().
 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 an ANZImage with the given name already exists on disk.
 boolean isCompressed()
          Tests whether this ANZImage is compressed when on disk.
 boolean isOpen()
          Tests whether this image is still open.
 void setDBName(java.lang.String name)
          Sets the data base name for this ANZImage.
 void setDescription(java.lang.String descripstr)
          Sets the description for this ANZImage.
 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 setIntensityRescale(float[] rescale, int slice)
          This action is not supported by the Analyze/NIFTI-1 file format, so this method always throws a MultiSliceImageException.
 void setMinMax(int min, int max)
          Sets the glMin and glMax fields for this ANZImage.
 void setNativeColourMapping(ColourMapping colourMapping)
          Sets the ColourMapping for this image.
 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 setTimeBetweenFrames(float deltaT)
          Sets the time between frames in a 4- or higher dimensional image.
 void setTitle(java.lang.String title)
          Sets the title of this image.
 java.lang.String toString()
           
 java.lang.String write(java.lang.String filename)
          Writes this ANZImage to disk.
 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, getModality, getMostLikePlane, getNPixels, getPix, getPix, getPix, getPix, getPix, getPreferredImageClass, getPreview, getROIs, getScanDateFormat, getSimpleName, getSlice, getSlice, getSliceDim, getSuggestedFileName, isImage, isModified, main, pad, parseMultiValuedString, putPix, putPix, putPix, putPix, putSlice, reorient, reorientRadiological, reSample, reSample, savePreferredImageClass, set3DBlockParameters, setDWBMatrix, setDWbValue, setDWGradientVector, setFlipAngle, setImageOrientationPatient, setImagePositionPatient, setIntensityRescale, setMinMax, setModality, setModified, setOrientationPositionRadiological, setPatientDoB, setPatientID, setPatientName, setPatientPosition, setPulseSequence, setRescaleUnits, setScanDate, setScanningSequence, setScanTE, setScanTE, setScanTI, setScanTR, setSequenceVariant, setSliceThickness, setSuggestedFileName, toBufferedImage
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.xinapse.loadableimage.LoadableImage
appendAuditInfo, getDWBMatrix, getDWbValue, getDWGradientVector, getFlipAngle, getIntensityRescale, getPatientDoB, getPatientID, getPatientName, getPatientPosition, getPulseSequence, getScanDate, getScanningSequence, getScanTE, getScanTE, getScanTI, getScanTR, getSequenceVariant, getSliceThickness
 

Field Detail

EXTENSION

public static final java.lang.String EXTENSION
The file extension for Analyze image files in lower case form.

See Also:
Constant Field Values

UPPERCASE_EXTENSION

public static final java.lang.String UPPERCASE_EXTENSION
The file extension for Analyze image files in upper case form.


COMPRESSED_EXTENSION

public static final java.lang.String COMPRESSED_EXTENSION
The file extension for Analyze image files in lower case form.

See Also:
Constant Field Values

COMPRESSED_UPPERCASE_EXTENSION

public static final java.lang.String COMPRESSED_UPPERCASE_EXTENSION
The file extension for Analyze image files in upper case form.

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

imageExists

public static boolean imageExists(java.lang.String filename)
Tests whether an ANZImage with the given name already exists on disk. File extensions are handled in a smart and case-insensitive way.

Parameters:
filename - the name of the image file to test for existence.
Returns:
true if a pair of ANZImage .img and .hdr with the specified name exist on disk; false otherwise.

write

public java.lang.String write(java.lang.String filename)
                       throws java.io.IOException,
                              MultiSliceImageException
Writes this ANZImage to disk.

Specified by:
write in class MultiSliceImage
Parameters:
filename - the root of the Analyze filename. Will be appended with ".img" and ".hdr" to create the appropriate full filenames.
Returns:
the actual file name used to write the image, including any added extension.
Throws:
MultiSliceImageException - if the image cannot be written.
java.io.IOException - if an I/O error occurs.

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 abstract MultiSliceImage getInstance(java.lang.Class cl,
                                            int nSlices)
                                     throws java.io.IOException,
                                            MultiSliceImageException
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:
java.io.IOException - if an I/O error occurs.
MultiSliceImageException - if the image cannot be written.

close

public void close()
           throws java.io.IOException,
                  MultiSliceImageException
Closes an ANZImage and frees up resources. For in-memory ANZImages, 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 header information is only written to disk by the close() method. If the close() method is not applied to a disk-based ANZImage, then any changes to the header will be lost. Any further operations to a closed ANZImage are not possible, and may cause an exception to be thrown.

Throws:
MultiSliceImageException - if the file cannot be written or closed.
java.io.IOException - if an I/O error occurs.

isOpen

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

Returns:
true if the image is still open for reading and (if opened read/write) writing; false otherwise.

isCompressed

public boolean isCompressed()
Tests whether this ANZImage is compressed when on disk. Returns true if compressed; false otherwise.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getDataType

public ANZPixFormat getDataType()
Returns the data type (ANZPixFormat) of this image.

Returns:
an ANZPixFormat representing a particular pixel data type.

setDBName

public void setDBName(java.lang.String name)
               throws ANZException
Sets the data base name for this ANZImage.

Parameters:
name - a String representing the name data base name.
Throws:
ANZException - if the data base name cannot be set for this image.

setDescription

public void setDescription(java.lang.String descripstr)
                    throws ANZException
Sets the description for this ANZImage.

Parameters:
descripstr - a String representing the name description.
Throws:
ANZException - if the description cannot be set for the image header.

setMinMax

public void setMinMax(int min,
                      int max)
               throws MultiSliceImageException
Sets the glMin and glMax fields for this ANZImage.

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 values supplied are unsuitable, or the values cannot be set.

getHeader

public ANZHeader getHeader()
Returns the ANZHeader image header for this image. Warning! If this header is manipulated, then accessing the image pixel data may cause errors.

Returns:
the Analyze image header for this image.

getNCols

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

Returns:
the number of image columns.

getNRows

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

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.

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.

Returns:
the number of image (movie) frames.

getTotalNSlices

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

Returns:
the number of planar image slices.

getNDim

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

Returns:
the image dimensionality.

getDims

public int[] getDims()
              throws java.lang.IllegalStateException
Description copied from class: MultiSliceImage
Returns the dimensions of this image.

Specified by:
getDims in class MultiSliceImage
Returns:
the image dimensions in a int array, where element 0 is the most slowly varying index, 1 the next most slowly-varying, etc.
Throws:
java.lang.IllegalStateException - if the dimensions are bad.

getPixelDataType

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

Returns:
the PixelDataType representing the data type of this image.

getFileDataOffset

public int getFileDataOffset()
Description copied from class: MultiSliceImage
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.

getPixelXSize

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

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

setPixelXSize

public void setPixelXSize(float width)
                   throws java.lang.IllegalArgumentException,
                          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.lang.IllegalArgumentException - if the pixel width is not positive.
java.io.IOException - if and I/O error occurs.

getPixelYSize

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

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

setPixelYSize

public void setPixelYSize(float height)
                   throws java.lang.IllegalArgumentException,
                          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.lang.IllegalArgumentException - if height is not positive.
java.io.IOException - if an I/O error occurs.

getPixelZSize

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

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

setPixelZSize

public void setPixelZSize(float thickness)
                   throws java.lang.IllegalArgumentException,
                          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.lang.IllegalArgumentException - if thickness is not positive.
java.io.IOException - if an I/O error occurs.

getTimeBetweenFrames

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

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.

setTimeBetweenFrames

public void setTimeBetweenFrames(float deltaT)
                          throws java.lang.IllegalArgumentException,
                                 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.lang.IllegalArgumentException - if deltaT is negative.
java.io.IOException - if an I/O error occurs.

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.

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)
                                                    throws java.lang.IndexOutOfBoundsException
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.

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.
Throws:
java.lang.IndexOutOfBoundsException - if the image does not have the right dimensionality or the slice number is inappropriate for this image.

getImagePositionPatient

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

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

getImagePositionPatient

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

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

setImageOrientationPositionPatient

public void setImageOrientationPositionPatient(javax.vecmath.Vector3f[] dirCos,
                                               javax.vecmath.Point3f position,
                                               boolean force)
                                        throws java.io.IOException
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.
Throws:
java.io.IOException - if an I/O error occurs.

setPixelSpacing

public void setPixelSpacing(float[] spacing)
                     throws java.lang.IndexOutOfBoundsException,
                            java.io.IOException,
                            java.lang.IllegalArgumentException
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.lang.IndexOutOfBoundsException - if spacing does not have the correct dimensions.
java.io.IOException - if the pixel spacing cannot be set for this image.
java.lang.IllegalArgumentException

getIntensityRescale

public float[] getIntensityRescale(int slice)
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.

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.

setIntensityRescale

public void setIntensityRescale(float[] rescale,
                                int slice)
                         throws MultiSliceImageException
This action is not supported by the Analyze/NIFTI-1 file format, so this method always throws a MultiSliceImageException.

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:
MultiSliceImageException - always.

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

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.

getDescription

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

Returns:
a String describing this image.

getDescription

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

Parameters:
slice - the slice number. o
Returns:
a String describing this image slice.

getTitle

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

Returns:
the title of this image.

setTitle

public void setTitle(java.lang.String title)
              throws java.io.IOException
Description copied from class: MultiSliceImage
Sets the title of this image. If new title String is longer than is allowed by the image format, then it is truncated before being applied.
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:
title - the new title to be assigned to this image.
Throws:
java.io.IOException - if the title cannot be set.

getHTMLDescription

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

Returns:
a String describing this image.

getHTMLDescription

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

Parameters:
slice - the slice number.
Returns:
a String describing this image slice.

getNativeColourMapping

public ColourMapping getNativeColourMapping()
Returns a ColourMapping if this Analyze image has an associated colour mapping. Colour mappings are kept in a file with an extension ".lkup" and with the same name root as the Analyze image.

Returns:
a ColourMapping if this image has an associated colour mapping. Returns null if it does not.

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 MultiSliceImageException
Description copied from interface: LoadableImage
Returns the minimum pixel intensity in the image.

Returns:
the maximum pixel intensity as a Double, or null if the intensity min hasn't been calculated for this image.
Throws:
MultiSliceImageException

getMax

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

Returns:
the maximum pixel intensity as a Double, or null if the intensity max hasn't been calculated for this image.
Throws:
MultiSliceImageException

clone

public ANZImage clone()
Creates an in-memory clone of an Analyze image.

Overrides:
clone in class MultiSliceImage
Returns:
a copy of the ANZImage Object.


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