cortex.dataset.Volume¶
- class cortex.dataset.Volume(data: NDArray, subject: str, xfmname: str, mask: NDArray | None = None, cmap: str | None = None, vmin: float | None = None, vmax: float | None = None, description: str = '', **kwargs)[source]¶
Encapsulates a 3D volume or 4D volumetric movie. Includes information on how the volume should be colormapped for display purposes.
- Parameters:
- datandarray
The data. Can be 3D with shape (z,y,x), 1D with shape (v,) for masked data, 4D with shape (t,z,y,x), or 2D with shape (t,v). For masked data, if the size of the given array matches any of the existing masks in the database, that mask will automatically be loaded. If it does not, an error will be raised.
- subjectstr
Subject identifier. Must exist in the pycortex database.
- xfmnamestr
Transform name. Must exist in the pycortex database.
- maskndarray, optional
Binary 3D array with shape (z,y,x) showing which voxels are selected. If masked data is given, the mask will automatically be loaded if it exists in the pycortex database.
- cmapstr or matplotlib colormap, optional
Colormap (or colormap name) to use. If not given defaults to matplotlib default colormap.
- vminfloat, optional
Minimum value in colormap. If not given, defaults to the 1st percentile of the data.
- vmaxfloat, optional
Maximum value in colormap. If not given defaults to the 99th percentile of the data.
- descriptionstr, optional
String describing this dataset. Displayed in webgl viewer.
- **kwargs
- All additional arguments in kwargs are passed to the VolumeData and Dataview.
- stateuntyped
role unclear
- priorityint (default = 1)
controls the order in which datasets are viewed in webgl
- stimstr
path to stimulus file
- ratenumeric (default 1)
frame rate for movie/time series playback in webgl
- delaynumeric (default 0)
delay for movie/time series playback in webgl
- filterstr
interpolation filter for volumetric rendering in webgl (nearest/trilinear/nearlin/debug)
Methods
__init__(data, subject, xfmname[, mask, ...])copy(data)Create a new instance of this Dataview's class, reusing its display settings (cmap, vmin, vmax, description, state, attrs).
empty(subject, xfmname[, value])Create a constant-valued VolumeData for the given subject and xfmname.
exp()Return copy of this brain data with data exponentiated.
from_hdf(node[, subject])Reconstruct a Dataview from a /views/<name> node in an HDF5 file previously written by Dataview._write_hdf.
Returns a dictionary with cmap information.
map([projection])Convert this VolumeData into VertexData using the given projection method.
random(subject, xfmname[, random_type, ...])Create a random-valued VolumeData for the given subject and xfmname.
save(filename[, name])Save the dataset into the hdf file filename with the provided name.
save_nii(filename)Save as a nifti file at the given filename.
to_json([simple])Creates JSON description of this brain data.
uniques([collapse])Yield the underlying BrainData object(s) this view is built from.
Attributes
Name of this BrainData, computed from hash of data.
Colormap this Volume's data into an RGBA VolumeRGB.
Returns a 3D or 4D volume for this VolumeData, automatically unmasking masked data.