:py:mod:`pytomography.transforms.SPECT.atteunation`
===================================================

.. py:module:: pytomography.transforms.SPECT.atteunation


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

Classes
~~~~~~~

.. autoapisummary::

   pytomography.transforms.SPECT.atteunation.SPECTAttenuationTransform



Functions
~~~~~~~~~

.. autoapisummary::

   pytomography.transforms.SPECT.atteunation.get_prob_of_detection_matrix



.. py:function:: get_prob_of_detection_matrix(CT, dx)

   Converts an attenuation map of :math:`\text{cm}^{-1}` to a probability of photon detection matrix (scanner at +x). Note that this requires the attenuation map to be at the energy of photons being emitted.

   :param CT: Tensor of size [batch_size, Lx, Ly, Lz] corresponding to the attenuation coefficient in :math:`{\text{cm}^{-1}}
   :type CT: torch.tensor
   :param dx: Axial plane pixel spacing.
   :type dx: float

   :returns: Tensor of size [batch_size, Lx, Ly, Lz] corresponding to probability of photon being detected at detector at +x axis.
   :rtype: torch.tensor


.. py:class:: SPECTAttenuationTransform(CT)

   Bases: :py:obj:`pytomography.transforms.Transform`

   obj2obj transform used to model the effects of attenuation in SPECT.

   :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

   .. py:method:: forward(object_i, ang_idx)

      Forward projection :math:`A:\mathbb{U} \to \mathbb{U}` of attenuation correction

      :param object_i: Tensor of size [batch_size, Lx, Ly, Lz] being projected along ``axis=1``.
      :type object_i: torch.tensor
      :param ang_idx: The projection indices: used to find the corresponding angle in image space corresponding to each projection angle in ``object_i``.
      :type ang_idx: torch.Tensor

      :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


   .. py:method:: backward(object_i, ang_idx, norm_constant = None)

      Back projection :math:`A^T:\mathbb{U} \to \mathbb{U}` of attenuation correction. Since the matrix is diagonal, the implementation is the same as forward projection. The only difference is the optional normalization parameter.

      :param object_i: Tensor of size [batch_size, Lx, Ly, Lz] being projected along ``axis=1``.
      :type object_i: torch.tensor
      :param ang_idx: The projection indices: used to find the corresponding angle in image space corresponding to each projection angle in ``object_i``.
      :type ang_idx: torch.Tensor
      :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



