pytomography.io.SPECT.simind#

Module Contents#

Functions#

get_metadata(headerfile[, corrfile])

Obtains required metadata from a SIMIND header file.

_get_projections_from_single_file(headerfile)

Gets projection data from a SIMIND header file.

get_projections(headerfiles[, weights])

Gets projection data from a SIMIND header file.

get_energy_window_bounds(headerfile)

Computes the lower and upper bounds of the energy window from a SIMIND header file

get_energy_window_width(headerfile)

Computes the energy window width from a SIMIND header file

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.

get_attenuation_map(headerfile[, smi_index_22])

Opens attenuation data from SIMIND output

get_psfmeta_from_header(headerfile[, min_sigmas])

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

Attributes#

pytomography.io.SPECT.simind.relation_dict[source]#
pytomography.io.SPECT.simind.get_metadata(headerfile, corrfile=None)[source]#

Obtains required metadata from a SIMIND header file.

Parameters:
  • headerfile (str) – Path to the header file

  • corrfile (str, optional) – .cor file used in SIMIND to specify radial positions for non-circular orbits. This needs to be provided for non-standard orbits.

Returns:

Required information for reconstruction in PyTomography.

Return type:

(SPECTObjectMeta, SPECTProjMeta, torch.Tensor[1, Ltheta, Lr, Lz])

pytomography.io.SPECT.simind._get_projections_from_single_file(headerfile)[source]#

Gets projection data from a SIMIND header file.

Parameters:
  • headerfile (str) – Path to the header file

  • distance (str, optional) – 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’.

Returns:

Simulated SPECT projection data.

Return type:

(torch.Tensor[1, Ltheta, Lr, Lz])

pytomography.io.SPECT.simind.get_projections(headerfiles, weights=None)[source]#

Gets projection data from a SIMIND header file.

Parameters:
  • headerfile (str) – Path to the header file

  • distance (str, optional) – 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’.

  • headerfiles (str | Sequence[str]) –

  • weights (float) –

Returns:

Simulated SPECT projection data.

Return type:

(torch.Tensor[1, Ltheta, Lr, Lz])

pytomography.io.SPECT.simind.get_energy_window_bounds(headerfile)[source]#

Computes the lower and upper bounds of the energy window from a SIMIND header file

Parameters:

headerfile (str) – SIMIND header file

Returns:

Lower and upper energies

Return type:

tuple[float, float]

pytomography.io.SPECT.simind.get_energy_window_width(headerfile)[source]#

Computes the energy window width from a SIMIND header file

Parameters:

headerfile (str) – Headerfile corresponding to SIMIND data

Returns:

Energy window width

Return type:

float

pytomography.io.SPECT.simind.combine_projection_data(headerfiles, weights)[source]#

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

Parameters:
  • headerfiles (Sequence[str]) – List of filepaths corresponding to the SIMIND header files of different simulated regions

  • weights (Sequence[str]) – Amount by which to weight each projection relative.

Returns:

Returns necessary object/projections metadata along with the projection data

Return type:

(SPECTObjectMeta, SPECTProjMeta, torch.Tensor)

pytomography.io.SPECT.simind.get_attenuation_map(headerfile, smi_index_22=3)[source]#

Opens attenuation data from SIMIND output

Parameters:
  • headerfile (str) – Path to header file

  • smi_index_22 (int, optional) – Value of provided in the simind simulation tag: “ in:x22,<idx>x “ where <idx> is 3 (mu) or 5 (mu-castor). You can check what value this is by default (if you did not provide it) by looking at simind.ini in the simind/smc_dir folder. Defaults to 3.

Returns:

Tensor containing attenuation map required for attenuation correction in SPECT/PET imaging.

Return type:

torch.Tensor[batch_size, Lx, Ly, Lz]

pytomography.io.SPECT.simind.get_psfmeta_from_header(headerfile, min_sigmas=3)[source]#

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

Parameters:

headerfile (str) – SIMIND headerfile.

Returns:

SPECT PSF metadata required for PSF modeling in reconstruction.

Return type:

SPECTPSFMeta