pytrip.ctx module

The CTX module contains the CtxCube class which is inherited from the Cube class. It is used for handling CT-data, both Voxelplan and Dicom.

class pytrip.ctx.CtxCube(cube=None)[source]

Bases: pytrip.cube.Cube

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

create_dicom()[source]

Creates a Dicom object from self.

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

Returns:A Dicom object.
data_file_extension = '.ctx'
header_file_extension = '.hed'
read_dicom(dcm)[source]

Imports CT-images from Dicom object.

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

Write CT-data to disk, in TRiP98/Voxelplan format.

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

Parameters:path (str) – path to header file, data file or basename (without extension)
write_dicom(directory)[source]

Write CT-data to disk, in Dicom format.

Parameters:directory (str) – directory to write to. If directory does not exist, it will be created.