# algorithms.registration.resample

## Module: `algorithms.registration.resample`

## Functions

nipy.algorithms.registration.resample.cast_array(arr, dtype)
  arrarray

    Input array

  dtypedtype

    Desired dtype

nipy.algorithms.registration.resample.resample(moving, transform=None, reference=None, mov_voxel_coords=False, ref_voxel_coords=False, dtype=None, interp_order=3, mode='constant', cval=0.0)

  Resample movimg into voxel space of reference using transform

  Apply a transformation to the image considered as ‘moving’ to bring it into the same grid as a given reference image. The transformation usually maps world space in reference to world space in movimg, but can also be a voxel to voxel mapping (see parameters below).

  This function uses scipy.ndimage except for the case interp_order==3, where a fast cubic spline implementation is used.

  Parameters:
    moving: nipy-like image

      Image to be resampled.

    transform: transform object or None

      Represents a transform that goes from the reference image to the moving image. None means an identity transform. Otherwise, it should have either an apply method, or an as_affine method or be a shape (4, 4) array. By default, transform maps between the output (world) space of reference and the output (world) space of moving. If mov_voxel_coords is True, maps to the voxel space of moving and if ref_vox_coords is True, maps from the voxel space of reference.

    reference None or nipy-like image or tuple, optional

      The reference image defines the image dimensions and xyz affine to which to resample. It can be input as a nipy-like image or as a tuple (shape, affine). If None, use movimg to define these.

    mov_voxel_coords boolean, optional

      True if the transform maps to voxel coordinates, False if it maps to world coordinates.

    ref_voxel_coords boolean, optional

      True if the transform maps from voxel coordinates, False if it maps from world coordinates.

    interp_order: int, optional

      Spline interpolation order, defaults to 3.

    mode str, optional

      Points outside the boundaries of the input are filled according to the given mode (‘constant’, ‘nearest’, ‘reflect’ or ‘wrap’). Default is ‘constant’.

    cval scalar, optional

      Value used for points outside the boundaries of the input if mode=’constant’. Default is 0.0.

  Returns:
    aligned_img Image

      Image resliced to reference with reference-to-movimg transform transform