API Reference#
Model#
- class deep_quality_estimation.model.DQE(device: torch.device | None = None, cuda_devices: str | None = '0')#
Bases:
object- predict(t1c: Path | ndarray[Any, dtype[_ScalarType_co]], t1: Path | ndarray[Any, dtype[_ScalarType_co]], t2: Path | ndarray[Any, dtype[_ScalarType_co]], flair: Path | ndarray[Any, dtype[_ScalarType_co]], segmentation: Path | ndarray[Any, dtype[_ScalarType_co]]) Tuple[float, Dict[View, float]]#
Predict the quality of the given Segmentation
- Parameters:
t1c (Union[Path, NDArray]) – Numpy NDArray or Path to the T1c NIfTI file
t1 (Union[Path, NDArray]) – Numpy NDArray or Path to the T1 NIfTI file
t2 (Union[Path, NDArray]) – Numpy NDArray or Path to the T2 NIfTI file
flair (Union[Path, NDArray]) – Numpy NDArray or Path to the FLAIR NIfTI file
segmentation (Union[Path, NDArray]) – Numpy NDArray or Path to the segmentation NIfTI file (In BraTS style)
- Returns:
The predicted mean score and a dict with the scores per view
- Return type:
Tuple[float, Dict[View, float]]
Data Handling#
- class deep_quality_estimation.data_handler.DataHandler(t1c: Path | ndarray[Any, dtype[_ScalarType_co]], t1: Path | ndarray[Any, dtype[_ScalarType_co]], t2: Path | ndarray[Any, dtype[_ScalarType_co]], flair: Path | ndarray[Any, dtype[_ScalarType_co]], segmentation: Path | ndarray[Any, dtype[_ScalarType_co]])#
Bases:
object- ALL_CHANNELS = ['images', 'labels']#
- ONLY_IMAGES = ['images']#
- ONLY_LABELS = ['labels']#
- get_dataloader() torch.utils.data.DataLoader#
Get the dataloader for the dataset
- Returns:
The dataloader
- Return type:
DataLoader
- class deep_quality_estimation.transforms.CustomConvertToMultiChannelBasedOnBratsClasses(*args: Any, **kwargs: Any)#
Bases:
TransformAdapted from Monai’s ConvertToMultiChannelBasedOnBratsClasses since label 4 changed to 3 in newer datasets
Convert labels to multi channels based on brats18 classes: label 1 is the necrotic and non-enhancing tumor core label 2 is the peritumoral edema label 3 is the GD-enhancing tumor (used to be label 4 in older datasets) The possible classes are TC (Tumor core), WT (Whole tumor) and ET (Enhancing tumor).
- backend: list[TransformBackends] = [monai.utils.enums.TransformBackends.TORCH, monai.utils.enums.TransformBackends.NUMPY]#
- class deep_quality_estimation.transforms.CustomConvertToMultiChannelBasedOnBratsClassesd(*args: Any, **kwargs: Any)#
Bases:
MapTransformAdapted from Monai’s ConvertToMultiChannelBasedOnBratsClassesd
Dictionary-based wrapper of
monai.transforms.ConvertToMultiChannelBasedOnBratsClasses. Convert labels to multi channels based on brats18 classes: label 1 is the necrotic and non-enhancing tumor core label 2 is the peritumoral edema label 3 is the GD-enhancing tumor (used to be label 4 in older datasets) The possible classes are TC (Tumor core), WT (Whole tumor) and ET (Enhancing tumor).- backend = [monai.utils.enums.TransformBackends.TORCH, monai.utils.enums.TransformBackends.NUMPY]#
Utilities#
- deep_quality_estimation.center_of_mass.compute_center_of_mass(segmentation: Path | ndarray[Any, dtype[_ScalarType_co]], fallback_to_edema: bool = True) List[int]#
Compute the center of mass of the tumor core in the given segmentation. If no tumor core is found and the @fallback_to_edema is true, the center of mass of the edema is used as a fallback.
- Parameters:
segmentation (Union[Path, NDArray]) – Path to the segmentation file or the segmentation data as numpy NDArray.
fallback_to_edema (bool, optional) – Use Edema CoM as fallback if no tumor core is found. Defaults to True.
- Returns:
List of the center of mass coordinates
- Return type:
List[int]
- deep_quality_estimation.center_of_mass.get_center_of_mass_slices(image: Path | ndarray[Any, dtype[_ScalarType_co]], center_of_mass: List[int]) dict[View, ndarray[Any, dtype[_ScalarType_co]]]#
Get the slices of the given image that contain the center of mass in axial, coronal and sagittal view.
- Parameters:
image (Path) – Path to the NiFTI image file
center_of_mass (List[int]) – List of the center of mass coordinates
- Returns:
Dictionary with the views as keys and the 2D image slices as values
- Return type:
Dict[View, NDArray]