Class FSLVolumeMetadata

java.lang.Object
mgui.io.foreign.fsl.FSLVolumeMetadata
All Implemented Interfaces:
VolumeMetadata

public class FSLVolumeMetadata
extends java.lang.Object
implements VolumeMetadata
Metadata for a FSL-style volume file (mgh/mgz).

See http://ftp.nmr.mgh.harvard.edu/fswiki/FsTutorial/MghFormat

Since:
1.0
Version:
1.0
Author:
Andrew Reid
  • Field Summary

    Fields
    Modifier and Type Field Description
    protected Box3D bounds  
    protected int[] data_dims  
    protected java.io.File data_file  
    protected int data_type  
    protected long header_offset  
    static int MGZ_TYPE_FLOAT  
    static int MGZ_TYPE_INT  
    static int MGZ_TYPE_SHORT  
    static int MGZ_TYPE_UCHAR  
    protected int voxel_dim  
  • Constructor Summary

    Constructors
    Constructor Description
    FSLVolumeMetadata()  
    FSLVolumeMetadata​(java.io.File file)  
  • Method Summary

    Modifier and Type Method Description
    org.jogamp.vecmath.Vector3f[] getAxes()
    Returns the S, T, and R axes of this volume, respectively.
    Box3D getBounds()
    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.
    int[] getDataDims()
    The data dimensions: (x, y, z) or (x, y, z, t).
    int getDataType()
    The data type; must correspond to DataBuffer types.
    float[] getGeomDims()
    The geometric dimensions of the volume (x, y, z) or (S, T, R) in texture coordinates.
    org.jogamp.vecmath.Point3f getOrigin()
    The geometric origin of the volume as a Point3f.
    int getVoxelDim()
    Returns the intravoxel dimension (e.g., time or vector/tensor information)
    void readHeader​(java.io.File header)
    Reads header information from file.
    java.util.ArrayList<MguiNumber> readVolume​(int t, DataType data_type, ProgressUpdater progress)
    Reads the 3D volume at voxel dimension t.
    java.util.ArrayList<MguiNumber> readVolume​(java.io.File data_file, int t, DataType data_type, ProgressUpdater progress)
    Reads the 3D volume at the specified volume t, from data_file.
    void setAxes​(org.jogamp.vecmath.Vector3f[] axes)
    Sets the S, T, and R axes of this volume.
    void setDataDims​(int[] dims)
    Sets the data dimensions
    void setDataType​(int type)
    Sets the data type; must correspond to DataBuffer types.
    void setFromMetadata​(VolumeMetadata metadata)
    Sets this metadata from another metadata object.
    void setFromVolume​(Volume3DInt volume)
    Sets this metadata from volume.
    void setFromVolume​(Volume3DInt volume, java.lang.String column)
    Sets this metadata from grid, for the specified column.
    void setGeomDims​(float[] dims)
    Sets the geometric dimensions
    void setOrigin​(org.jogamp.vecmath.Point3f origin)
    Sets the origin
    void setVoxelDim​(int t)
    Sets the intravoxel dimension (e.g., time or vector/tensor information)

    Methods inherited from class java.lang.Object

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

    • MGZ_TYPE_UCHAR

      public static final int MGZ_TYPE_UCHAR
      See Also:
      Constant Field Values
    • MGZ_TYPE_SHORT

      public static final int MGZ_TYPE_SHORT
      See Also:
      Constant Field Values
    • MGZ_TYPE_INT

      public static final int MGZ_TYPE_INT
      See Also:
      Constant Field Values
    • MGZ_TYPE_FLOAT

      public static final int MGZ_TYPE_FLOAT
      See Also:
      Constant Field Values
    • data_dims

      protected int[] data_dims
    • data_type

      protected int data_type
    • bounds

      protected Box3D bounds
    • voxel_dim

      protected int voxel_dim
    • data_file

      protected java.io.File data_file
    • header_offset

      protected long header_offset
  • Constructor Details

    • FSLVolumeMetadata

      public FSLVolumeMetadata()
    • FSLVolumeMetadata

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

    • setFromMetadata

      public void setFromMetadata​(VolumeMetadata metadata)
      Description copied from interface: VolumeMetadata
      Sets this metadata from another metadata object.
      Specified by:
      setFromMetadata 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.
    • 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:
    • 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
    • getDataType

      public int getDataType()
      Description copied from interface: VolumeMetadata
      The data type; must correspond to DataBuffer types.
      Specified by:
      getDataType in interface VolumeMetadata
      Returns:
    • 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:
    • 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:
    • setDataDims

      public void setDataDims​(int[] dims)
      Description copied from interface: VolumeMetadata
      Sets the data dimensions
      Specified by:
      setDataDims in interface VolumeMetadata
    • 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.
    • setGeomDims

      public void setGeomDims​(float[] dims)
      Description copied from interface: VolumeMetadata
      Sets the geometric dimensions
      Specified by:
      setGeomDims in interface VolumeMetadata
    • 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
    • setOrigin

      public void setOrigin​(org.jogamp.vecmath.Point3f origin)
      Description copied from interface: VolumeMetadata
      Sets the origin
      Specified by:
      setOrigin 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
    • 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
    • readHeader

      public void readHeader​(java.io.File header) throws java.io.IOException
      Reads header information from file.
      Parameters:
      header -
      Throws:
      java.io.IOException
    • readVolume

      public java.util.ArrayList<MguiNumber> readVolume​(java.io.File data_file, int t, DataType data_type, ProgressUpdater progress) throws java.io.IOException
      Reads the 3D volume at the specified volume t, from data_file.
      Parameters:
      data_file -
      t -
      data_type -
      Returns:
      Throws:
      java.io.IOException
    • 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