pyanno4rt.patient.import_functions

Import functions module.


This module aims to provide import functions to extract computed tomography (CT) and segmentation data from the external data file(s).

Overview

Function

generate_ct_from_dcm(data, resolution)

Generate the CT dictionary from a folder with DICOM (.dcm) files.

generate_ct_from_mat(data, resolution)

Generate the CT dictionary from a MATLAB (.mat) file.

generate_ct_from_p(data, resolution)

Generate the CT dictionary from a Python binary (.p) file.

generate_segmentation_from_dcm(data, ct_slices, computed_tomography)

Generate the segmentation dictionary from a folder with DICOM (.dcm) files.

generate_segmentation_from_mat(data, computed_tomography)

Generate the segmentation dictionary from a MATLAB (.mat) file.

generate_segmentation_from_p(data, computed_tomography)

Generate the segmentation dictionary from a Python binary (.p) file.

import_from_dcm(path, resolution)

Import the patient data from a folder with DICOM (.dcm) files.

import_from_mat(path, resolution)

Import the patient data from a MATLAB (.mat) file.

import_from_p(path, resolution)

Import the patient data from a Python (.p) file.

read_data_from_dcm(path)

Read the DICOM data from the path.

read_data_from_mat(path)

Read the MATLAB data from the path.

read_data_from_p(path)

Read the Python data from the path.

Functions

pyanno4rt.patient.import_functions.generate_ct_from_dcm(data, resolution)[source]

Generate the CT dictionary from a folder with DICOM (.dcm) files.

Parameters:
  • data (tuple) – Tuple of pydicom.dataset.FileDataset objects with information on the CT slices.

  • resolution (None or list) – Imaging resolution for post-processing interpolation of the CT and segmentation data.

Returns:

computed_tomography – Dictionary with information on the CT images.

Return type:

dict

Raises:

ValueError – If either the grid resolutions, the image positions or the dimensionalities are inconsistent.

pyanno4rt.patient.import_functions.generate_ct_from_mat(data, resolution)[source]

Generate the CT dictionary from a MATLAB (.mat) file.

Parameters:
  • data (dict) – Dictionary with information on the CT slices.

  • resolution (None or list) – Imaging resolution for post-processing interpolation of the CT and segmentation data.

Returns:

computed_tomography – Dictionary with information on the CT images.

Return type:

dict

pyanno4rt.patient.import_functions.generate_ct_from_p(data, resolution)[source]

Generate the CT dictionary from a Python binary (.p) file.

Parameters:
  • data (dict) – Dictionary with information on the CT slices.

  • resolution (None or list) – Imaging resolution for post-processing interpolation of the CT and segmentation data.

Returns:

Dictionary with information on the CT images.

Return type:

dict

pyanno4rt.patient.import_functions.generate_segmentation_from_dcm(data, ct_slices, computed_tomography)[source]

Generate the segmentation dictionary from a folder with DICOM (.dcm) files.

Parameters:
  • data (object of class pydicom.dataset.FileDataset) – The pydicom.dataset.FileDataset object with information on the segmented structures.

  • slices (tuple) – Tuple of pydicom.dataset.FileDataset objects with information on the CT slices.

  • computed_tomography (dict) – Dictionary with information on the CT images.

Returns:

segmentation – Dictionary with information on the segmented structures.

Return type:

dict

Raises:

ValueError – If the contour sequence for a segment includes out-of-slice points.

pyanno4rt.patient.import_functions.generate_segmentation_from_mat(data, computed_tomography)[source]

Generate the segmentation dictionary from a MATLAB (.mat) file.

Parameters:
  • data (ndarray) – Array with information on the segmented structures.

  • computed_tomography (dict) – Dictionary with information on the CT images.

Returns:

segmentation – Dictionary with information on the segmented structures.

Return type:

dict

pyanno4rt.patient.import_functions.generate_segmentation_from_p(data, computed_tomography)[source]

Generate the segmentation dictionary from a Python binary (.p) file.

Parameters:
  • data (dict) – Dictionary with information on the segmented structures.

  • computed_tomography (dict) – Dictionary with information on the CT images.

Returns:

Dictionary with information on the segmented structures.

Return type:

dict

pyanno4rt.patient.import_functions.import_from_dcm(path, resolution)[source]

Import the patient data from a folder with DICOM (.dcm) files.

Parameters:
  • path (str) – Path to the DICOM folder.

  • resolution (None or list) – Imaging resolution for post-processing interpolation of the CT and segmentation data.

Returns:

  • dict – Dictionary with information on the CT images.

  • dict – Dictionary with information on the segmented structures.

pyanno4rt.patient.import_functions.import_from_mat(path, resolution)[source]

Import the patient data from a MATLAB (.mat) file.

Parameters:
  • path (str) – Path to the MATLAB file.

  • resolution (None or list) – Imaging resolution for post-processing interpolation of the CT and segmentation data.

Returns:

  • dict – Dictionary with information on the CT images.

  • dict – Dictionary with information on the segmented structures.

pyanno4rt.patient.import_functions.import_from_p(path, resolution)[source]

Import the patient data from a Python (.p) file.

Parameters:
  • path (str) – Path to the Python file.

  • resolution (None or list) – Imaging resolution for post-processing interpolation of the CT and segmentation data.

Returns:

  • dict – Dictionary with information on the CT images.

  • dict – Dictionary with information on the segmented structures.

pyanno4rt.patient.import_functions.read_data_from_dcm(path)[source]

Read the DICOM data from the path.

Parameters:

path (str) – Path to the DICOM folder.

Returns:

  • computed_tomography_data (tuple) – Tuple of pydicom.dataset.FileDataset objects with information on the CT slices.

  • segmentation_data (object of class pydicom.dataset.FileDataset) – The object representation of the segmentation data.

pyanno4rt.patient.import_functions.read_data_from_mat(path)[source]

Read the MATLAB data from the path.

Parameters:

path (str) – Path to the MATLAB file.

Returns:

  • dict – Dictionary with information on the CT slices.

  • ndarray – Array with information on the segmented structures.

pyanno4rt.patient.import_functions.read_data_from_p(path)[source]

Read the Python data from the path.

Parameters:

path (str) – Path to the Python file.

Returns:

  • dict – Dictionary with information on the CT slices.

  • dict – Dictionary with information on the segmented structures.