Package mgui.io.foreign.wunil
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 Summary
Fields Modifier and Type Field Description protected org.jogamp.vecmath.Vector3f
axis_r
protected org.jogamp.vecmath.Vector3f
axis_s
protected org.jogamp.vecmath.Vector3f
axis_t
NameMap
name_map
float[]
origin
Fields inherited from class mgui.io.standard.nifti.Nifti1Dataset
ANZ_DAT_EXT, ANZ_HDR_EXT, ANZ_HDR_SIZE, ANZ_MAGIC_STRING, aux_file, big_endian, bitpix, cal_max, cal_min, data_type_string, datatype, db_name, descrip, dim, dim_info, DIM5, DIM6, DIM7, ds_datname, ds_hdrname, ds_is_nii, DT_ALL, DT_BINARY, DT_NONE, EXT_KEY_SIZE, extension, extents, freq_dim, glmax, glmin, GZIP_EXT, intent, intent_code, intent_name, magic, NI1_EXT, NIFTI_FIRST_STATCODE, NIFTI_INTENT_BETA, NIFTI_INTENT_BINOM, NIFTI_INTENT_CHI, NIFTI_INTENT_CHISQ, NIFTI_INTENT_CHISQ_NONC, NIFTI_INTENT_CORREL, NIFTI_INTENT_DISPVECT, NIFTI_INTENT_ESTIMATE, NIFTI_INTENT_EXTVAL, NIFTI_INTENT_FTEST, NIFTI_INTENT_FTEST_NONC, NIFTI_INTENT_GAMMA, NIFTI_INTENT_GENMATRIX, NIFTI_INTENT_INVGAUSS, NIFTI_INTENT_LABEL, NIFTI_INTENT_LAPLACE, NIFTI_INTENT_LOGISTIC, NIFTI_INTENT_NEURONAME, NIFTI_INTENT_NONE, NIFTI_INTENT_NORMAL, NIFTI_INTENT_POINTSET, NIFTI_INTENT_POISSON, NIFTI_INTENT_PVAL, NIFTI_INTENT_QUATERNION, NIFTI_INTENT_SYMMATRIX, NIFTI_INTENT_TRIANGLE, NIFTI_INTENT_TTEST, NIFTI_INTENT_TTEST_NONC, NIFTI_INTENT_UNIFORM, NIFTI_INTENT_VECTOR, NIFTI_INTENT_WEIBULL, NIFTI_INTENT_ZSCORE, NIFTI_LAST_STATCODE, NIFTI_SLICE_ALT_DEC, NIFTI_SLICE_ALT_INC, NIFTI_SLICE_SEQ_DEC, NIFTI_SLICE_SEQ_INC, NIFTI_TYPE_COMPLEX128, NIFTI_TYPE_COMPLEX256, NIFTI_TYPE_COMPLEX64, NIFTI_TYPE_FLOAT128, NIFTI_TYPE_FLOAT32, NIFTI_TYPE_FLOAT64, NIFTI_TYPE_INT16, NIFTI_TYPE_INT32, NIFTI_TYPE_INT64, NIFTI_TYPE_INT8, NIFTI_TYPE_RGB24, NIFTI_TYPE_UINT16, NIFTI_TYPE_UINT32, NIFTI_TYPE_UINT64, NIFTI_TYPE_UINT8, NIFTI_UNITS_HZ, NIFTI_UNITS_METER, NIFTI_UNITS_MICRON, NIFTI_UNITS_MM, NIFTI_UNITS_MSEC, NIFTI_UNITS_PPM, NIFTI_UNITS_SEC, NIFTI_UNITS_UNKNOWN, NIFTI_UNITS_USEC, NIFTI_XFORM_ALIGNED_ANAT, NIFTI_XFORM_MNI_152, NIFTI_XFORM_SCANNER_ANAT, NIFTI_XFORM_TALAIRACH, NIFTI_XFORM_UNKNOWN, NII_HDR_SIZE, NII_MAGIC_STRING, phase_dim, pixdim, qfac, qform_code, qoffset, quatern, regular, scl_inter, scl_slope, session_error, sform_code, sizeof_hdr, slice_code, slice_dim, slice_duration, slice_end, slice_start, srow_x, srow_y, srow_z, t_unit_code, TDIM, toffset, vox_offset, XDIM, xyz_unit_code, xyzt_units, YDIM, ZDIM
-
Constructor Summary
Constructors Constructor Description WunilDataset()
WunilDataset(java.lang.String filename)
-
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 toDataBuffer
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 aPoint3f
.int
getVoxelDim()
Returns the intravoxel dimension (e.g., time or vector/tensor information)double[][][]
readDoubleVol(short ttt)
Read one 3D volume from disk and return it as 3D double array.void
readHeader()
Read header information into memory.java.util.ArrayList<MguiNumber>
readVolume(int t, DataType data_type, ProgressUpdater progress)
Reads the 3D volume at voxel dimensiont
.void
setAxes(org.jogamp.vecmath.Vector3f[] axes)
Sets the S, T, and R axes of this volume.void
setDataDims(int[] dims)
Sets the data dimensionsvoid
setDataFilename(java.lang.String s)
Set the filename for the dataset data filevoid
setDataType(int type)
Sets the data type; must correspond toDataBuffer
types.void
setFromMetadata(VolumeMetadata metadata)
Sets this metadata from another metadata object.void
setFromVolume(Volume3DInt volume)
Sets this metadata fromvolume
.void
setFromVolume(Volume3DInt volume, java.lang.String column)
Sets this metadata fromgrid
, for the specified column.void
setGeomDims(float[] dims)
Sets the geometric dimensionsvoid
setHeaderFilename(java.lang.String s)
Set the filename for the dataset header filevoid
setOrigin(org.jogamp.vecmath.Point3f origin)
Sets the originvoid
setVoxelDim(int t)
Sets the intravoxel dimension (e.g., time or vector/tensor information)Methods inherited from class mgui.io.standard.nifti.Nifti1Dataset
addExtension, bytesPerVoxel, checkHeader, copyHeader, decodeDatatype, decodeIntent, decodeSliceOrder, decodeUnits, decodeXform, exists, existsDat, existsHdr, getBitpix, getDataFilename, getDatatype, getExtensionsList, getGzTempFile, getHeaderFilename, main, printDoubleTmcrs, printHeader, readData, readDoubleTmcrs, removeExtension, setDatatype, setDims, writeData, writeHeader, writeVol
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
origin
public float[] origin -
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
Description copied from interface:VolumeMetadata
Sets this metadata from another metadata object.- Specified by:
setFromMetadata
in interfaceVolumeMetadata
-
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 interfaceVolumeMetadata
- 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 interfaceVolumeMetadata
- 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 interfaceVolumeMetadata
- 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 interfaceVolumeMetadata
-
setFromVolume
Description copied from interface:VolumeMetadata
Sets this metadata fromvolume
.- Specified by:
setFromVolume
in interfaceVolumeMetadata
-
setFromVolume
Description copied from interface:VolumeMetadata
Sets this metadata fromgrid
, for the specified column.- Specified by:
setFromVolume
in interfaceVolumeMetadata
-
setHeaderFilename
public void setHeaderFilename(java.lang.String s)Description copied from class:Nifti1Dataset
Set the filename for the dataset header file- Overrides:
setHeaderFilename
in classNifti1Dataset
- 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 classNifti1Dataset
- 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.IOExceptionDescription copied from interface:VolumeMetadata
Reads the 3D volume at voxel dimensiont
.- Specified by:
readVolume
in interfaceVolumeMetadata
- Returns:
- Throws:
java.io.IOException
-
readDoubleVol
public double[][][] readDoubleVol(short ttt) throws java.io.IOExceptionRead 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 classNifti1Dataset
- 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.FileNotFoundExceptionRead header information into memory.- Overrides:
readHeader
in classNifti1Dataset
- 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 interfaceVolumeMetadata
- Returns:
- The data dimensions.
-
getDataType
public int getDataType()Description copied from interface:VolumeMetadata
The data type; must correspond toDataBuffer
types.- Specified by:
getDataType
in interfaceVolumeMetadata
- 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 interfaceVolumeMetadata
- 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 aPoint3f
. 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 interfaceVolumeMetadata
- Returns:
- The geometric origin of the volume
-
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 interfaceVolumeMetadata
- Returns:
-
setDataDims
public void setDataDims(int[] dims)Description copied from interface:VolumeMetadata
Sets the data dimensions- Specified by:
setDataDims
in interfaceVolumeMetadata
-
setDataType
public void setDataType(int type)Description copied from interface:VolumeMetadata
Sets the data type; must correspond toDataBuffer
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 interfaceVolumeMetadata
-
setGeomDims
public void setGeomDims(float[] dims)Description copied from interface:VolumeMetadata
Sets the geometric dimensions- Specified by:
setGeomDims
in interfaceVolumeMetadata
-
setOrigin
public void setOrigin(org.jogamp.vecmath.Point3f origin)Description copied from interface:VolumeMetadata
Sets the origin- Specified by:
setOrigin
in interfaceVolumeMetadata
-