:py:mod:`pytomography.projections`
==================================

.. py:module:: pytomography.projections


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

   back_projection/index.rst
   forward_projection/index.rst
   projection/index.rst


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

Classes
~~~~~~~

.. autoapisummary::

   pytomography.projections.ForwardProjectionNet
   pytomography.projections.BackProjectionNet
   pytomography.projections.ProjectionNet




.. py:class:: ForwardProjectionNet(obj2obj_nets, im2im_nets, object_meta, image_meta, device = None)

   Bases: :py:obj:`pytomography.projections.projection.ProjectionNet`

   Implements a forward projection of mathematical form :math:`g_j = \sum_{i} c_{ij} f_i` where :math:`f_i` is an object, :math:`g_j` is the corresponding image, and :math:`c_{ij}` is the system matrix given by the various phenonemon modeled (e.g. atteunation/PSF).


   .. py:method:: forward(object, angle_subset = None)

      Implements forward projection on an object

      :param object: The object to be forward projected
      :type object: torch.tensor[batch_size, Lx, Ly, Lz]
      :param angle_subset: Only uses a subset of angles (i.e. only certain values of :math:`j` in formula above) when back projecting. Useful for ordered-subset reconstructions. Defaults to None,
      :type angle_subset: list, optional
      :param which assumes all angles are used.:

      :returns: Forward projected image where Ltheta is specified by `self.image_meta` and `angle_subset`.
      :rtype: torch.tensor[batch_size, Ltheta, Lx, Lz]



.. py:class:: BackProjectionNet(obj2obj_nets, im2im_nets, object_meta, image_meta, device = None)

   Bases: :py:obj:`pytomography.projections.projection.ProjectionNet`

   Implements a back projection of mathematical form :math:`f_i = \frac{1}{\sum_j c_{ij}}\sum_{j} c_{ij} g_j`. where :math:`f_j` is an object, :math:`g_j` is an image, and :math:`c_{ij}` is the system matrix given by the various phenonemon modeled (e.g. atteunation correction/PSF). Subclass of the ``ProjectionNet`` class.

   .. py:method:: forward(image, angle_subset = None, prior = None, normalize = False, return_norm_constant = False, delta = 1e-11)

      Implements back projection on an image, returning an object.

      :param image: image which is to be back projected
      :type image: torch.tensor[batch_size, Ltheta, Lr, Lz]
      :param angle_subset: Only uses a subset of angles (i.e. only certain values of :math:`j` in formula above) when back projecting. Useful for ordered-subset reconstructions. Defaults to None, which assumes all angles are used.
      :type angle_subset: list, optional
      :param prior: If included, modifes normalizing factor to :math:`\frac{1}{\sum_j c_{ij} + P_i}` where :math:`P_i` is given by the prior. Used, for example, during in MAP OSEM. Defaults to None.
      :type prior: Prior, optional
      :param normalize: Whether or not to divide result by :math:`\sum_j c_{ij}`
      :type normalize: bool
      :param return_norm_constant: Whether or not to return :math:`1/\sum_j c_{ij}` along with back projection. Defaults to 'False'.
      :type return_norm_constant: bool
      :param delta: Prevents division by zero when dividing by normalizing constant. Defaults to 1e-11.
      :type delta: float, optional

      :returns: the object obtained from back projection.
      :rtype: torch.tensor[batch_size, Lr, Lr, Lz]



.. py:class:: ProjectionNet(obj2obj_nets, im2im_nets, object_meta, image_meta, device = None)

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

   Abstract parent class for projection networks. Any subclass of this network must implement the ``forward`` method.

   .. py:method:: initialize_correction_nets()

      Function that initializes all mapping networks with the required object and image metadata corresponding to the projection network.



   .. py:method:: foward()
      :abstractmethod:

      Abstract method that must be implemented by any subclass of this class.




