Class ANZHeader

java.lang.Object
com.xinapse.multisliceimage.Analyze.ANZHeader
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
Analyze75Header, NIFTIHeader

public abstract class ANZHeader extends Object implements Cloneable
An abstract Analyze header representation.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final int
    The length in bytes of the auxiliary file field.
    static final String
    The file extension for Analyze header files in lower case form.
    static final String
    The file extension for Analyze header files in upper case form.
    protected static final int
    The length in bytes of the description field.
    static final String
    The file extension for Analyze header files in lower case form.
    static final int
    The maximum dimensionality of an Analyze image.
    static final String
    The file extension for Analyze header files in upper case form.
    protected Long
    The offset from the start of the file to start of the image data.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    ANZHeader(boolean compressed)
    Creates an uninitialised ANZHeader.
    protected
    ANZHeader(ANZPixFormat dataType, boolean compressed, Long... dims)
    Constructor for a generic Analyze image header.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a deep copy of this Analyze header.
    Returns the data base name for this Analyze image header.
    Returns the description for this Analyze image header.
    int[]
    Gets the glMin and glMax fields for this Analyze image header.
    void
    Sets the data base name for this Analyze image header.
    void
    setDims(Long... dims)
    Sets the number of samples in each dimension of this Analyze image header.
    void
    setDims(Short... dims)
    Sets the number of samples in each dimension of this Analyze image header.
    void
    setMinMax(int min, int max)
    Sets the glMin and glMax fields for this Analyze image header.
    void
    setNCols(short nc)
    Sets the number of columns in this Analyze image header.
    void
    setNFrames(short nF)
    Sets the number of frames in this Analyze image header.
    void
    setNRows(short nr)
    Sets the number of rows in this Analyze image header.
    void
    setNSlices(short ns)
    Sets the number of slices in this Analyze image header.
    Returns the string representation of this Analyze image header.
    toString(boolean html)
    Returns the string representation of this Analyze image header, with optional presentation in HTML format.

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • EXTENSION

      public static final String EXTENSION
      The file extension for Analyze header files in lower case form.
      See Also:
    • UPPERCASE_EXTENSION

      public static final String UPPERCASE_EXTENSION
      The file extension for Analyze header files in upper case form.
    • COMPRESSED_EXTENSION

      public static final String COMPRESSED_EXTENSION
      The file extension for Analyze header files in lower case form.
      See Also:
    • COMPRESSED_UPPERCASE_EXTENSION

      public static final String COMPRESSED_UPPERCASE_EXTENSION
      The file extension for Analyze header files in upper case form.
    • MAXDIM

      public static final int MAXDIM
      The maximum dimensionality of an Analyze image.
      See Also:
    • voxOffset

      protected Long voxOffset
      The offset from the start of the file to start of the image data. A null value means that the voxOffset has not been read/calculated yet. For a disk-based image, once voxOffset has been set, it may not be modified, since the pixel data may have been written to disk starting at voxOffset.
    • DESCRIPTION_LEN

      protected static final int DESCRIPTION_LEN
      The length in bytes of the description field.
      See Also:
    • AUXFILE_LEN

      protected static final int AUXFILE_LEN
      The length in bytes of the auxiliary file field.
      See Also:
  • Constructor Details

    • ANZHeader

      protected ANZHeader(boolean compressed)
      Creates an uninitialised ANZHeader.
      Parameters:
      compressed - true if the image should be compressed when written to disk.
    • ANZHeader

      protected ANZHeader(ANZPixFormat dataType, boolean compressed, Long... dims) throws ANZException
      Constructor for a generic Analyze image header. This header exists in memory, and will only be written with an explicit write() method call.
      Parameters:
      dataType - an ANZPixFormat.
      compressed - true if the image should be compressed when written to disk.
      dims - the number of samples in each of the image dimensions. The number of arguments supplied determines the dimensionality of the image.
      Throws:
      ANZException - if the header cannot be created.
  • Method Details

    • clone

      public ANZHeader clone()
      Creates a deep copy of this Analyze header.
      Overrides:
      clone in class Object
    • setNCols

      public void setNCols(short nc)
      Sets the number of columns in this Analyze image header. Warning! If this image header is associated with a set of pixel values in an ANZImage object, then manipulating the number of columns in this way will cause errors.
      Parameters:
      nc - the number of columns.
    • setNRows

      public void setNRows(short nr)
      Sets the number of rows in this Analyze image header. Warning! If this image header is associated with a set of pixel values in an ANZImage object, then manipulating the number of rows in this way will cause errors.
      Parameters:
      nr - the number of rows.
    • setNSlices

      public void setNSlices(short ns)
      Sets the number of slices in this Analyze image header. Warning! If this image header is associated with a set of pixel values into an ANZImage object, then manipulating the number of slices in this way will cause errors.
      Parameters:
      ns - the number of slices.
    • setNFrames

      public void setNFrames(short nF)
      Sets the number of frames in this Analyze image header. Warning! If this image header is associated with a set of pixel values in an ANZImage object, then manipulating the number of frames in this way will cause errors.
      Parameters:
      nF - the number of frames.
    • setDims

      public void setDims(Short... dims) throws ANZException
      Sets the number of samples in each dimension of this Analyze image header. Warning! If this image header is associated with a set of pixel values in an ANZImage object, then manipulating the number of samples in this way will cause errors.
      Parameters:
      dims - the number of samples in each of the image dimensions. The number of arguments supplied determines the dimensionality of the image.
      Throws:
      ANZException - if the dimensionality or numbers of samples are illegal.
    • setDims

      public void setDims(Long... dims) throws ANZException
      Sets the number of samples in each dimension of this Analyze image header. Warning! If this image header is associated with a set of pixel values in an ANZImage object, then manipulating the number of samples in this way will cause errors.
      Parameters:
      dims - the number of samples in each of the image dimensions. The number of arguments supplied determines the dimensionality of the image.
      Throws:
      ANZException - if the dimensionality or numbers of samples are illegal.
    • getDBName

      public String getDBName()
      Returns the data base name for this Analyze image header.
      Returns:
      a String representing the data base name.
    • setDBName

      public void setDBName(String name)
      Sets the data base name for this Analyze image header. A suppiled name that is too long will be truncated.
      Parameters:
      name - a String representing the name data base name.
    • getDescription

      public String getDescription()
      Returns the description for this Analyze image header.
      Returns:
      a String representing the description.
    • getMinMax

      public int[] getMinMax()
      Gets the glMin and glMax fields for this Analyze image header. If the min / max fields have not been set, then the min / max values will both be zero.
      Returns:
      an int array of length 2, where the first element is the minimum pixel value in the image, and second element is the maximum pixel value in the image.
    • setMinMax

      public void setMinMax(int min, int max) throws InvalidImageException
      Sets the glMin and glMax fields for this Analyze image header.
      Parameters:
      min - the minimum pixel value in the image.
      max - the maximum pixel value in the image.
      Throws:
      InvalidImageException - if the values supplied are unsuitable, or the values cannot be set.
    • toString

      public String toString()
      Returns the string representation of this Analyze image header.
      Overrides:
      toString in class Object
      Returns:
      a String describing the header.
    • toString

      public String toString(boolean html)
      Returns the string representation of this Analyze image header, with optional presentation in HTML format.
      Parameters:
      html - if true, then the string will contain HTML tags.
      Returns:
      a String describing the header, optionally in HTML format.