PyNutil.save_volumes#

PyNutil.save_volumes(*, output_folder, volumes, atlas, logger=None)[source]#

Save atlas-space volumes as NIfTI files.

Parameters:
  • output_folder (str) – Base output directory where the interpolated_volume subdirectory will be created.

  • volumes (VolumeResult) – VolumeResult returned by interpolate_volume().

  • atlas (object) – Atlas definition used to infer isotropic voxel spacing. Accepts a BrainGlobe atlas object or AtlasData.

  • logger – Optional logger used to report non-uniform output scaling.

Return type:

None

Notes

Each written volume is scaled to 8-bit before export. Output files are written into <output_folder>/interpolated_volume.

Examples

Save the volumes returned by PyNutil.interpolate_volume():

>>> image_series = read_segmentation_dir("path/to/segmentations/", pixel_id=[0, 0, 0])
>>> registration = read_alignment("path/to/alignment.json")
>>> volumes = interpolate_volume(
...     image_series=image_series,
...     registration=registration,
...     atlas=atlas,
... )
>>> save_volumes(
...     output_folder="path/to/output",
...     volumes=volumes,
...     atlas=atlas,
... )