import_analysis.patient module

class import_analysis.patient.ImportPatient(path=None, exclude=None, unsorted_dicom=True, id_mappings=None, load_dose_sum=True, load_masks=False)

Bases: Patient

Class that adds to the methods of skrt.patient.Patient.

The additional functionality provided is aimed at simplifying analysis of data from the IMPORT study.

Different from skrt.patient.Patient, the default is to load data as unsorted DICOM.

__init__(path=None, exclude=None, unsorted_dicom=True, id_mappings=None, load_dose_sum=True, load_masks=False)

Create instance of ImportPatient class.

Parameters:

pathstr/pathlib.Path, default=None

Relative or absolute path to a directory containing patient data. If None, the path used is the path to the current working directory.

excludelist, default=None

List of first-level sub-directories to disregard when loading patient data organised accoding to the VoxTox model (patient -> studies -> modalites). If None, then set to [“logfiles”]. Ignored if <unsorted_dicom> set to True.

unsorted_dicombool, default=True

If True, don’t assume that patient data are organised accoridng to the VoxTox model, and creates data hierarchy based on information read from DICOM files.

id_mappingsdict, default=None

By default, the patient identifier is set to be the name of the directory that contains the patient data. The id_mappings dictionary allows mapping from the default name (dictionary key) to a different name (associated value).

load_dose_sumbool, default=True

If True, load planned dose, summed over contributions, at initialisation time. If False, leave loading until dose sum is requested via call to getter method (get_dose_sum()).

load_masksbool, default=True

If True, create foreground masks for patient’s plan and relapse CT images at initialisation time, using default parameters. If False, leave mask creation until requested via vall to getter method (get_mask_plan(), get_mask_relapse()).

get_centroid_translation(roi_name, reverse=False)

Get centroid translation between plan and relapse scans of named ROI.

Parameters:

roi_namestr

Standardised name of control structure. Should be one of “carina”, “spinal_canal”, “sternum”.

reversebool, default=False

By default, the (dx, dy, dz) tuple returned represents the amount by which the centroid of the ROI in the relapse scan is translated with respect to the centroid of the ROI in the planning scan. If <reverse> is True, the translation returned is of the ROI in the planning scan with respect to the ROI in the relapse scan

get_ct_plan()

Get CT scan for treatment planning

get_ct_relapse()

Get CT scan for relapse

get_dose_sum(image=None)

Get planned dose, summed over contributions.

Parameter:

imageskrt.image.Image, default=None

Image to be associated with the dose sum. If None, the associated image will be the CT planning scan (self.ct_plan).

get_dose_summation_types(remove_duplicates=True)

Get list of summation types for doses associated with this patient.

Parameter: remove_duplicates : bool, default=True

If True, disregard any duplicate dose objects (same array shape and dose values).

get_mask_plan(threshold=-500, convex_hull=False, fill_holes=True, dxy=5, force=False)

Get foreground mask for CT planning scan.

Parameters:

thresholdint/float, default=-500

Intensity value above which pixels in a slice are assigned to regions for determination of foreground.

convex_hullbool, default=False

If False, create mask from the convex hulls of the slice foreground masks initially obtained.

fill_holesbool, default=True

If False, fill holes in the slice foreground masks initially obtained.

forcebool, default=False

If True, force mask creation, overwriting any mask created previously.

get_mask_relapse(threshold=-500, convex_hull=False, fill_holes=True, dxy=5, force=False)

Get foreground mask for CT planning scan.

Parameters:

thresholdint/float, default=-500

Intensity value above which pixels in a slice are assigned to regions for determination of foreground.

convex_hullbool, default=False

If False, create mask from the convex hulls of the slice foreground masks initially obtained.

fill_holesbool, default=True

If False, fill holes in the slice foreground masks initially obtained.

forcebool, default=False

If True, force mask creation, overwriting any mask created previously.

get_ss_clinical(image=None)

Get clinical structure set for CT planning scan.

Parameter:

imageskrt.image.Image, default=None

Image to be associated with the structure set. If None, the associated image will be the CT planning scan (self.ct_plan).

get_ss_plan(image=None)

Get control-structures structure set for CT planning scan.

Parameter:

imageskrt.image.Image, default=None

Image to be associated with the structure set. If None, the associated image will be the CT planning scan (self.ct_plan).

get_ss_recurrence(image=None)

Get recurrence structure set for CT relapse scan.

Parameter:

imageskrt.image.Image, default=None

Image to be associated with the structure set. If None, the associated image will be the CT relapse scan (self.ct_relapse).

get_ss_relapse(image=None)

Get control-structures structure set for CT relapse scan.

Parameter:

imageskrt.image.Image, default=None

Image to be associated with the structure set. If None, the associated image will be the CT relapse scan (self.ct_relapse).

load_key_data(load_dose_sum=True, load_masks=True, force=False)

Perform loading of key data relevant to IMPORT study.

This method sets the following:

self.ct_planskrt.image.Image

CT scan used in treatment planning.

self.ct_relapaseskrt.image.Image

CT scan recorded at the time of relapse.

self.dose_sumskrt.dose.Dose

Planned dose, summed over contributions. Initialised to None if <load_dose_sum> is False.

self.ss_clinicalskrt.structures.StructureSet

Clinical structure set, containing structures used in treatment planning.

self.ss_planskrt.structures.StructureSet

Research structure set, containing control structures outlined on the planning scan.

self.ss_recurrenceskrt.structures.StructureSet

Research structure set, containing recurrence outlined on the relapse scan.

self.ss_relapaseskrt.structures.StructureSet

Research structure set, containing control structures and outlined on the relapse scan.

Parameters:

load_dose_sumbool, default=True

If True, load planned dose, summed over contributions, at initialisation time. If False, leave loading until dose sum is requested via call to getter method (get_dose_sum()).

load_masksbool, default=True

If True, create foreground masks for patient’s plan and relapse CT images at initialisation time. If False, leave mask creation until requested via vall to getter method (get_mask_plan(), get_mask_relapse()).

forcebool, default=False

If True, load data from source, even if previously loaded.