# labs.datasets.volumes.volume_data¶

## Module: labs.datasets.volumes.volume_data¶

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

The volume data class

This class represents indexable data embedded in a 3D space

## VolumeData¶

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

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.

Notes

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.

Attributes

 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.
__init__()

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

get_data()

Return data as a numpy array.

interpolation = 'continuous'
like_from_data(data)

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.

Parameters: 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.

Notes

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