:py:mod:`mipcandy.common.module.preprocess`
===========================================

.. py:module:: mipcandy.common.module.preprocess

.. autodoc2-docstring:: mipcandy.common.module.preprocess
   :allowtitles:

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

Classes
~~~~~~~

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

   * - :py:obj:`Pad <mipcandy.common.module.preprocess.Pad>`
     -
   * - :py:obj:`Pad2d <mipcandy.common.module.preprocess.Pad2d>`
     -
   * - :py:obj:`Pad3d <mipcandy.common.module.preprocess.Pad3d>`
     -
   * - :py:obj:`Restore2d <mipcandy.common.module.preprocess.Restore2d>`
     -
   * - :py:obj:`Restore3d <mipcandy.common.module.preprocess.Restore3d>`
     -
   * - :py:obj:`PadTo <mipcandy.common.module.preprocess.PadTo>`
     -
   * - :py:obj:`Normalize <mipcandy.common.module.preprocess.Normalize>`
     -
   * - :py:obj:`CTNormalize <mipcandy.common.module.preprocess.CTNormalize>`
     -
   * - :py:obj:`ColorizeLabel <mipcandy.common.module.preprocess.ColorizeLabel>`
     -

Functions
~~~~~~~~~

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

   * - :py:obj:`reverse_paddings <mipcandy.common.module.preprocess.reverse_paddings>`
     - .. autodoc2-docstring:: mipcandy.common.module.preprocess.reverse_paddings
          :summary:

API
~~~

.. py:function:: reverse_paddings(paddings: mipcandy.types.Paddings) -> mipcandy.types.Paddings
   :canonical: mipcandy.common.module.preprocess.reverse_paddings

   .. autodoc2-docstring:: mipcandy.common.module.preprocess.reverse_paddings

.. py:class:: Pad(*, value: int = 0, mode: str = 'constant', batch: bool = True)
   :canonical: mipcandy.common.module.preprocess.Pad

   Bases: :py:obj:`torch.nn.Module`

   .. py:method:: _c_t(size: int, min_factor: int) -> int
      :canonical: mipcandy.common.module.preprocess.Pad._c_t
      :staticmethod:

      .. autodoc2-docstring:: mipcandy.common.module.preprocess.Pad._c_t

   .. py:method:: _c_p(size: int, min_factor: int) -> tuple[int, int]
      :canonical: mipcandy.common.module.preprocess.Pad._c_p
      :staticmethod:

      .. autodoc2-docstring:: mipcandy.common.module.preprocess.Pad._c_p

.. py:class:: Pad2d(min_factor: int | mipcandy.types.Shape2d, *, value: int = 0, mode: str = 'constant', batch: bool = True)
   :canonical: mipcandy.common.module.preprocess.Pad2d

   Bases: :py:obj:`mipcandy.common.module.preprocess.Pad`

   .. py:method:: paddings() -> mipcandy.types.Paddings2d | None
      :canonical: mipcandy.common.module.preprocess.Pad2d.paddings

      .. autodoc2-docstring:: mipcandy.common.module.preprocess.Pad2d.paddings

   .. py:method:: padded_shape(in_shape: tuple[int, int, ...]) -> tuple[int, int, ...]
      :canonical: mipcandy.common.module.preprocess.Pad2d.padded_shape

      .. autodoc2-docstring:: mipcandy.common.module.preprocess.Pad2d.padded_shape

   .. py:method:: forward(x: torch.Tensor) -> torch.Tensor
      :canonical: mipcandy.common.module.preprocess.Pad2d.forward

      .. autodoc2-docstring:: mipcandy.common.module.preprocess.Pad2d.forward

