src.algorithms.segment package¶
Submodules¶
src.algorithms.segment.trained_model module¶
algorithms.segment.trained_model¶
An API for a trained segmentation model to predict nodule boundaries and descriptive statistics.
-
src.algorithms.segment.trained_model.calculate_volume(segment_path, centroids)¶ Calculates tumor volume from pixel masks
Parameters: - segment_path (str) – A path to the serialized binary mask for each centroid
- centroids (list[dict]) –
- A list of centroids of the form::
- {‘x’: int,
- ‘y’: int, ‘z’: int}
Returns: List of volumes per centroid
Return type: list[float]
-
src.algorithms.segment.trained_model.predict(dicom_path, centroids)¶ Predicts nodule boundaries.
- Given a pth to a DICOM image and a list of centroids
- load the segmentation model from its serialized state
- pre-process the dicom data into whatever format the segmentation model expects
- for each pixel create an indicator 0 or 1 of if the pixel is cancerous
- write this binary mask to disk, and return the path to the mask
Parameters: - dicom_path (str) – a path to a DICOM directory
- centroids (list[dict]) –
- A list of centroids of the form::
- {‘x’: int,
- ‘y’: int, ‘z’: int}
Returns: - Dictionary containing path to serialized binary masks and
volumes per centroid with form:: {‘binary_mask_path’: str,
‘volumes’: list[float]}
Return type: dict