linumpy.geometry.resample#

Volume resampling and downsampling using SimpleITK.

Functions#

resample_itk(vol, newshape[, interpolator])

Resamples a volume / image using ITK.

shrink(vol[, spacing, res])

Shrink volume up to a given resolution (in each dimension).

Module Contents#

linumpy.geometry.resample.resample_itk(vol, newshape, interpolator='linear')[source]#

Resamples a volume / image using ITK.

Parameters:
  • vol (ndimage) – Array to resample

  • newshape (tuple of int or int) – New shape of the array, or resampling factor (if a single integer is given)

  • interpolator (str) –

    Interpolation method to use. Available are:
    • ’NN’ (NearestNeighbor)

    • ’linear’

Returns:

Resampled array

Return type:

ndarray

linumpy.geometry.resample.shrink(vol, spacing=(1.0, 1.0, 1.0), res=(10.0, 10.0, 10.0))[source]#

Shrink volume up to a given resolution (in each dimension).

Parameters:
  • vol (ndarray) – Volume to shrink

  • spacing ((3,) list) – Voxel spacing of the original volume

  • res ((3,) list) – Output resolution / spacing

Returns:

Shrinked volume.

Return type:

ndarray