com.xinapse.multisliceimage.Analyze
Class Analyze75Header

java.lang.Object
  extended by com.xinapse.multisliceimage.Analyze.ANZHeader
      extended by com.xinapse.multisliceimage.Analyze.Analyze75Header
All Implemented Interfaces:
java.lang.Cloneable

public class Analyze75Header
extends ANZHeader

This class represents a multi-dimensional Analyze 7.5 image header file. The header file contains all the dimensional and descriptive information about an Analyze image, but none of the pixel data.

Analyze images are usually 4-dimensional, with the dimensions being the number of rows, number of columns, number of slices, and number of frames (for images where things vary through time). It seems conventional to make all images 4-dimensional, but set the size of any unused dimension to 1.

Header files end in the file extension ".hdr" or ".HDR".


Field Summary
static java.lang.String CREATE_NON_FLIPPED_PROPERTY_KEY
          The property value key for setting whether newly-created Analyze 7.5 images should have a non-flipped orientation.
static boolean DEFAULT_CREATE_NON_FLIPPED
          The default setting of whether newly-created Analyze 7.5 images should have a non-flipped orientation.
static boolean DEFAULT_DO_NOT_FLIP_FLIPPED
          The default setting of whether not to flip vertically an image with a flipped Analyze orientation.
static boolean DEFAULT_FLIP_NON_FLIPPED
          The default setting of whether to flip vertically an image with a non-flipped Analyze orientation.
static boolean DEFAULT_WARN_NEGATIVE_PIXEL_SIZE
          Whether to warn the user about negative pixel sizes by default.
static java.lang.String DO_NOT_FLIP_FLIPPED_PROPERTY_KEY
          The property value key for setting whether not to flip flipped Analyze 7.5 images.
static java.lang.String FLIP_NON_FLIPPED_PROPERTY_KEY
          The property value key for setting whether to flip non-flipped Analyze 7.5 images.
static byte ORIENT_AXIAL
          The constant used to indicate an axial orientation.
static byte ORIENT_AXIAL_FLIPPED
          The constant used to indicate a flipped axial orientation.
static byte ORIENT_CORONAL
          The constant used to indicate a coronal orientation.
static byte ORIENT_CORONAL_FLIPPED
          The constant used to indicate a flipped coronal orientation.
static byte ORIENT_SAGITTAL
          The constant used to indicate a sagittal orientation.
static byte ORIENT_SAGITTAL_FLIPPED
          The constant used to indicate a flipped sagittal orientation.
static java.lang.String WARN_NEGATIVE_PIXEL_HEIGHT_PROPERTY_KEY
          The property value key for setting whether the user should be warned about negative pixel heights.
static java.lang.String WARN_NEGATIVE_PIXEL_WIDTH_PROPERTY_KEY
          The property value key for setting whether the user should be warned about negative pixel widths.
 
Fields inherited from class com.xinapse.multisliceimage.Analyze.ANZHeader
COMPRESSED_EXTENSION, COMPRESSED_UPPERCASE_EXTENSION, EXTENSION, MAXDIM, UPPERCASE_EXTENSION, voxOffset
 
Method Summary
 java.lang.Object clone()
          Returns an exact copy of this Analyze header.
protected  void finalize()
          Called by the garbage collector on this Analyze75Header when garbage collection determines that there are no more references to the header.
 java.lang.String getPatientID()
          Returns the patient ID for this Analyze image header.
static boolean getPreferredCreateNonFlipped()
          Returns the user's preference about whether newly-created Analyze 7.5 images should have a non-flipped orientation.
static boolean getPreferredDoNotFlipFlipped()
          Returns the user's preference about whether an Analyze 7.5 image with a flipped orientation should be treated as if it has a non-flipped orientation.
static boolean getPreferredFlipNonFlipped()
          Returns the user's preference about whether an Analyze 7.5 image with a non-flipped orientation should be treated as if it has a flipped orientation.
