Class NiftiMetadata

java.lang.Object
mgui.io.standard.nifti.Nifti1Dataset
mgui.io.standard.nifti.NiftiMetadata
All Implemented Interfaces:
java.io.Serializable, VolumeMetadata

public class NiftiMetadata
extends Nifti1Dataset
implements java.io.Serializable, VolumeMetadata
Data structure to store header information for Analyze 7.5 format volume files.

Note for setting values

To ensure proper functionality when setting values from a grid, the following order should be observed:

  1. Data dimensions
  2. Geometric dimensions
  3. Origin
Since:
1.0
Version:
1.0
Author:
Andrew Reid
See Also:
Serialized Form
  • Field Details

    • byteOrder

      public java.nio.ByteOrder byteOrder
    • compress

      public boolean compress
    • axis_s

      protected org.jogamp.vecmath.Vector3f axis_s
    • axis_t

      protected org.jogamp.vecmath.Vector3f axis_t
    • axis_r

      protected org.jogamp.vecmath.Vector3f axis_r
  • Constructor Details

    • NiftiMetadata

      public NiftiMetadata()
    • NiftiMetadata

      public NiftiMetadata​(java.io.File file)
  • Method Details

    • readFromFile

      public void readFromFile​(java.io.File input)
    • readVolume

      public java.util.ArrayList<MguiNumber> readVolume​(int t, DataType data_type, ProgressUpdater progress) throws java.io.IOException
      Description copied from interface: VolumeMetadata
      Reads the 3D volume at voxel dimension t.
      Specified by:
      readVolume in interface VolumeMetadata
      Returns:
      Throws:
      java.io.IOException
    • writeToFile

      public void writeToFile​(java.io.File output)
    • writeHeader

      public void writeHeader() throws java.io.IOException, java.io.FileNotFoundException
      Description copied from class: Nifti1Dataset
      Write header information to disk file
      Overrides:
      writeHeader in class Nifti1Dataset
      Throws:
      java.io.IOException
      java.io.FileNotFoundException
    • setFromMetadata

      public void setFromMetadata​(VolumeMetadata metadata)
      Description copied from interface: VolumeMetadata
      Sets this metadata from another metadata object.
      Specified by:
      setFromMetadata in interface VolumeMetadata
    • getChannelSize

      public int getChannelSize()
    • getDataType

      public int getDataType()
      Description copied from interface: VolumeMetadata
      The data type; must correspond to DataBuffer types.
      Specified by:
      getDataType in interface VolumeMetadata
      Returns:
    • isNifti

      public boolean isNifti()
    • setFromVolume

      public void setFromVolume​(Volume3DInt volume)
      Description copied from interface: VolumeMetadata
      Sets this metadata from volume.
      Specified by:
      setFromVolume in interface VolumeMetadata
    • setFromVolume

      public void setFromVolume​(Volume3DInt volume, java.lang.String column)
      Description copied from interface: VolumeMetadata
      Sets this metadata from grid, for the specified column.
      Specified by:
      setFromVolume in interface VolumeMetadata
    • getAxes

      public org.jogamp.vecmath.Vector3f[] getAxes()
      Description copied from interface: VolumeMetadata
      Returns the S, T, and R axes of this volume, respectively.
      Specified by:
      getAxes in interface VolumeMetadata
      Returns:
    • setAxes

      public void setAxes​(org.jogamp.vecmath.Vector3f[] axes)
      Description copied from interface: VolumeMetadata
      Sets the S, T, and R axes of this volume.
      Specified by:
      setAxes in interface VolumeMetadata
      Parameters:
      axes - Three vectors, in the order S, T, and R.
    • getVoxelDim

      public int getVoxelDim()
      Description copied from interface: VolumeMetadata
      Returns the intravoxel dimension (e.g., time or vector/tensor information)
      Specified by:
      getVoxelDim in interface VolumeMetadata
      Returns:
    • setVoxelDim

      public void setVoxelDim​(int t)
      Description copied from interface: VolumeMetadata
      Sets the intravoxel dimension (e.g., time or vector/tensor information)
      Specified by:
      setVoxelDim in interface VolumeMetadata
    • getDataDims

      public int[] getDataDims()
      Description copied from interface: VolumeMetadata
      The data dimensions: (x, y, z) or (x, y, z, t).
      Specified by:
      getDataDims in interface VolumeMetadata
      Returns:
      The data dimensions.
    • getGeomDims

      public float[] getGeomDims()
      Description copied from interface: VolumeMetadata
      The geometric dimensions of the volume (x, y, z) or (S, T, R) in texture coordinates. Note this is the distance from the center point of the origin voxel to the center point of the last voxel in the direction of the axis. The geometric extent of the bounding box will be a full voxel length larger, in order to place the voxel centers at the correct coordinate.
      Specified by:
      getGeomDims in interface VolumeMetadata
      Returns:
      The geometric dimensions of the volume.
    • getOrigin

      public org.jogamp.vecmath.Point3f getOrigin()
      Description copied from interface: VolumeMetadata
      The geometric origin of the volume as a Point3f. Note that this is the center point of the origin voxel. The origin of the bounding box will be a half voxel displaced from this point, to place its center point correctly. Metadata handlers must adjust according to the policy of their data formats, to return the correct coordinates.
      Specified by:
      getOrigin in interface VolumeMetadata
      Returns:
      The geometric origin of the volume
    • getBounds

      public Box3D getBounds()
      Description copied from interface: VolumeMetadata
      The geometric bounds of this volume; note that the bounding box will be scaled up by one voxel length in each axis direction, and its origin will be shifted a half voxel, such that voxel center points are positioned correctly.
      Specified by:
      getBounds in interface VolumeMetadata
      Returns:
    • validateBounds

      protected boolean validateBounds​(Box3D box)
    • setDataDims

      public void setDataDims​(int[] dims)
      Description copied from interface: VolumeMetadata
      Sets the data dimensions
      Specified by:
      setDataDims in interface VolumeMetadata
    • setDataType

      public void setDataType​(int type)
      Description copied from interface: VolumeMetadata
      Sets the data type; must correspond to DataBuffer types. Note that this is the origin of the bounding box; thus the corner of the first voxel, rather than its center point. Metadata handlers must adjust according to the policy of their data formats.
      Specified by:
      setDataType in interface VolumeMetadata
    • getDataTypeString

      protected java.lang.String getDataTypeString​(int type)
    • setGeomDims

      public void setGeomDims​(float[] dims)
      Description copied from interface: VolumeMetadata
      Sets the geometric dimensions
      Specified by:
      setGeomDims in interface VolumeMetadata
    • setOrigin

      public void setOrigin​(org.jogamp.vecmath.Point3f origin)
      Description copied from interface: VolumeMetadata
      Sets the origin
      Specified by:
      setOrigin in interface VolumeMetadata