:py:mod:`mipcandy.data.io`
==========================

.. py:module:: mipcandy.data.io

.. autodoc2-docstring:: mipcandy.data.io
   :allowtitles:

Module Contents
---------------

Functions
~~~~~~~~~

.. list-table::
   :class: autosummary longtable
   :align: left

   * - :py:obj:`fast_save <mipcandy.data.io.fast_save>`
     - .. autodoc2-docstring:: mipcandy.data.io.fast_save
          :summary:
   * - :py:obj:`fast_load <mipcandy.data.io.fast_load>`
     - .. autodoc2-docstring:: mipcandy.data.io.fast_load
          :summary:
   * - :py:obj:`resample_to_isotropic <mipcandy.data.io.resample_to_isotropic>`
     - .. autodoc2-docstring:: mipcandy.data.io.resample_to_isotropic
          :summary:
   * - :py:obj:`load_image <mipcandy.data.io.load_image>`
     - .. autodoc2-docstring:: mipcandy.data.io.load_image
          :summary:
   * - :py:obj:`save_image <mipcandy.data.io.save_image>`
     - .. autodoc2-docstring:: mipcandy.data.io.save_image
          :summary:
   * - :py:obj:`empty_cache <mipcandy.data.io.empty_cache>`
     - .. autodoc2-docstring:: mipcandy.data.io.empty_cache
          :summary:
   * - :py:obj:`dump_allocated_tensors <mipcandy.data.io.dump_allocated_tensors>`
     - .. autodoc2-docstring:: mipcandy.data.io.dump_allocated_tensors
          :summary:

API
~~~

.. py:function:: fast_save(x: torch.Tensor, path: str | os.PathLike[str]) -> None
   :canonical: mipcandy.data.io.fast_save

   .. autodoc2-docstring:: mipcandy.data.io.fast_save

.. py:function:: fast_load(path: str | os.PathLike[str], *, device: mipcandy.types.Device = 'cpu') -> torch.Tensor
   :canonical: mipcandy.data.io.fast_load

   .. autodoc2-docstring:: mipcandy.data.io.fast_load

.. py:function:: resample_to_isotropic(image: SimpleITK.Image, *, target_iso: float | None = None, interpolator: int = SpITK.sitkBSpline) -> SimpleITK.Image
   :canonical: mipcandy.data.io.resample_to_isotropic

   .. autodoc2-docstring:: mipcandy.data.io.resample_to_isotropic

.. py:function:: 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
   :canonical: mipcandy.data.io.load_image

   .. autodoc2-docstring:: mipcandy.data.io.load_image

.. py:function:: save_image(image: torch.Tensor, path: str | os.PathLike[str]) -> None
   :canonical: mipcandy.data.io.save_image

   .. autodoc2-docstring:: mipcandy.data.io.save_image

.. py:function:: empty_cache(device: mipcandy.types.Device) -> None
   :canonical: mipcandy.data.io.empty_cache

   .. autodoc2-docstring:: mipcandy.data.io.empty_cache

.. py:function:: dump_allocated_tensors() -> tuple[float, list[tuple[float, mipcandy.types.AmbiguousShape, torch.dtype, torch.device, bool, str]]]
   :canonical: mipcandy.data.io.dump_allocated_tensors

   .. autodoc2-docstring:: mipcandy.data.io.dump_allocated_tensors
