dicom_to_cnn.model.petctviewer package¶
Submodules¶
dicom_to_cnn.model.petctviewer.CsvReader module¶
- class dicom_to_cnn.model.petctviewer.CsvReader.CsvReader(path: str)¶
Bases:
objectCSV Parser for CSV generated by petctviewer.org
- classmethod convert_manual_row_to_object(manual_row: list, results_row: list) dict¶
Return a row manual row in an object with ROI details
- Arguments:
manual_row ([list]) : manual row, where to find coordonates results_row ([list]) : results row, where to find name, roi_number, suv_mean, sd, suv_max, etc
- Returns:
[dict] – dict describing the ROI
- classmethod convert_nifti_row_to_object(nifti_row: list, results_row: list) dict¶
Return list of point included in the roi
- Arguments:
nifti_row ([list]) : nifti row of the csv, where to find coordonates results_row ([list]) : results row, where to find name, roi_number, suv_mean, sd, suv_max, etc
- Returns:
[dict] – dict describing the ROI
- get_SUL() str¶
return the SUL value of the CSV
- get_SUVlo() str¶
return the SUVlo value of the CSV
- get_csv_roi_details() dict¶
return a dict with each ROI information to build the mask
- Returns:
- ([dict]){(roi)1{dict generated by convert_manual_row_to_object() or convert_nifti_row_to_object() },
(roi)2 : // , … ‘SUL’ : value , ‘SUVlo’ : value}
- get_date() str¶
return date in csv file
- Returns:
[str]: [return date in csv file]
- get_manual_rois() list¶
return manual rois block
- get_nifti_rois() list¶
return automatic (nifti) roi block
- get_patient_id() str¶
return patient id in csv file
- Returns:
[str]: [retuen patient id in csv file]
- get_rois_results() list¶
Return CSV lines containing ROIs results
- get_sum_row() list¶
return csv line containing sum rois volume
- get_time() str¶
return time in csv file
- Returns:
[str]: [return time in csv file]
- classmethod list_string_to_point_list_int(point_list_string: list) list¶
Transforms point string into list of coordinate (int)
- Arguments:
point_list_strings ([list]) : list of point string
- Returns:
point_list [(list)] : [return list of coordonates (int)]
dicom_to_cnn.model.petctviewer.MaskBuilder module¶
dicom_to_cnn.model.petctviewer.Roi module¶
- class dicom_to_cnn.model.petctviewer.Roi.Roi(axis: int, first_slice: int, last_slice: int, roi_number: int, type_number: int, list_point: list, volume_dimension: tuple)¶
Bases:
objectA class to represent a ROI
- coronal_to_axial(np_array_3D: numpy.ndarray) numpy.ndarray¶
transform coronal 3d ndarray to 3d axial ndarray
- Args:
np_array_3D (np.ndarray): [ROI ndarray]]
- Returns:
[np.ndarray]: [return axial ndarray]
- get_empty_np_array() numpy.ndarray¶
Return numpy array to fill given the current dimension and axis
- Returns:
[np.ndarray] – zero filled numpy array
- get_mask(list_points: list) numpy.ndarray¶
generate an empty ndarray and fill up with ROI coordonates
- Args:
list_points (list): [ [[x,y,z], [x,y,z], [x,y,z], …] ]
- Returns:
[np.ndarray]: [return binary ndarray of the ROI]
- mask_roi_in_slice(patch: <module 'matplotlib.patches' from '/home/docs/.pyenv/versions/3.7.9/lib/python3.7/site-packages/matplotlib/patches.py'>) list¶
get ROI x and y limits in which we will loop, to gather [x,y] pixel which are in the patch
- Args:
patch (matplotlib.patches): [polygon or ellipse]]
- Returns:
[list]: [list of [x,y] coordonates]
- sagittal_to_axial(np_array_3D: numpy.ndarray) numpy.ndarray¶
transform saggital 3d ndarray to 3d axial ndarray
- Args:
np_array_3D (np.ndarray): [ROI ndarray]]
- Returns:
[np.ndarray]: [return axial ndarray]
dicom_to_cnn.model.petctviewer.RoiElipse module¶
- class dicom_to_cnn.model.petctviewer.RoiElipse.RoiElipse(axis: int, first_slice: int, last_slice: int, roi_number: int, type_number: int, list_point: list, volume_dimension: tuple)¶
Bases:
dicom_to_cnn.model.petctviewer.Roi.RoiDerivated Class for manual Elipse ROI of PetCtViewer.org
- Returns:
[RoiElipse] – Roi Elipse Object
- calculateMaskPoint()¶
calculate [x,y,z] coordonates/voxel which belong to the ROI in ellipse patches
- Returns:
[list]: [list of [x,y,z] coordonates of ROI ]
dicom_to_cnn.model.petctviewer.RoiFactory module¶
- class dicom_to_cnn.model.petctviewer.RoiFactory.RoiFactory(details: dict, volume_dimension: tuple, roi_number: int)¶
Bases:
objectCreate ROI object from a CSV Roi details
- Returns:
[RoiFactory] – Factory for ROI instanciation according to csv details
- read_roi() dicom_to_cnn.model.petctviewer.Roi.Roi¶
Instanciate the Correct ROI type according to data
- Returns:
[Roi] – Roi object
dicom_to_cnn.model.petctviewer.RoiNifti module¶
- class dicom_to_cnn.model.petctviewer.RoiNifti.RoiNifti(roi_number: int, list_point: list, volume_dimension: tuple)¶
Bases:
dicom_to_cnn.model.petctviewer.Roi.RoiDerivated Class for automatic Nifti ROI of PetCtViewer.org
- Returns:
[RoiNifti] – Nifti ROI
- calculateMaskPoint() list¶
Return [x,y,z] coordonates/voxel of nifti ROI (already in CSV file)
- Returns:
[list]: [list of [x,y,z] coordonates of ROI ]
dicom_to_cnn.model.petctviewer.RoiPolygon module¶
- class dicom_to_cnn.model.petctviewer.RoiPolygon.RoiPolygon(axis: int, first_slice: int, last_slice: int, roi_number: int, type_number: int, list_point: list, volume_dimension: tuple)¶
Bases:
dicom_to_cnn.model.petctviewer.Roi.RoiDerivated Class for manual Polygon ROI of PetCtViewer.org
- Returns:
[RoiPolygon] – Polygone ROI
- calculateMaskPoint() list¶
calculate [x,y,z] coordonates/voxel which belong to the ROI in polygon patches
- Returns:
[list]: [list of [x,y,z] coordonates of ROI]
dicom_to_cnn.model.petctviewer.csv_volume module¶
- dicom_to_cnn.model.petctviewer.csv_volume.get_difference_volume(csv_path: str) tuple¶
Calcul the difference between volume and sum of every ROI volume
- Args:
csv_path ([str]): [CSV file path]
- Returns:
[tuple]: [Return total_volume, sum of every ROIs volume, and difference between the 2]
- dicom_to_cnn.model.petctviewer.csv_volume.get_sum_rois_volume(list_results_row: list) float¶
sum all ROIs volume
- Args:
liste ([list]): [List of every ROI results row from CSV file]
- Returns:
[float]: [Return the sum of ROIs volume]
- dicom_to_cnn.model.petctviewer.csv_volume.get_total_volume(csv_path: str) float¶
get total volume of all ROI in CSV file
- Args:
csv_path (str): [path of the CSV file]
- Returns:
[float]: [total volume of tumor]
- dicom_to_cnn.model.petctviewer.csv_volume.keep_csv_higher_volume(liste_csv_path: list) list¶
function to
- Args:
liste_csv_path ([list]): [list of CSV file path]
- Returns:
([list]) : [return the CSV file path with the higher volume]