Class NIFTIHeader

java.lang.Object
com.xinapse.multisliceimage.analyze.ANZHeader
com.xinapse.multisliceimage.analyze.NIFTIHeader
Direct Known Subclasses:
NIFTI2Header

public class NIFTIHeader extends ANZHeader
This class represents a multi-dimensional NIFTI-1 image header file. The header file may either:
  • contain all the dimensional and descriptive information about a NIFTI-1 image, but none of the pixel data. This is the conventional Analyze 7.5 .img/.hdr file format.
  • contain both the dimensional and descriptive information about a NIFTI-1 image, and also the pixel data. This is the new NIFTI-1 .nii file format.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final boolean
    The default setting of whether NIFTI-1 images that have qform and sform orientation both unset should be read as having an increasing a patient left coordinate value with stored pixel data column number, and whether NIFTI-1 images should be prevented from being written without orientation information.
    static final boolean
    The default setting of whether NIFTI-1 images should be saved with an orientation that is compatible with FSL, where possible.
    static final boolean
    The default setting of whether NIFTI-1 images should be saved with an orientation that is compatible with SPM, where possible.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Returns a new NIFTIHeader, copying from an existing one.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Returns whether NIFTI images with both qform and sform orientations unset should be read as having the patient left coordinate increasing with stored pixel data column number, and whether NIFTI-1 images should be prevented from being written without orientation information.
    static boolean
    Returns the user's preference about whether NIFTI-1 images with both qform and sform orientations unset should be read as having the patient left coordinate increasing with stored pixel data column number, and whether NIFTI-1 images should be prevented from being written without orientation information.
    static boolean
    Returns the user's preference about whether NIFTI-1 images should be saved with an orientation that is compatible with FSL, where possible.
    static boolean
    Returns the user's preference about whether NIFTI-1 images should be saved with an orientation that is compatible with SPM, where possible.
    static boolean
    Returns whether NIFTI images should be saved with an orientation that is compatible with FSL, where possible.
    static boolean
    Returns whether NIFTI images should be saved with an orientation that is compatible with SPM, where possible.
    static void
    Saves the user's preference about whether NIFTI-1 images should be read as having the patient left coordinate increasing with stored pixel data column number.
    static void
    Saves the user's preference about whether NIFTI-1 images should be saved with an orientation that is compatible with FSL, where possible.
    static void
    Saves the user's preference about whether NIFTI-1 images should be saved with an orientation that is compatible with SPM, where possible.
    void
    setImageOrientationPositionPatient(org.jogamp.vecmath.Vector3f[] orientation, org.jogamp.vecmath.Point3f position, boolean force)
     
    Returns a String representation of this NIFTIHeader.
    toString(boolean html)
    Returns the string representation of this NIFTI-1 compliant image header, with optional presentation in HTML format.

    Methods inherited from class Object

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

    • DEFAULT_SAVE_FSL_ORIENT

      public static final boolean DEFAULT_SAVE_FSL_ORIENT
      The default setting of whether NIFTI-1 images should be saved with an orientation that is compatible with FSL, where possible.
      See Also:
    • DEFAULT_SAVE_SPM_ORIENT

      public static final boolean DEFAULT_SAVE_SPM_ORIENT
      The default setting of whether NIFTI-1 images should be saved with an orientation that is compatible with SPM, where possible.
      See Also:
    • DEFAULT_FSL_COMPATIBLE_NIFTI

      public static final boolean DEFAULT_FSL_COMPATIBLE_NIFTI
      The default setting of whether NIFTI-1 images that have qform and sform orientation both unset should be read as having an increasing a patient left coordinate value with stored pixel data column number, and whether NIFTI-1 images should be prevented from being written without orientation information.
      See Also:
  • Constructor Details

    • NIFTIHeader

      public NIFTIHeader(NIFTIHeader hdr)
      Returns a new NIFTIHeader, copying from an existing one.
      Parameters:
      hdr - the NIFTI-1 header to copy from.
  • Method Details

    • getSaveFSLOrient

      public static boolean getSaveFSLOrient()
      Returns whether NIFTI images should be saved with an orientation that is compatible with FSL, where possible. The value is obtained either from the System Property "nifti.fslorient" (preferentially) or the user's preference.
      Returns:
      whether NIFTI-1 images should be saved with an orientation that is compatible with FSL, where possible.
    • getPreferredSaveFSLOrient

      public static boolean getPreferredSaveFSLOrient()
      Returns the user's preference about whether NIFTI-1 images should be saved with an orientation that is compatible with FSL, where possible. FSL is not able to correctly display images with an orientation that is not in the expected orientation. If interoperating with FSL, it may be necessary to save images in an FSL-friendly orientation. If not set in the user's preferences, then the default is to save NIFTI-1 images with a radiological orientation.
      Returns:
      thr user's preference for whether NIFTI-1 images should be saved with an orientation that is compatible with FSL, where possible.
    • savePreferredSaveFSLOrient

      public static void savePreferredSaveFSLOrient(boolean b)
      Saves the user's preference about whether NIFTI-1 images should be saved with an orientation that is compatible with FSL, where possible.
      Parameters:
      b - true if NIFTI-1 images should have an orientation that is compatible with FSL, where possible; false otherwise.
    • getSaveSPMOrient

      public static boolean getSaveSPMOrient()
      Returns whether NIFTI images should be saved with an orientation that is compatible with SPM, where possible. The value is obtained either from the System Property "nifti.spmorient" (preferentially) or the user's preference.
      Returns:
      whether NIFTI-1 images should be saved with an orientation that is compatible with SPM, where possible.
    • getPreferredSaveSPMOrient

      public static boolean getPreferredSaveSPMOrient()
      Returns the user's preference about whether NIFTI-1 images should be saved with an orientation that is compatible with SPM, where possible. SPM is not able to correctly display images with an orientation that is not in the expected orientation. If interoperating with SPM, it may be necessary to save images in an SPM-friendly orientation. If not set in the user's preferences, then the default is to save NIFTI-1 images with a radiological orientation.
      Returns:
      whether NIFTI-1 images should be saved with an orientation that is compatible with SPM, where possible.
    • savePreferredSaveSPMOrient

      public static void savePreferredSaveSPMOrient(boolean b)
      Saves the user's preference about whether NIFTI-1 images should be saved with an orientation that is compatible with SPM, where possible.
      Parameters:
      b - true if NIFTI-1 images should have an orientation that is compatible with SPM, where possible; false otherwise.
    • getFSLCompatibleNIFTI

      public static boolean getFSLCompatibleNIFTI()
      Returns whether NIFTI images with both qform and sform orientations unset should be read as having the patient left coordinate increasing with stored pixel data column number, and whether NIFTI-1 images should be prevented from being written without orientation information. This may be necessary if interoperating with FSL.
      Returns:
      whether NIFTI-1 images should be saved with an orientation that is compatible with SPM, where possible.
    • getPreferredFSLCompatibleNIFTI

      public static boolean getPreferredFSLCompatibleNIFTI()
      Returns the user's preference about whether NIFTI-1 images with both qform and sform orientations unset should be read as having the patient left coordinate increasing with stored pixel data column number, and whether NIFTI-1 images should be prevented from being written without orientation information. This may be necessary if interoperating with FSL.

      If not set in the user's preferences, then the default is to interpret NIFTI-1 images as axial with an increasing patient right coordinate with increasing column number.

      Returns:
      whether NIFTI-1 images with both qform and sform unset should be interpreted as having an increasing left coordinate with stored pixel data column number.
    • savePreferredFSLCompatibleNIFTI

      public static void savePreferredFSLCompatibleNIFTI(boolean b)
      Saves the user's preference about whether NIFTI-1 images should be read as having the patient left coordinate increasing with stored pixel data column number.
      Parameters:
      b - true if NIFTI-1 images should be read as having the patient left coordinate increasing with stored pixel data column number; false otherwise.
    • setImageOrientationPositionPatient

      public void setImageOrientationPositionPatient(org.jogamp.vecmath.Vector3f[] orientation, org.jogamp.vecmath.Point3f position, boolean force)
    • toString

      public String toString()
      Returns a String representation of this NIFTIHeader.
      Overrides:
      toString in class ANZHeader
      Returns:
      a String describing this NIFTIHeader.
    • toString

      public String toString(boolean html)
      Returns the string representation of this NIFTI-1 compliant 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.