pytomography.io.SPECT
#
Submodules#
Package Contents#
Functions#
|
Opens attenuation data from SIMIND output |
|
|
|
Gets ObjectMeta, ImageMeta, and projections from a .dcm file. |
|
Gets an attenuation map from a DICOM file. This data is usually provided by the manufacturer of the SPECT scanner. |
|
Converts a sequence of DICOM CT files (corresponding to a single scan) into a torch.Tensor object usable as an attenuation map in PyTomography. Note that it is recommended by https://jnm.snmjournals.org/content/57/1/151.long to use the vendors attenuation map as opposed to creating your own. As such, the |
|
Gets an estimate of scatter projection data from a DICOM file using the triple energy window method. |
|
Obtains the number of blank z-slices at the sup ( |
|
Gets PSF metadata from SPECT camera/collimator parameters. Performs linear interpolation to find linear attenuation coefficient for lead collimators for energy values within the range 100keV - 600keV. |
- pytomography.io.SPECT.get_atteuation_map(headerfile)[source]#
Opens attenuation data from SIMIND output
- Parameters:
headerfile (str) – Path to header file
- Returns:
Tensor containing CT data.
- Return type:
torch.tensor[Lx,Ly,Lz]
- pytomography.io.SPECT.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)[source]#
- Parameters:
projections_header (str) –
scatter_headers (Sequence[str] | None) –
CT_header (str) –
psf_meta (pytomography.metadata.PSFMeta) –
prior (pytomography.priors.Prior) –
object_initial (torch.Tensor | None) –
recon_algorithm_class (torch.nn.Module) –
- Return type:
torch.nn.Module
- pytomography.io.SPECT.get_projections(file, index_peak=None)[source]#
Gets ObjectMeta, ImageMeta, and projections from a .dcm file.
- Parameters:
file (str) – Path to the .dcm file
index_peak (int) – If not none, then the returned projections correspond to the index of this energy window. Otherwise returns all energy windows. Defaults to None.
- Returns:
Required information for reconstruction in PyTomography.
- Return type:
(ObjectMeta, ImageMeta, torch.Tensor[1, Ltheta, Lr, Lz])
- pytomography.io.SPECT.get_attenuation_map_from_file(file_AM)[source]#
Gets an attenuation map from a DICOM file. This data is usually provided by the manufacturer of the SPECT scanner.
- Parameters:
file_AM (str) – File name of attenuation map
- Returns:
Tensor of shape [batch_size, Lx, Ly, Lz] corresponding to the atteunation map in units of cm:math:^{-1}
- Return type:
torch.Tensor
- pytomography.io.SPECT.get_attenuation_map_from_CT_slices(files_CT, file_NM, index_peak=0)[source]#
Converts a sequence of DICOM CT files (corresponding to a single scan) into a torch.Tensor object usable as an attenuation map in PyTomography. Note that it is recommended by https://jnm.snmjournals.org/content/57/1/151.long to use the vendors attenuation map as opposed to creating your own. As such, the
get_attenuation_map_from_file
should be used preferentially over this function, if you have access to an attenuation map from the vendor.- Parameters:
files_CT (Sequence[str]) – List of all files corresponding to an individual CT scan
file_NM (str) – File corresponding to raw PET/SPECT data (required to align CT with projections)
index_peak (int, optional) – Index corresponding to photopeak in projection data. Defaults to 0.
- Returns:
Tensor of shape [Lx, Ly, Lz] corresponding to attenuation map.
- Return type:
torch.Tensor
- pytomography.io.SPECT.get_scatter_from_TEW(file, index_peak, index_lower, index_upper)[source]#
Gets an estimate of scatter projection data from a DICOM file using the triple energy window method.
- Parameters:
file (str) – Filepath of the DICOM file
index_peak (int) – Index of the
EnergyWindowInformationSequence
DICOM attribute corresponding to the photopeak.index_lower (int) – Index of the
EnergyWindowInformationSequence
DICOM attribute corresponding to lower scatter window.index_upper (int) – Index of the
EnergyWindowInformationSequence
DICOM attribute corresponding to upper scatter window.
- Returns:
Tensor corresponding to the scatter estimate.
- Return type:
torch.Tensor[1,Ltheta,Lr,Lz]
- pytomography.io.SPECT.get_blank_below_above(file_NM)#
Obtains the number of blank z-slices at the sup (
blank_above
) and inf (blank_below
) of the projection data. This method is entirely empircal, and looks for z slices where there are zero detected counts.- Parameters:
file_NM (str) – Filepath to DICOM file.
- Returns:
A tuple of two elements corresponding to the number of blank slices at the inf, and the number of blank slices at the sup.
- Return type:
Sequence[int]
- pytomography.io.SPECT.get_psfmeta_from_scanner_params(camera_model, collimator_name, energy_keV)[source]#
Gets PSF metadata from SPECT camera/collimator parameters. Performs linear interpolation to find linear attenuation coefficient for lead collimators for energy values within the range 100keV - 600keV.
- Parameters:
camera_model (str) – Name of SPECT camera.
collimator_name (str) – Name of collimator used.
energy_keV (float) – Energy of the photopeak
- Returns:
PSF metadata.
- Return type: