Class WunilDataset

java.lang.Object
mgui.io.standard.nifti.Nifti1Dataset
mgui.io.foreign.wunil.WunilDataset
All Implemented Interfaces:
VolumeMetadata

public class WunilDataset
extends Nifti1Dataset
implements VolumeMetadata
Extension of Nifti1Dataset to allow data to be read from the WUNIL *.ifh format (used with Caret). Also handles Caret metadata for region names; i.e., uses them to fill a NameMap.
Since:
1.0
Version:
1.0
Author:
Andrew Reid
  • Field Details

    • origin

      public float[] origin
    • name_map

      public NameMap name_map
    • 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

    • WunilDataset

      public WunilDataset()
    • WunilDataset

      public WunilDataset​(java.lang.String filename)
  • 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
    • 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
    • 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
    • setHeaderFilename

      public void setHeaderFilename​(java.lang.String s)
      Description copied from class: Nifti1Dataset
      Set the filename for the dataset header file
      Overrides:
      setHeaderFilename in class Nifti1Dataset
      Parameters:
      s - filename for the dataset header file
    • setDataFilename

      public void setDataFilename​(java.lang.String s)
      Description copied from class: Nifti1Dataset
      Set the filename for the dataset data file
      Overrides:
      setDataFilename in class Nifti1Dataset
      Parameters:
      s - filename for the dataset data file
    • 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
    • readDoubleVol

      public double[][][] readDoubleVol​(short ttt) throws java.io.IOException
      Read one 3D volume from disk and return it as 3D double array.

      NB. this is copied verbatim from Nifti1Dataset, since it makes its fields private...

      Overrides:
      readDoubleVol in class Nifti1Dataset
      Parameters:
      ttt - T dimension of vol to read (0 based index)
      Returns:
      3D double array, scale and offset have been applied. Array indices are [Z][Y][X], assuming an xyzt ordering of dimensions. ie indices are data[dim[3]][dim[2]][dim[1]]
      Throws:
      java.io.IOException
    • readHeader

      public void readHeader() throws java.io.IOException, java.io.FileNotFoundException
      Read header information into memory.
      Overrides:
      readHeader in class Nifti1Dataset
      Throws:
      java.io.IOException
      java.io.FileNotFoundException
    • 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.
    • getDataType

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