mipcandy.data.io#

Module Contents#

Functions#

fast_save

fast_load

resample_to_isotropic

load_image

save_image

empty_cache

dump_allocated_tensors

return:

(total size in MB, [(size in MB, shape, dtype, device, requires_grad, grad_fn)])

API#

mipcandy.data.io.fast_save(x: torch.Tensor, path: str | os.PathLike[str]) None[source]#
mipcandy.data.io.fast_load(path: str | os.PathLike[str], *, device: mipcandy.types.Device = 'cpu') torch.Tensor[source]#
mipcandy.data.io.resample_to_isotropic(image: SimpleITK.Image, *, target_iso: float | None = None, interpolator: int = SpITK.sitkBSpline) SimpleITK.Image[source]#
mipcandy.data.io.load_image(path: str | os.PathLike[str], *, is_label: bool = False, align_spacing: bool = False, target_iso: float | None = None, device: mipcandy.types.Device = 'cpu') torch.Tensor[source]#
mipcandy.data.io.save_image(image: torch.Tensor, path: str | os.PathLike[str]) None[source]#
mipcandy.data.io.empty_cache(device: mipcandy.types.Device) None[source]#
mipcandy.data.io.dump_allocated_tensors() tuple[float, list[tuple[float, mipcandy.types.AmbiguousShape, torch.dtype, torch.device, bool, str]]][source]#
Returns:

(total size in MB, [(size in MB, shape, dtype, device, requires_grad, grad_fn)])