Utility Functions

petl_server.PETLserver.print_parameters(self)

Prints the PET geometry and PET volume parameters to the screen

petl_server.PETLserver.all_defined(self)

Returns True if the volume parameters are specified and at least one set of coincience flat panel detectors are specified, otherwise returns False. This function must return True before any projector of reconstruction algorithm function can be called.

petl_server.PETLserver.clearAll(self)

Clears all PETL parameters, e.g., all planogram and volume specifications

petl_server.PETLserver.set_response(self, R)

Sets the response map (i.e., sensitivity) This map can be used to correct data (turn it into line integral data) by dividing the planogram data by this response.

Once this response is defined, it will automatically be applied after call to project and before every call to backproject

See also: calc_response, apply_corrections, clear_response

Parameters:

R (list of numpy array) – the response map

petl_server.PETLserver.clear_response(self)

Clears the response map (i.e., sensitivity)

petl_server.PETLserver.calc_response(self, oversampling=1, mu=None)

This function calculate the response (i.e., sensitivity) and stores it is composed of a product of the solid angle, attenuation, and detector uniformity

See also: add_module, calc_response, apply_corrections, clear_response

Parameters:
  • oversampling (int) – the oversampling factor for calculating the detector uniformity larger numbers take longer to compute, but are more accurate as they model the partial response for rays at/ near the detector module boundaries if 0, this calculation is not made

  • mu (numpy array) – optional parameter which specifies the attenuation map (mm^-1 at 511 keV) is specified, includes attenuation in the response map

petl_server.PETLserver.stopping_power(self, g=None, oversampling=1)

Performs analytic ray-tracing simulation through a phantom composed of geometrical objects

See the addObject function for how to build the phantom description The CT geometry parameters must be specified prior to running this functions

Parameters:
  • g (C contiguous float32 numpy array) – CT projection data

  • oversampling (int) – the oversampling factor for each ray

Returns:

g

petl_server.PETLserver.apply_corrections(self, g, oversampling=1, mu=None)

If the response is already specified, this function simply applies the correction If the response is not specified, this function calculates the response and then applies the correction.

Parameters:
  • g (list of numpy array) – projection data

  • oversampling (int) – the oversampling factor for calculating the detector uniformity larger numbers take longer to compute, but are more accurate as they model the partial response for rays at/ near the detector module boundaries if 0, this calculation is not made

  • mu (numpy array) – optional parameter which specifies the attenuation map (mm^-1 at 511 keV) is specified, includes attenuation in the response map

Returns:

g, the corrected projection data

petl_server.PETLserver.apply_solid_angle_correction(self, g=None, do_inverse=False)

” Applies solid angle correction to given projection data

Parameters:

g (list of numpy arrays) – projection data

Returns:

g, the same as the input

petl_server.PETLserver.bin(self, file_name, g=None)

Bins list mode data If data is given this function will add to that data (not reset it). This allows one to accumulate counts from several files.

Parameters:
  • file_name (string) – full path to the list mode file

  • g (list of numpy arrays or None) – projection data

petl_server.PETLserver.save_data(self, file_name, x)

Saves data in an npy or nrrd file

Parameters:
  • file_name (string) – full path to npy or nrrd file you want to save

  • x (numpy array) – data to be saved

petl_server.PETLserver.load_data(self, file_name, x=None)

Loads data from an npy or nrrd file

Parameters:
  • file_name (string) – full path to an npy or nrrd file

  • x (numpy array or None) – where to store the data, if None allocates the data for you

Returns:

x, the same as the input