Module: labs.datasets.volumes.volume_data

Inheritance diagram for nipy.labs.datasets.volumes.volume_data:

Inheritance diagram of nipy.labs.datasets.volumes.volume_data

The volume data class

This class represents indexable data embedded in a 3D space


class nipy.labs.datasets.volumes.volume_data.VolumeData

Bases: nipy.labs.datasets.volumes.volume_field.VolumeField

A class representing data embedded in a 3D space

This object has data stored in an array like, that knows how it is mapped to a 3D “real-world space”, and how it can change real-world coordinate system.


The data is stored in an undefined way: prescalings might need to be applied to it before using it, or the data might be loaded on demand. The best practice to access the data is not to access the _data attribute, but to use the get_data method.


world_space: string World space the data is embedded in. For instance mni152.
metadata: dictionnary Optional, user-defined, dictionnary used to carry around extra information about the data as it goes through transformations. The class consistency of this information is not maintained as the data is modified.
_data: Private pointer to the data.

x.__init__(…) initializes x; see help(type(x)) for signature


Return data as a numpy array.

interpolation = 'continuous'

Returns an volumetric data structure with the same relationship between data and world space, and same metadata, but different data.

Parameters:data: ndarray
resampled_to_img(target_image, interpolation=None)

Resample the data to be on the same voxel grid than the target volume structure.


target_image : nipy image

Nipy image onto the voxel grid of which the data will be resampled. This can be any kind of img understood by Nipy (datasets, pynifti objects, nibabel object) or a string giving the path to a nifti of analyse image.

interpolation : None, ‘continuous’ or ‘nearest’, optional

Interpolation type used when calculating values in different word spaces. If None, the image’s interpolation logic is used.


resampled_image : nipy_image

New nipy image with the data resampled.


Both the target image and the original image should be embedded in the same world space.