pytomography.io.PET.gate
#
Module Contents#
Functions#
|
Returns an aligned attenuation map in units of inverse mm for reconstruction. This assumes that the attenuation map shares the same center point with the reconstruction space. |
|
Returns the scanner lookup table. The three values at a particular index in the lookup table correspond to the x, y, and z positions of the detector id correpsonding to that index. |
|
Obtains the number of gantrys, rsectors, modules, submodules, and crystals per level from a GATE macro file. |
|
Obtains the detector IDs from a sequence of ROOT files |
|
Gets the radial position of all LORs |
|
Obtains a table of crystal1ID, crystal2ID, submoduleID, \(\Delta`moduleID, :math:\)Delta`rsectorID corresponding to each of the detector id pairs provided. Useful fo symmetries when computing normalization \(\eta\). |
|
Obtain normalization \(\eta\) from a calibration scan consisting of a cylindrical shell |
|
Removes all detected LORs outside of the reconstruced volume given by |
- pytomography.io.PET.gate.get_aligned_attenuation_map(headerfile, object_meta)[source]#
Returns an aligned attenuation map in units of inverse mm for reconstruction. This assumes that the attenuation map shares the same center point with the reconstruction space.
- Parameters:
headerfile (str) – Filepath to the header file of the attenuation map
object_meta (ObjectMeta) – Object metadata providing spatial information about the reconstructed dimensions.
- Returns:
Aligned attenuation map
- Return type:
torch.Tensor
- pytomography.io.PET.gate.get_scanner_LUT(path, init_volume_name='crystal', final_volume_name='world', mean_interaction_depth=0, return_info=False)[source]#
Returns the scanner lookup table. The three values at a particular index in the lookup table correspond to the x, y, and z positions of the detector id correpsonding to that index.
- Parameters:
path (str) – Path to .mac file where the scanner geometry is defined in FATE
init_volume_name (str, optional) – Volume name corresponding the lowest level element in the GATE geometry. Defaults to ‘crystal’.
final_volume_name (str, optional) – Volume name corresponding the highest level element in the GATE geometry. Defaults to ‘world’.
mean_interaction_depth (float, optional) – Average interaction depth of photons in the crystals in mm. Defaults to 0.
return_info (bool, optional) – Returns information about the scanner geometry. Defaults to False.
- Returns:
Scanner lookup table.
- Return type:
np.array
- pytomography.io.PET.gate.get_N_components(mac_file)[source]#
Obtains the number of gantrys, rsectors, modules, submodules, and crystals per level from a GATE macro file.
- Parameters:
mac_file (str) – Path to the gate macro file
- Returns:
number of gantrys, rsectors, modules, submodules, and crystals
- Return type:
tuple
- pytomography.io.PET.gate.get_detector_ids(paths, mac_file, TOF=False, TOF_bin_edges=None, substr='Coincidences', same_source_pos=False)[source]#
Obtains the detector IDs from a sequence of ROOT files
- Parameters:
paths (Sequence[str]) – sequence of root file paths
mac_file (str) – GATE geometry macro file
TOF (bool, optional) – Whether or not to get TOF binning information. Defaults to False.
TOF_bin_edges (np.array, optional) – TOF bin edges; required if TOF is True. Defaults to None.
substr (str, optional) – Substring to index for in ROOT files. Defaults to ‘Coincidences’.
same_source_pos (bool, optional) – Only include coincidences that correspond to the same source position. This can be used to filter randoms. Defaults to False.
- Returns:
Array of all detector ID pairs corresponding to all detected LORs.
- Return type:
np.array
- pytomography.io.PET.gate.get_radius(detector_ids, scanner_LUT)[source]#
Gets the radial position of all LORs
- Parameters:
detector_ids (torch.tensor) – Detector ID pairs corresponding to LORs
scanner_LUT (torch.tensor) – scanner look up table
- Returns:
radii of all detector ID pairs provided
- Return type:
torch.tensor
- pytomography.io.PET.gate.get_table(det_ids, mac_file)[source]#
Obtains a table of crystal1ID, crystal2ID, submoduleID, \(\Delta`moduleID, :math:\)Delta`rsectorID corresponding to each of the detector id pairs provided. Useful fo symmetries when computing normalization \(\eta\).
- Parameters:
det_ids (torch.tensor) – \(N \times 2\) (non-TOF) or \(N \times 3\) (TOF) tensor that provides detector ID pairs (and TOF bin) for coincidence events.
mac_file (str) – GATE macro file that defines detector geometry
- Returns:
A 2D tensor that lists crystal1ID, crystal2ID, submoduleID, \(\Delta`moduleID, :math:\)Delta`rsectorID for each LOR.
- Return type:
torch.tensor
- pytomography.io.PET.gate.get_eta_cylinder_calibration(paths, mac_file, cylinder_radius, same_source_pos=False, mean_interaction_depth=0)[source]#
Obtain normalization \(\eta\) from a calibration scan consisting of a cylindrical shell
- Parameters:
paths (Sequence[str]) – paths of all ROOT files containing data
mac_file (str) – GATE macro file that defines scanner geometry
cylinder_radius (float) – The radius of the cylindrical shell used in calibration
same_source_pos (bool, optional) – Only include coincidence events with same source position; can be used to filter out randoms. Defaults to False.
mean_interaction_depth (float, optional) – Mean interaction depth of photons in detector crystals. Defaults to 0.
- Returns:
Tensor corresponding to \(eta\).
- Return type:
torch.tensor
- pytomography.io.PET.gate.remove_events_out_of_bounds(detector_ids, scanner_LUT, object_meta)[source]#
Removes all detected LORs outside of the reconstruced volume given by
object_meta
.- Parameters:
detector_ids (torch.tensor) – \(N \times 2\) (non-TOF) or \(N \times 3\) (TOF) tensor that provides detector ID pairs (and TOF bin) for coincidence events.
scanner_LUT (torch.tensor) – scanner lookup table that provides spatial coordinates for all detector ID pairs
object_meta (ObjectMeta) – object metadata providing the region of reconstruction
- Returns:
all detector ID pairs corresponding to coincidence events
- Return type:
torch.tensor