pytrip.paths module

This module provides the DensityCube class and some special class to find robust angles for treament based on a quality index factor defined in http://dx.doi.org/10.3109/0284186X.2015.1067720.

class pytrip.paths.DensityCube(ctxcube, hlut_path='/data/hlut_den.dat')[source]

Bases: pytrip.cube.Cube

Class for working with denisity cubes [g/cm3]

calculate_cube()[source]

Calculate the density values from HU table and interpolating the loaded hlut_data.

import_hlut()[source]

Imports the Hounsfield lookup table and stores it into self.hlut_data object self.hlut_data is trained linear interpolator, it can be later called to get interpolated values

class pytrip.paths.DensityProjections(cube)[source]

Functions here were mosly used buy for the publication http://dx.doi.org/10.3109/0284186X.2015.1067720

calculate_angle_quality(voi, gantry, couch, calculate_from=0, stepsize=1.0, avoid=[], voi_cube=None, gradient=True)[source]

Calculates a quality index for a given gantry/couch combination.

calculate_angle_quality_thread(voi, gantry, couch, calculate_from=0, stepsize=1.0, q=None, avoid=[], voi_cube=None, gradient=True)[source]

TODO: Documentation

calculate_back_start_voi(voi, start, beam_axis)[source]

TODO: Documentation

Params voi:
Params start:
Params beam axis:
 
Returns:
calculate_best_angles(voi, fields, min_dist=20, gantry_limits=[-90, 90], couch_limits=[0, 359], avoid=[])[source]

TODO: Documentation

calculate_front_start_voi(voi, start, beam_axis)[source]

TODO: Documentation

Params voi:
Params start:
Params beam axis:
 
Returns:
calculate_projection(voi, gantry, couch, calculate_from=0, stepsize=1.0)[source]

TODO: documentation

Parameters:
  • voi (Voi) – tumortarget, type is Voi
  • gantry (float) – angle in degrees
  • couch (float) – angle in degrees
  • calculate_from (int) – 0 is mass center 1 is the most distant point in the tumor from the beamaxis
  • stepsize (float) – relative to pixelsize, 1 is a step of 1 pixel
Returns:

calculate_quality_grid(voi, gantry, couch, calculate_from=0, stepsize=1.0, avoid=[], gradient=True)[source]

TODO: Documentation

calculate_quality_list(voi, gantry, couch, calculate_from=0, stepsize=1.0, avoid=[], gradient=True)[source]

TODO: Documentation

optimize_angle(voi, couch, gantry, margin, iteration, avoid=[])[source]

TODO: Documentation

pytrip.paths.cmp_sort(a, b)[source]

Sorting key. If gantry angle is equal, then sort by couch angle.