pytomography.projectors.SPECT.dualhead_system_matrix#
Module Contents#
Classes#
System matrix for SPECT imaging implemented using the rotate+sum technique. |
|
System matrix for SPECT imaging implemented using the rotate+sum technique. |
- class pytomography.projectors.SPECT.dualhead_system_matrix.SPECTSystemMatrix(obj2obj_transforms, proj2proj_transforms, object_meta, proj_meta, object_initial_based_on_camera_path=False)[source]#
Bases:
pytomography.projectors.system_matrix.SystemMatrixSystem matrix for SPECT imaging implemented using the rotate+sum technique.
- Parameters:
obj2obj_transforms (Sequence[Transform]) – Sequence of object mappings that occur before forward projection.
proj2proj_transforms (Sequence[Transform]) – Sequence of proj mappings that occur after forward projection.
object_meta (SPECTObjectMeta) – SPECT Object metadata.
proj_meta (SPECTProjMeta) – SPECT projection metadata.
object_initial_based_on_camera_path (bool) – Whether or not to initialize the object estimate based on the camera path; this sets voxels to zero that are outside the SPECT camera path. Defaults to False.
- _get_object_initial(device=None)[source]#
Returns an initial object estimate used in reconstruction algorithms. By default, this is a tensor of ones with the same shape as the object metadata.
- Returns:
Initial object used in reconstruction algorithm.
- Return type:
torch.Tensor
- set_n_subsets(n_subsets)[source]#
Sets the subsets for this system matrix given
n_subsetstotal subsets.- Parameters:
n_subsets (int) – number of subsets used in OSEM
- Return type:
list
- get_projection_subset(projections, subset_idx)[source]#
Gets the subset of projections \(g_m\) corresponding to index \(m\).
- Parameters:
projections (torch.tensor) – full projections \(g\)
subset_idx (int) – subset index \(m\)
- Returns:
subsampled projections \(g_m\)
- Return type:
torch.tensor
- get_weighting_subset(subset_idx)[source]#
Computes the relative weighting of a given subset (given that the projection space is reduced). This is used for scaling parameters relative to \(H_m^T 1\) in reconstruction algorithms, such as prior weighting \(\beta\)
- Parameters:
subset_idx (int) – Subset index
- Returns:
Weighting for the subset.
- Return type:
float
- compute_normalization_factor(subset_idx=None)[source]#
Function used to get normalization factor \(H^T_m 1\) corresponding to projection subset \(m\).
- Parameters:
subset_idx (int | None, optional) – Index of subset. If none, then considers all projections. Defaults to None.
- Returns:
normalization factor \(H^T_m 1\)
- Return type:
torch.Tensor
- forward(object, subset_idx=None)[source]#
Applies forward projection to
objectfor a SPECT imaging system.- Parameters:
object (torch.tensor[Lx, Ly, Lz]) – The object to be forward projected
subset_idx (int, optional) – Only uses a subset of angles \(g_m\) corresponding to the provided subset index \(m\). If None, then defaults to the full projections \(g\).
- Returns:
forward projection estimate \(g_m=H_mf\)
- Return type:
torch.tensor
- backward(proj, subset_idx=None)[source]#
Applies back projection to
projfor a SPECT imaging system.- Parameters:
proj (torch.tensor) – projections \(g\) which are to be back projected
subset_idx (int, optional) – Only uses a subset of angles \(g_m\) corresponding to the provided subset index \(m\). If None, then defaults to the full projections \(g\).
return_norm_constant (bool) – Whether or not to return \(H_m^T 1\) along with back projection. Defaults to ‘False’.
- Returns:
the object \(\hat{f} = H_m^T g_m\) obtained via back projection.
- Return type:
torch.tensor
- class pytomography.projectors.SPECT.dualhead_system_matrix.MonteCarloHybridSPECTSystemMatrix(object_meta, proj_meta, n_events, n_parallel, obj2obj_transforms, proj2proj_transforms, attenuation_map_140keV, energy_window_params, primary_window_idx, isotope_names, isotope_ratios, collimator_type, crystal_thickness, cover_thickness, backscatter_thickness, energy_resolution_140keV=0, advanced_energy_resolution_model=None, advanced_collimator_modeling=False)[source]#
Bases:
SPECTSystemMatrixSystem matrix for SPECT imaging implemented using the rotate+sum technique.
- Parameters:
obj2obj_transforms (Sequence[Transform]) – Sequence of object mappings that occur before forward projection.
proj2proj_transforms (Sequence[Transform]) – Sequence of proj mappings that occur after forward projection.
object_meta (SPECTObjectMeta) – SPECT Object metadata.
proj_meta (SPECTProjMeta) – SPECT projection metadata.
object_initial_based_on_camera_path (bool) – Whether or not to initialize the object estimate based on the camera path; this sets voxels to zero that are outside the SPECT camera path. Defaults to False.
n_events (int) –
n_parallel (int) –
attenuation_map_140keV (torch.Tensor) –
energy_window_params (Sequence[str]) –
primary_window_idx (int) –
isotope_names (Sequence[str]) –
isotope_ratios (Sequence[float]) –
collimator_type (str) –
crystal_thickness (float) –
cover_thickness (float) –
backscatter_thickness (float) –
energy_resolution_140keV (float) –
advanced_energy_resolution_model (str | None) –
advanced_collimator_modeling (bool) –
- _get_proj_meta_subset(subset_idx)[source]#
Creates a new SPECTProjMeta that corresponds to a subset of projections :param subset_idx: Index of the subset to use :type subset_idx: int
- Returns:
New SPECTProjMeta that corresponds to the subset of projections
- Return type:
- Parameters:
subset_idx (int) –
- forward(object, subset_idx=None)[source]#
Runs the Monte Carlo scatter simulation using SIMIND and returns the simulated projections. :param object: Object to simulate :type object: torch.Tensor :param subset_idx: Index of the subset to use. If None, then all projections are used. Defaults to None. :type subset_idx: int | None, optional
- Returns:
Simulated projections
- Return type:
torch.Tensor
- Parameters:
object (torch.Tensor) –
subset_idx (int | None) –