static boolean getPreferredWarnNegativePixelHeight()
          Returns the user's preference about whether the user should be warned about negative pixel height in Analyze 7.5 images.
static boolean getPreferredWarnNegativePixelWidth()
          Returns the user's preference about whether the user should be warned about negative pixel width in Analyze 7.5 images.
static void savePreferredCreateNonFlipped(boolean b)
          Saves the user's preference about whether newly-created Analyze 7.5 images should have a non-flipped orientation.
static void savePreferredDoNotFlipFlipped(boolean b)
          Saves the user's preference about whether an Analyze 7.5 image with a flipped orientation should be treated as if it has a non-flipped orientation.
static void savePreferredFlipNonFlipped(boolean b)
          Saves the user's preference about whether an Analyze 7.5 image with a non-flipped orientation should be treated as if it has a flipped orientation.
static void savePreferredWarnNegativePixelHeight(boolean b)
          Saves the user's preference about whether the user should be warned about negative pixel height in Analyze 7.5 images.
static void savePreferredWarnNegativePixelWidth(boolean b)
          Saves the user's preference about whether the user should be warned about negative pixel width in Analyze 7.5 images.
 void setImageOrientationPositionPatient(javax.vecmath.Vector3f[] cosines, javax.vecmath.Point3f position)
          The Analyze 7.5 file format does not support setting of arbitrary image orientations and positions.
 void setPatientID(java.lang.String patID)
          Sets the patient ID for this Analyze image header.
 java.lang.String toString()
          Returns the String representation of this Analyze 7.5 image header.
 java.lang.String toString(boolean html)
          Returns the string representation of this Analyze image header, with optional presentation in HTML format.
 
Methods inherited from class com.xinapse.multisliceimage.Analyze.ANZHeader
getDBName, getDescription, getMinMax, setDBName, setDims, setMinMax, setNCols, setNFrames, setNRows, setNSlices
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WARN_NEGATIVE_PIXEL_WIDTH_PROPERTY_KEY

public static final java.lang.String WARN_NEGATIVE_PIXEL_WIDTH_PROPERTY_KEY
The property value key for setting whether the user should be warned about negative pixel widths.

See Also:
Constant Field Values

WARN_NEGATIVE_PIXEL_HEIGHT_PROPERTY_KEY

public static final java.lang.String WARN_NEGATIVE_PIXEL_HEIGHT_PROPERTY_KEY
The property value key for setting whether the user should be warned about negative pixel heights.

See Also:
Constant Field Values

FLIP_NON_FLIPPED_PROPERTY_KEY

public static final java.lang.String FLIP_NON_FLIPPED_PROPERTY_KEY
The property value key for setting whether to flip non-flipped Analyze 7.5 images.

See Also:
Constant Field Values

DO_NOT_FLIP_FLIPPED_PROPERTY_KEY

public static final java.lang.String DO_NOT_FLIP_FLIPPED_PROPERTY_KEY
The property value key for setting whether not to flip flipped Analyze 7.5 images.

See Also:
Constant Field Values

CREATE_NON_FLIPPED_PROPERTY_KEY

public static final java.lang.String CREATE_NON_FLIPPED_PROPERTY_KEY
The property value key for setting whether newly-created Analyze 7.5 images should have a non-flipped orientation.

See Also:
Constant Field Values

DEFAULT_WARN_NEGATIVE_PIXEL_SIZE

public static final boolean DEFAULT_WARN_NEGATIVE_PIXEL_SIZE
Whether to warn the user about negative pixel sizes by default.

See Also:
Constant Field Values

DEFAULT_FLIP_NON_FLIPPED

public static final boolean DEFAULT_FLIP_NON_FLIPPED
The default setting of whether to flip vertically an image with a non-flipped Analyze orientation.

See Also:
Constant Field Values

DEFAULT_DO_NOT_FLIP_FLIPPED

public static final boolean DEFAULT_DO_NOT_FLIP_FLIPPED
The default setting of whether not to flip vertically an image with a flipped Analyze orientation.

