:py:mod:`pytomography.corrections`
==================================

.. py:module:: pytomography.corrections


Submodules
----------
.. toctree::
   :titlesonly:
   :maxdepth: 1

   correction/index.rst
   ct_correction/index.rst
   psf_correction/index.rst


Package Contents
----------------

Classes
~~~~~~~

.. autoapisummary::

   pytomography.corrections.CorrectionNet
   pytomography.corrections.CTCorrectionNet




.. py:class:: CorrectionNet(device = 'cpu')

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

   Correction net is the parent class for all correction networks used in reconstruction. Subclasses must implement the ``forward`` method.

   :param device: Pytorch device used for computation
   :type device: str

   .. py:method:: initialize_network(object_meta, image_meta)

      Initalizes the correction network using the object/image metadata

      :param object_meta: Object metadata.
      :type object_meta: ObjectMeta
      :param image_meta: Image metadata.
      :type image_meta: ImageMeta


   .. py:method:: forward(x)
      :abstractmethod:

      Abstract method; must be implemented in subclasses to apply a correction to an object/image and return it




.. py:class:: CTCorrectionNet(CT, device = 'cpu')

   Bases: :py:obj:`pytomography.corrections.CorrectionNet`

   Correction network used to correct for attenuation correction in projection operators. In particular, this network is used with other correction networks to model :math:`c` in :math:`\sum_i c_{ij} a_i` (forward projection) and :math:`\sum c_{ij} b_j` (back projection).

   :param CT: Tensor of size [batch_size, Lx, Ly, Lz] corresponding to the attenuation coefficient in :math:`{\text{cm}^{-1}}` at the photon energy corresponding to the particular scan
   :type CT: torch.tensor
   :param device: Pytorch computation device. Defaults to 'cpu'.
   :type device: str, optional

   .. py:method:: forward(object_i, i, norm_constant = None)

      Applies attenuation correction to an object that's being detected on the right of its first axis.

      :param object_i: Tensor of size [batch_size, Lx, Ly, Lz] being projected along ``axis=1``.
      :type object_i: torch.tensor
      :param i: The projection index: used to find the corresponding angle in image space corresponding to ``object_i``. In particular, the x axis (tensor `axis=1`) of the object is aligned with the detector at angle i.
      :type i: int
      :param norm_constant: A tensor used to normalize the output during back projection. Defaults to None.
      :type norm_constant: torch.tensor, optional

      :returns: Tensor of size [batch_size, Lx, Ly, Lz] such that projection of this tensor along the first axis corresponds to an attenuation corrected projection.
      :rtype: torch.tensor



