GreyOrdinates¶
from mcot.cifti.greyordinate import GreyOrdinates
-
class
mcot.cifti.greyordinate.
GreyOrdinates
(data, brain_model_axis: nibabel.cifti2.cifti2_axes.BrainModelAxis, other_axes: Optional[Sequence[nibabel.cifti2.cifti2_axes.Axis]] = None, parent_file=None)[source]¶ Represents data on voxels or vertices.
-
__init__
(data, brain_model_axis: nibabel.cifti2.cifti2_axes.BrainModelAxis, other_axes: Optional[Sequence[nibabel.cifti2.cifti2_axes.Axis]] = None, parent_file=None)[source]¶ Defines a new dataset in greyordinate space.
- Parameters
data – (…, N) array for N greyordinates
brain_model_axis – CIFTI axis describing the greyordinate space
other_axes – sequence of CIFTI axes describing the other dimensions
parent_file – file in which the dataset has been stored
Inheritance diagram
Methods
as_dask
([chunks, name])Returns the greyordinates as a dask array.
empty
(filename, axes[, dtype])Creates an empty file to store the greyordinates with the type determined by the extension:
empty_cifti
(filename, axes[, dtype])Creates an empty greyordinate object based on the axes.
empty_hdf5
(filename, axes[, dtype])Creates an empty greyordinate object based on the axes.
empty_zarr
(filename, axes[, dtype])Creates an empty greyordinate object based on the axes.
from_cifti
(filename[, writable])Creates new greyordinate object from dense CIFTI file.
from_filename
(filename[, mask_values, writable])Reads greyordinate data from the given file.
from_gifti
(filename[, mask_values])Creates a new greyordinate object from a GIFTI file.
from_hdf5
(group)Retrieves data from HDF5 group.
from_nifti
(filename[, mask_values])Creates a new greyordinate object from a NIFTI file.
surface
(anatomy[, fill, partial])Gets a specific surface.
to_cifti
([other_axes])Create a CIFTI image from the data.
to_filename
(filename)Stores the greyordinate data to the given filename.
to_hdf5
(group[, compression])Stores the image in the HDF5 group.
Transposes a dense connectome.
volume
()Get the volumetric data as a Nifti1Image.
-
as_dask¶
empty¶
-
classmethod
GreyOrdinates.
empty
(filename, axes, dtype=<class 'float'>)[source]¶ Creates an empty file to store the greyordinates with the type determined by the extension:
.nii: CIFTI file
.h5/hdf5/he2/he5: HDF5 file representing CIFTI data
.zarr: zarr file representing CIFTI data
- Parameters
filename – target filename
axes – cifti2 axes
dtype – data type of array
- Returns
Greyordinate object where CIFTI data can be stored
empty_cifti¶
-
classmethod
GreyOrdinates.
empty_cifti
(filename, axes, dtype=<class 'float'>)[source]¶ Creates an empty greyordinate object based on the axes.
Data will be stored on disk in CIFTI format
- Parameters
filename – filename to store the CIFTI file in
axes – cifti2 axes
dtype – data type of array
- Returns
Greyordinate object where the data is stored in the new HDF5 file
empty_hdf5¶
-
classmethod
GreyOrdinates.
empty_hdf5
(filename, axes, dtype=<class 'float'>)[source]¶ Creates an empty greyordinate object based on the axes.
Data will be stored on disk in an HDF5 file
- Parameters
filename – filename to store the HDF5 file in or HDF5 group
axes – cifti2 axes
dtype – data type of array
- Returns
Greyordinate object where the data is stored in the new HDF5 file
empty_zarr¶
-
classmethod
GreyOrdinates.
empty_zarr
(filename, axes, dtype=<class 'float'>)[source]¶ Creates an empty greyordinate object based on the axes.
Data will be stored on disk in an HDF5 file
- Parameters
filename – filename to store the HDF5 file in or HDF5 group
axes – cifti2 axes
dtype – data type of array
- Returns
Greyordinate object where the data is stored in the new HDF5 file
from_cifti¶
from_filename¶
-
classmethod
GreyOrdinates.
from_filename
(filename, mask_values=(0, nan), writable=False)[source]¶ Reads greyordinate data from the given file.
File can be:
NIFTI mask
GIFTI mask
CIFTI file
HDF5 file representing CIFTI data
zarr file representing CIFTI data
- Parameters
filename – input filename
mask_values – which values are outside of the mask for NIFTI or GIFTI input
writable – allow to write to disk
- Returns
greyordinates object
from_gifti¶
from_nifti¶
surface¶
-
GreyOrdinates.
surface
(anatomy, fill=nan, partial=False)[source]¶ Gets a specific surface.
- Parameters
anatomy – BrainStructure or string like ‘CortexLeft’ or ‘CortexRight’
fill – which value to fill the array with if not all vertices are defined
partial – only return the part of the surface defined in the greyordinate file (ignores fill if set)
- Returns
if not partial: (…, n_vertices) array
if partial: (N, ) int array with indices on the surface included in (…, N) array
to_cifti¶
to_filename¶
-
GreyOrdinates.
to_filename
(filename)[source]¶ Stores the greyordinate data to the given filename.
Type of storage is determined by the extension of the filename:
.dscalar/dconn/dlabel.nii: CIFTI file
.h5/hdf5/he2/he5: HDF5 file representing CIFTI data
.zarr: zarr file representing CIFTI data
- .gii: GIFTI file (only stores surface data;
raises error if more that one surface is represented in the greyordinates)
.nii: NIFTI file (only stores the volumetric data)
- Parameters
filename – target filename