pytrip.raster module

This module provides the top-level Rst class which can handle accelerator control files generated by TRiP98. It also provides the SubMachine class which treats individual energy layers.

class pytrip.raster.Rst[source]

This class handles raster scan data, which are accelerator control files in GSI format. Raster scan data are stored in .rst file, and describe the amount of particles going into each spot in each energy layer. Each energy layer is called a ‘submachine’.

gaussian_blur(sigma)[source]

For a loaded .rst file, apply a normal distributed setup error to each energy layer of sigma magnitude. :params float sigma” 1-sigma error to be applied to all positions.

get_min_max()[source]

Retrieve the largest and smallest x,y position found in all energy layers.

Returns:A list of four values in [x_min,x_max,y_min,y_max] in [mm].
get_stepsize()[source]

Returns the distance between each spot in the first energy plane.

Most likely the distance will be the same in all planes.

Returns:Distancce between spots in [mm]. If no submachines are found, None is returned.
get_submachines()[source]
Returns:A list of submachines.
read(path)[source]

Load and parse a raster scan (.rst) file.

Parameters:path (str) – Full path to the file to be loaded, including file extension.
read_from_dicom(path)[source]

Load a Dicom file from ‘path’

Currently, this function merely stores the dicom data into self.data. No interpretation is done.

Parameters:path (str) – Full path to Dicom file.
save_random_error_rst(path, sigma)[source]
class pytrip.raster.SubMachine[source]
get_raster_grid()[source]
raster_min_max()[source]

Returns the smallest and largest x and y positions for this energy layer. :returns: a list of four elements [min_x, max_x, min_y, max_y]

save_random_error_machine(fp, sigma)[source]

Generates and stores a single energy layer where Gaussian blur has been applied.

Parameters:
  • fp – file pointer
  • sigma (float) – sigma of the Gaussian blur to be applied [mm]