See Also:
Constant Field Values

DEFAULT_CREATE_NON_FLIPPED

public static final boolean DEFAULT_CREATE_NON_FLIPPED
The default setting of whether newly-created Analyze 7.5 images should have a non-flipped orientation.

See Also:
Constant Field Values

ORIENT_AXIAL

public static final byte ORIENT_AXIAL
The constant used to indicate an axial orientation.

See Also:
Constant Field Values

ORIENT_CORONAL

public static final byte ORIENT_CORONAL
The constant used to indicate a coronal orientation.

See Also:
Constant Field Values

ORIENT_SAGITTAL

public static final byte ORIENT_SAGITTAL
The constant used to indicate a sagittal orientation.

See Also:
Constant Field Values

ORIENT_AXIAL_FLIPPED

public static final byte ORIENT_AXIAL_FLIPPED
The constant used to indicate a flipped axial orientation.

See Also:
Constant Field Values

ORIENT_CORONAL_FLIPPED

public static final byte ORIENT_CORONAL_FLIPPED
The constant used to indicate a flipped coronal orientation.

See Also:
Constant Field Values

ORIENT_SAGITTAL_FLIPPED

public static final byte ORIENT_SAGITTAL_FLIPPED
The constant used to indicate a flipped sagittal orientation.

See Also:
Constant Field Values
Method Detail

getPreferredWarnNegativePixelWidth

public static boolean getPreferredWarnNegativePixelWidth()
Returns the user's preference about whether the user should be warned about negative pixel width in Analyze 7.5 images. Whether the user is warned or not, a horizontal flip is automatically performed for images with negative pixel widths. Images with negative pixel sizes are often created by FSL programs.

If the system property "analyze.warnnegwidth" exists, and the property value is either "true" or "false", then the user's preference is overridden by the property value.

Returns:
true if the user should be issed with a warning when an Analyze 7.5 image has a negative pixel width. false otherwise.

getPreferredWarnNegativePixelHeight

public static boolean getPreferredWarnNegativePixelHeight()
Returns the user's preference about whether the user should be warned about negative pixel height in Analyze 7.5 images. Whether the user is warned or not, a vertical flip is automatically performed for images with negative pixel heights. Images with negative pixel sizes are often created by FSL programs.

If the system property "analyze.warnnegheight" exists, and the property value is either "true" or "false", then the user's preference is overridden by the property value.

Returns:
true if the user should be issed with a warning when an Analyze 7.5 image has a negative pixel height. false otherwise.

savePreferredWarnNegativePixelWidth

public static void savePreferredWarnNegativePixelWidth(boolean b)
Saves the user's preference about whether the user should be warned about negative pixel width in Analyze 7.5 images.

Parameters:
b - true if the user is to be issed with a warning when an Analyze 7.5 image has a negative pixel width. false otherwise.

savePreferredWarnNegativePixelHeight

public static void savePreferredWarnNegativePixelHeight(boolean b)
Saves the user's preference about whether the user should be warned about negative pixel height in Analyze 7.5 images.

Parameters:
b - true if the user is to be issed with a warning when an Analyze 7.5 image has a negative pixel height. false otherwise.

getPreferredFlipNonFlipped

public static boolean getPreferredFlipNonFlipped()
Returns the user's preference about whether an Analyze 7.5 image with a non-flipped orientation should be treated as if it has a flipped orientation. Some programs that create Analyze 7.5 images write the orientation as a non-flipped orientation into the header, but then put pixel data to the image in a flipped orientation.

If the system property "analyze.flipnonflipped" exists, and the property value is either "true" or "false", then the user's preference is overridden by the property value.

Returns:
whether non-flipped images should be treated as flipped.

savePreferredFlipNonFlipped

public static void savePreferredFlipNonFlipped(boolean b)
Saves the user's preference about whether an Analyze 7.5 image with a non-flipped orientation should be treated as if it has a flipped orientation.

