nabu.io.cast_volume module

nabu.io.cast_volume.get_default_output_volume(input_volume: VolumeBase, output_type: str, output_dir: str = 'vol_cast') VolumeBase[source]

For a given input volume and output type return output volume as an instance of VolumeBase

Parameters:
  • intput_volume (VolumeBase) – volume for which we want to get the resulting output volume for a cast

  • output_type (str) – output_type of the volume (edf, tiff, hdf5…)

  • output_dir (str) – output dir to save the cast volume

nabu.io.cast_volume.cast_volume(input_volume: VolumeBase, output_volume: VolumeBase, output_data_type: dtype, data_min=None, data_max=None, scan: TomoScanBase | None = None, rescale_min_percentile=10, rescale_max_percentile=90, save=True, store=False) VolumeBase[source]

cast givent volume to output_volume of ‘output_data_type’ type

Parameters:
  • input_volume (VolumeBase) –

  • output_volume (VolumeBase) –

  • output_data_type (numpy.dtype) – output data type

  • data_min (number) – data min value to clamp to new_min. Any lower value will also be clamp to new_min.

  • data_max (number) – data max value to clamp to new_max. Any hight value will also be clamp to new_max.

  • scan (TomoScanBase) – source scan that produced input_volume. Can be used to find histogram for example.

  • rescale_min_percentile – if data_min is None will set data_min to ‘rescale_min_percentile’

  • rescale_max_percentile – if data_max is None will set data_min to ‘rescale_max_percentile’

  • save (bool) – if True dump the slice on disk (one by one)

  • store (bool) – if True once the volume is cast then set output_volume.data

Returns:

output_volume with data and metadata set

Warning

the created will volume will not be saved in this processing. If you want to save the cast volume you must do it yourself.

Note

if you want to tune compression ratios (for jp2k) then please update the cratios attributes of the output volume