pytrip.dos module

This module provides the DosCube class, which the user should use for handling plan-generated dose distributions.

class pytrip.dos.DosCube(cube=None)[source]

Bases: pytrip.cube.Cube

Class for handling Dose data. In TRiP98 these are stored in VOXELPLAN format with the .dos suffix. This class can also handle Dicom files.

calculate_dvh(voi)[source]

Calculate DHV for given VOI. Dose is given in relative units (target dose = 1.0). In case VOI lies outside the cube, then None is returned.

Parameters:voi – VOI for which DHV should be calculated
Returns:(dvh, min_dose, max_dose, mean, area) tuple. dvh - 2D array holding DHV histogram,

min_dose and max_dose, mean_dose - obvious, mean_volume - effective volume dose.

create_dicom()[source]

Creates a Dicom RT-Dose object from self.

This function can be used to convert a TRiP98 Dose file to Dicom format.

Returns:a Dicom RT-Dose object.
create_dicom_plan()[source]

Create a dummy Dicom RT-plan object.

The only data which is forwarded to this object, is self.patient_name. :returns: a Dicom RT-plan object.

data_file_extension = '.dos'
header_file_extension = '.hed'
read_dicom(dcm)[source]

Imports the dose distribution from Dicom object.

Parameters:dcm (Dicom) – a Dicom object
write(path)[source]

Write Dose data to disk, in TRiP98/Voxelplan format.

This method will build and write both the .hed and .dos file.

Parameters:path (str) – Path, any file extentions will be ignored.
write_dicom(directory)[source]

Write Dose-data to disk, in Dicom format.

This file will save the dose cube and a plan associated with that dose. Function call create_dicom() and create_dicom_plan() and then save these.

Parameters:directory (str) – Directory where ‘rtdose.dcm’ and ‘trplan.dcm’ will be stored.
write_dvh(voi, filename)[source]

Save DHV for given VOI to the file.