MRI Segmentation Data Classes#

class atommic.collections.segmentation.data.mri_segmentation_loader.SegmentationMRIDataset(*args: Any, **kwargs: Any)[source]#

Bases: MRIDataset

A dataset class for MRI segmentation.

Examples

>>> from atommic.collections.segmentation.data.mri_segmentation_loader import SegmentationMRIDataset
>>> dataset = SegmentationMRIDataset(root='data/train', sample_rate=0.1)
>>> print(len(dataset))
100
>>> kspace, imspace, coil_sensitivities, mask, initial_prediction, segmentation_labels, attrs, filename,     slice_num = dataset[0]
>>> print(kspace.shape)
np.array([30, 640, 368])
process_segmentation_labels(segmentation_labels: numpy.ndarray) numpy.ndarray[source]#

Process segmentation labels to remove, combine, and separate classes.

Parameters

segmentation_labels (np.ndarray) – The segmentation labels. The shape should be (num_slices, height, width) or (height, width).

Returns

The processed segmentation labels.

Return type

np.ndarray

class atommic.collections.segmentation.data.mri_segmentation_loader.BraTS2023AdultGliomaSegmentationMRIDataset(*args: Any, **kwargs: Any)[source]#

Bases: Dataset

Supports the BraTS2023AdultGlioma dataset for MRI segmentation.

Note

Extends torch.utils.data.Dataset.

get_consecutive_slices(data: Dict, key: str, dataslice: int) numpy.ndarray[source]#

Get consecutive slices from a given data dictionary.

Parameters
  • data (dict) – Data to extract slices from.

  • key (str) – Key to extract slices from.

  • dataslice (int) – Slice to index.

Returns

Array of consecutive slices. If self.consecutive_slices is > 1, then the array will have shape (self.consecutive_slices, *data[key].shape[1:]). Otherwise, the array will have shape data[key].shape[1:].

Return type

np.ndarray

Examples

>>> data = {"kspace": np.random.rand(10, 640, 368)}
>>> from atommic.collections.common.data.mri_loader import MRIDataset
>>> MRIDataset.get_consecutive_slices(data, "kspace", 1).shape
(1, 640, 368)
>>> MRIDataset.get_consecutive_slices(data, "kspace", 5).shape
(5, 640, 368)
class atommic.collections.segmentation.data.mri_segmentation_loader.ISLES2022SubAcuteStrokeSegmentationMRIDataset(*args: Any, **kwargs: Any)[source]#

Bases: SegmentationMRIDataset

Supports the ISLES2022SubAcuteStroke dataset for MRI segmentation.

class atommic.collections.segmentation.data.mri_segmentation_loader.SKMTEASegmentationMRIDataset(*args: Any, **kwargs: Any)[source]#

Bases: Dataset

Supports the SKM-TEA dataset for MRI segmentation.

Note

Extends torch.utils.data.Dataset.

get_consecutive_slices(data: Dict, key: str, dataslice: int) numpy.ndarray[source]#

Override the get_consecutive_slices method to handle the SKM-TEA dataset.