Parameters:
b - true if non-flipped images should be treated as flipped; false otherwise.

getPreferredDoNotFlipFlipped

public static boolean getPreferredDoNotFlipFlipped()
Returns the user's preference about whether an Analyze 7.5 image with a flipped orientation should be treated as if it has a non-flipped orientation. Some programs that create Analyze 7.5 images write the orientation as a flipped orientation into the header, but then put pixel data to the image in a non-flipped orientation.

If the system property "analyze.donotflipflipped" exists, and the property value is either "true" or "false", then the user's preference is overridden by the property value.

Returns:
whether flipped images should be treated as non-flipped.

savePreferredDoNotFlipFlipped

public static void savePreferredDoNotFlipFlipped(boolean b)
Saves the user's preference about whether an Analyze 7.5 image with a flipped orientation should be treated as if it has a non-flipped orientation.

Parameters:
b - true if flipped images should be treated as non-flipped; false otherwise.

getPreferredCreateNonFlipped

public static boolean getPreferredCreateNonFlipped()
Returns the user's preference about whether newly-created Analyze 7.5 images should have a non-flipped orientation. Some external programs (such as SPM, MRIcro and Image/J) may not be able to correctly display images with a flipped orientation, so if interoperating with these, it may be necessary to only use the non-flipped orientations. If not set in the user's preferences, then the default is to create images with a flipped orientation.

If the system property "analyze.createnonflipped" exists, and the property value is either "true" or "false", then the user's preference is overridden by the property value.

Returns:
whether Analyze 7.5 images should created with a non-flipped orientation by default.

savePreferredCreateNonFlipped

public static void savePreferredCreateNonFlipped(boolean b)
Saves the user's preference about whether newly-created Analyze 7.5 images should have a non-flipped orientation.

Parameters:
b - true if newly-created Analyze 7.5 images should have a non-flipped orientation; false otherwise.

finalize

protected void finalize()
                 throws java.lang.Throwable
Called by the garbage collector on this Analyze75Header when garbage collection determines that there are no more references to the header.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - - the Exception raised by this method.

setImageOrientationPositionPatient

public void setImageOrientationPositionPatient(javax.vecmath.Vector3f[] cosines,
                                               javax.vecmath.Point3f position)
                                        throws MultiSliceImageException
The Analyze 7.5 file format does not support setting of arbitrary image orientations and positions. This method ignores the position argument, and sets the image orientation to the 'pure' orientation (axial, coronal or sagittal) that is most like the requested orientation.

Parameters:
cosines - a Vector3f[] of length 3, corresponding to the direction cosines of the image row, column and slice directions in Left,Posterior,Superior (LPS) coordinates. cosines[0] is the row direction; cosines[1] is the column direction; and cosines[2] is the slice direction.
position - ignored.
Throws:
MultiSliceImageException - if the direction cosines cannot be set for this image, or if the cosines array does not have the correct dimensions.

getPatientID

public java.lang.String getPatientID()
Returns the patient ID for this Analyze image header.

Returns:
a String representing the patientID.

setPatientID

public void setPatientID(java.lang.String patID)
Sets the patient ID for this Analyze image header. A supplied patient ID that is too long will be truncated.

Parameters:
patID - a String representing the name description.

toString

public java.lang.String toString()
Returns the String representation of this Analyze 7.5 image header.

Overrides:
toString in class ANZHeader
Returns:
a String describing the header.

toString

public java.lang.String toString(boolean html)
Returns the string representation of this Analyze image header, with optional presentation in HTML format.

Overrides:
toString in class ANZHeader
Parameters:
html - if true, then the string will contain HTML tags.
Returns:
a String describing the header, optionally in HTML format.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns an exact copy of this Analyze header.

Overrides:
clone in class ANZHeader
Returns:
an exact copy of this Analyze75Header instance.
Throws:
java.lang.CloneNotSupportedException


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