# nipy.labs.datasets.volumes.volume_field.VolumeField.as_volume_img

VolumeField.as_volume_img(affine=None, shape=None, interpolation=None, copy=True)

  Resample the image to be an image with the data points lying on a regular grid with an affine mapping to the word space (a nipy VolumeImg).

  Parameters:
    affine: 4x4 or 3x3 ndarray, optional

      Affine of the new voxel grid or transform object pointing to the new voxel coordinate grid. If a 3x3 ndarray is given, it is considered to be the rotation part of the affine, and the best possible bounding box is calculated, in this case, the shape argument is not used. If None is given, a default affine is provided by the image.

    shape: (n_x, n_y, n_z), tuple of integers, optional

      The shape of the grid used for sampling, if None is given, a default affine is provided by the 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.

  Returns:
    resampled_image nipy VolumeImg

      New nipy VolumeImg with the data sampled on the grid defined by the affine and shape.

  Notes

  The coordinate system of the image is not changed: the returned image points to the same world space.