Class NIFTI2Image

All Implemented Interfaces:
ReadableImage, WritableImage, InfoStorer, AutoCloseable

public class NIFTI2Image extends NIFTIImage implements InfoStorer, AutoCloseable
This class is a representation of a multi-dimensional image in the NIFTI-2 format, the updated NIFTI format.
  • Constructor Details

    • NIFTI2Image

      public NIFTI2Image()
      Creates an uninitialised instance of a NIFTI2Image. Needed so that newInstance() method can be called on the class.
    • NIFTI2Image

      public NIFTI2Image(long nCols, long nRows, long nSlices, long nFrames, ANZPixFormat dataType) throws ANZException
      Creates a new in-memory NIFTI2Image. This image exists in memory, and will only be written with an explicit write() method call.
      Parameters:
      nCols - the number of columns in the image x-direction.
      nRows - the number of rows in the image y-direction.
      nSlices - the number of slice in the image.
      nFrames - the number of frames (time points) in the image.
      dataType - the ANZPixFormat for the image.
      Throws:
      ANZException - if the image cannot be created.
    • NIFTI2Image

      public NIFTI2Image(ANZPixFormat dataType, Long... dims) throws ANZException
      Creates a new in-memory NIFTI2Image. This image exists in memory, and will only be written with an explicit write() method call.
      Parameters:
      dataType - an ANZPixFormat.
      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 image cannot be created.
    • NIFTI2Image

      public NIFTI2Image(String fileName, FileAccessMode mode) throws InvalidImageException, IOException
      Opens an existing NIFTI2Image.
      Parameters:
      fileName - the name of the image file.
      mode - the access mode for the image.
      Throws:
      InvalidImageException - if the image cannot be opened or loaded, or if mode is invalid.
      FileNotFoundException - if the image file doesn't exist.
      IOException - if an I/O error occurs.
  • Method Details

    • getCommonName

      public static String getCommonName()
      Returns the common name for this type of image.
      Returns:
      the String "NIFTI-2".
    • main

      public static void main(String[] args)
      Run the self-test for the NIFTI2Image class.
      Parameters:
      args - a list of images to try to open.