ROIP

class PDCP.ROIP(ptype='breast')

Bases: object

A class to work with the patient’s organs at risk (OARs) and target volumes (TV)

Methods Summary

generate_slice_roi(roiname, maskname, dim, …)

A function used to generate the central slice of an OAR or TV.

generate_slices_patient_rois(dim)

A function used to generate 2d images of slices with the highest number of contoured pixels, for all the ROI structures.

load_central_slices([notesdir, pids, dim, …])

This is a function that generates the patients list of OARs and TV.

load_data_from_file(patientsnotesdirectory, …)

A function that loads patients CT and masks from the directory.

load_patient_central_slices(PatId[, …])

This function is used to prepare a dataframe that contains the patients rois and its corresponding images locations.

Methods Documentation

generate_slice_roi(roiname, maskname, dim, thenumber)

A function used to generate the central slice of an OAR or TV.

Parameters
  • roiname (str) – name of the OAR or TV as it was in the plan

  • maskname (str) – represents the key of the mask in the dictionary that contains the patients masks.

  • dim (int) – The dimension on which the slice to to be created (x,y,z).

  • thenumber (int) – The number of the roi in the list of rois associated with the patient plan. the main reason behind using this is to avoid overriding some structures with duplicates being obtained.

Returns

  • deta (str) – path to the generated numpy array that contains the positional features.

  • ida (str) – path to the generated slice

generate_slices_patient_rois(dim)

A function used to generate 2d images of slices with the highest number of contoured pixels, for all the ROI structures. Function load_data_from file should be executed before this function. This function can be used to review some patients OARs and TV

Parameters

dim (int) – the targeted dimension (can be 0,1, or 2)

static load_central_slices(notesdir='../../Breast_dosimetry_data/patientnotes/', pids=[], dim='x', categorize=True, datatype='breast')

This is a function that generates the patients list of OARs and TV.

Parameters
  • notesdir (str) – path to patients notes directory

  • pids (list) – if a list of patients is needed, not all. Otherwise keep empty.

  • dim (str) – dimension (x,y, or z)

  • categorize (bool) – a boolean function to categorize the roi names.

Returns

  • df (pandas dataframe) – pandas dataframe that contains the patient ROIs and corresponding images/details paths.

  • succ_patients (list) – A list of successfully loaded patients

  • exec_patients (list) – A list of excluded patients.

  • not_found (list) – patients whose notes were not found.

load_data_from_file(patientsnotesdirectory, patientdirectory, pid)

A function that loads patients CT and masks from the directory.

Parameters
  • patientsnotesdirectory (str) – patient notes directory

  • patientdirectory (str) – patient data directory

  • pid (int) – patient id

static load_patient_central_slices(PatId, notesdir='../../Breast_dosimetry_data/patientnotes/', dim='x')

This function is used to prepare a dataframe that contains the patients rois and its corresponding images locations.

Parameters
  • PatId (int) – patient id

  • notesdir (str) – path to patients directory

  • dim (str) – dimension (x,y, or z)

Returns

df – pandas dataframe that contains the patient ROIs and corresponding images/details paths.

Return type

pandas dataframe