.. py:class:: Pad3d(min_factor: int | mipcandy.types.Shape3d, *, value: int = 0, mode: str = 'constant', batch: bool = True)
   :canonical: mipcandy.common.module.preprocess.Pad3d

   Bases: :py:obj:`mipcandy.common.module.preprocess.Pad`

   .. py:method:: paddings() -> mipcandy.types.Paddings3d | None
      :canonical: mipcandy.common.module.preprocess.Pad3d.paddings

      .. autodoc2-docstring:: mipcandy.common.module.preprocess.Pad3d.paddings

   .. py:method:: padded_shape(in_shape: tuple[int, int, int, ...]) -> tuple[int, int, int, ...]
      :canonical: mipcandy.common.module.preprocess.Pad3d.padded_shape

      .. autodoc2-docstring:: mipcandy.common.module.preprocess.Pad3d.padded_shape

   .. py:method:: forward(x: torch.Tensor) -> torch.Tensor
      :canonical: mipcandy.common.module.preprocess.Pad3d.forward

      .. autodoc2-docstring:: mipcandy.common.module.preprocess.Pad3d.forward

.. py:class:: Restore2d(conjugate_padding: mipcandy.common.module.preprocess.Pad2d)
   :canonical: mipcandy.common.module.preprocess.Restore2d

   Bases: :py:obj:`torch.nn.Module`

   .. py:method:: forward(x: torch.Tensor) -> torch.Tensor
      :canonical: mipcandy.common.module.preprocess.Restore2d.forward

      .. autodoc2-docstring:: mipcandy.common.module.preprocess.Restore2d.forward

.. py:class:: Restore3d(conjugate_padding: mipcandy.common.module.preprocess.Pad3d)
   :canonical: mipcandy.common.module.preprocess.Restore3d

   Bases: :py:obj:`torch.nn.Module`

   .. py:method:: forward(x: torch.Tensor) -> torch.Tensor
      :canonical: mipcandy.common.module.preprocess.Restore3d.forward

      .. autodoc2-docstring:: mipcandy.common.module.preprocess.Restore3d.forward

.. py:class:: PadTo(min_shape: mipcandy.types.Shape, *, value: int = 0, mode: str = 'constant', batch: bool = True)
   :canonical: mipcandy.common.module.preprocess.PadTo

   Bases: :py:obj:`mipcandy.common.module.preprocess.Pad`

   .. py:method:: forward(x: torch.Tensor) -> torch.Tensor
      :canonical: mipcandy.common.module.preprocess.PadTo.forward

      .. autodoc2-docstring:: mipcandy.common.module.preprocess.PadTo.forward

.. py:class:: Normalize(*, domain: tuple[float | None, float | None] = (0, None), strict: bool = False, method: typing.Literal[linear, intercept, cut, zscore] = 'linear')
   :canonical: mipcandy.common.module.preprocess.Normalize

   Bases: :py:obj:`torch.nn.Module`

   .. py:method:: forward(x: torch.Tensor) -> torch.Tensor
      :canonical: mipcandy.common.module.preprocess.Normalize.forward

      .. autodoc2-docstring:: mipcandy.common.module.preprocess.Normalize.forward

.. py:class:: CTNormalize(mean_intensity: float, std_intensity: float, lower_bound: float, upper_bound: float)
   :canonical: mipcandy.common.module.preprocess.CTNormalize

   Bases: :py:obj:`torch.nn.Module`

   .. py:method:: forward(x: torch.Tensor) -> torch.Tensor
      :canonical: mipcandy.common.module.preprocess.CTNormalize.forward

      .. autodoc2-docstring:: mipcandy.common.module.preprocess.CTNormalize.forward

.. py:class:: ColorizeLabel(*, colormap: mipcandy.types.Colormap | None = None, batch: bool = True)
   :canonical: mipcandy.common.module.preprocess.ColorizeLabel

   Bases: :py:obj:`torch.nn.Module`

   .. py:method:: forward(x: torch.Tensor) -> torch.Tensor
      :canonical: mipcandy.common.module.preprocess.ColorizeLabel.forward

      .. autodoc2-docstring:: mipcandy.common.module.preprocess.ColorizeLabel.forward
