:py:mod:`pytomography.io.SPECT.simind`
======================================

.. py:module:: pytomography.io.SPECT.simind


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


Functions
~~~~~~~~~

.. autoapisummary::

   pytomography.io.SPECT.simind.find_first_entry_containing_header
   pytomography.io.SPECT.simind.get_projections
   pytomography.io.SPECT.simind.get_scatter_from_TEW
   pytomography.io.SPECT.simind.combine_projection_data
   pytomography.io.SPECT.simind.combine_scatter_data_TEW
   pytomography.io.SPECT.simind.get_atteuation_map
   pytomography.io.SPECT.simind.get_psfmeta_from_header
   pytomography.io.SPECT.simind.get_SPECT_recon_algorithm_simind



Attributes
~~~~~~~~~~

.. autoapisummary::

   pytomography.io.SPECT.simind.relation_dict


.. py:data:: relation_dict

   

.. py:function:: find_first_entry_containing_header(list_of_attributes, header, dtype = np.float32)

   Finds the first entry in a SIMIND Interfile output corresponding to the header (header).

   :param list_of_attributes: Simind data file, as a list of lines.
   :type list_of_attributes: list[str]
   :param header: The header looked for
   :type header: str
   :param dtype: The data type to be returned corresponding to the value of the header. Defaults to np.float32.
   :type dtype: type, optional

   :returns: The value corresponding to the header (header).
   :rtype: float|str|int


.. py:function:: get_projections(headerfile, distance = 'cm')

   Obtains ObjectMeta, ImageMeta, and projections from a SIMIND header file.

   :param headerfile: Path to the header file
   :type headerfile: str
   :param distance: The units of measurements in the SIMIND file (this is required as input, since SIMIND uses mm/cm but doesn't specify). Defaults to 'cm'.
   :type distance: str, optional

   :returns: Required information for reconstruction in PyTomography.
   :rtype: (ObjectMeta, ImageMeta, torch.Tensor[1, Ltheta, Lr, Lz])


.. py:function:: get_scatter_from_TEW(headerfile_peak, headerfile_lower, headerfile_upper, distance = 'cm')

   Obtains a triple energy window scatter estimate from corresponding photopeak, lower, and upper energy windows.

   :param headerfile_peak: Headerfile corresponding to the photopeak
   :param headerfile_lower: Headerfile corresponding to the lower energy window
   :param headerfile_upper: Headerfile corresponding to the upper energy window
   :param distance: The units of measurements in the SIMIND file (this is required as input, since SIMIND uses mm/cm but doesn't specify). Defaults to 'cm'.
   :type distance: str, optional

   :returns: Estimated scatter from the triple energy window.
   :rtype: torch.Tensor[1, Ltheta, Lr, Lz]


.. py:function:: combine_projection_data(headerfiles, weights)

   Takes in a list of SIMIND headerfiles corresponding to different simulated regions and adds the projection data together based on the `weights`.

   :param headerfiles: List of filepaths corresponding to the SIMIND header files of different simulated regions
   :type headerfiles: Sequence[str]
   :param weights: Amount by which to weight each projection relative.
   :type weights: Sequence[str]

   :returns: Returns necessary object/image metadata along with the projection data
   :rtype: (ObjectMeta, ImageMeta, torch.Tensor)


.. py:function:: combine_scatter_data_TEW(headerfiles_peak, headerfiles_lower, headerfiles_upper, weights)

   Computes the triple energy window scatter estimate of the sequence of projection data weighted by `weights`. See `combine_projection_data` for more details.

   :param headerfiles_peak: List of headerfiles corresponding to the photopeak
   :type headerfiles_peak: Sequence[str]
   :param headerfiles_lower: List of headerfiles corresponding to the lower scatter window
   :type headerfiles_lower: Sequence[str]
   :param headerfiles_upper: List of headerfiles corresponding to the upper scatter window
   :type headerfiles_upper: Sequence[str]
   :param weights: Amount by which to weight each set of projection data by.
   :type weights: Sequence[float]

   :returns: _description_
   :rtype: _type_


.. py:function:: get_atteuation_map(headerfile)

   Opens attenuation data from SIMIND output

   :param headerfile: Path to header file
   :type headerfile: str

   :returns: Tensor containing attenuation map required for attenuation correction in SPECT/PET imaging.
   :rtype: torch.Tensor[batch_size, Lx, Ly, Lz]


.. py:function:: get_psfmeta_from_header(headerfile)

   Obtains the PSFMeta data corresponding to a SIMIND simulation scan from the headerfile

   :param headerfile: SIMIND headerfile.
   :type headerfile: str

   :returns: PSF metadata required for PSF modeling in reconstruction.
   :rtype: PSFMeta


.. py:function:: get_SPECT_recon_algorithm_simind(projections_header, scatter_headers = None, CT_header = None, psf_meta = None, prior = None, object_initial = None, recon_algorithm_class = OSEMOSL)


