vreg.Volume3D.resample#

Volume3D.resample(spacing=None, stretch=None)[source]#

Resample volume to new pixel spacing

Parameters:
  • spacing (array-like, optional) – New pixel spacing in mm. Generally this is a 3-element array but for isotropic resampling this can be a scalar value. If this is not provided, the volume is resampled according to the specified stretch. Defaults to None.

  • stretch (float, optional) – Rescale pixel size with this value. Generally this is a 3-element array, one for each dimension. If a scalar value is provided, all dimensions are resampled with the same stretch factor. This argument is ignored if a spacing is provided explicitly. Defaults to None (no resampling).

Raises:

ValueError – if spacing or stretch have the wrong size.

Returns:

resampled volume

Return type:

vreg.Volume3D