cortex.dataset.Volume

class cortex.dataset.Volume(data, subject, xfmname, mask=None, cmap=None, vmin=None, vmax=None, description='', **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

Methods

__init__(data, subject, xfmname[, mask, …])

Initialize self.

copy(data)

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)

map([projection])

Convert this VolumeData into VertexData using the given projection method.

random(subject, xfmname, **kwargs)

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])

TODO: WHAT IS THIS

Attributes

data

name

Name of this BrainData, computed from hash of data.

priority

raw

volume

Returns a 3D or 4D volume for this VolumeData, automatically unmasking masked data.