mrpro.phantoms.brainweb.BrainwebSlices
- class mrpro.phantoms.brainweb.BrainwebSlices[source]
Bases:
Dataset
Dataset of 2D qMRI parameter slices based on Brainweb dataset.
Dataset of agmented 2D qMRI parameter slices based on the segmentations of the Brainweb dataset [AubertBroche2006].
References
[AubertBroche2006]Aubert-Broche, B., Griffin, M., Pike, G.B., Evans, A.C., & Collins, D.L. (2006). Twenty New Digital Brain Phantoms for Creation of Validation Image Data Bases. IEEE Transactions on Medical Imaging, 25 (11), 1410-1416. https://doi.org/10.1109/TMI.2006.883453
- __init__(folder: str | Path = CACHE_DIR, what: Sequence[Literal['r1', 'r2', 'm0', 't1', 't2', 'mask', 'tissueclass', 'skl', 'gry', 'wht', 'csf', 'mrw', 'dura', 'fat', 'fat2', 'mus', 'm-s', 'ves']] = ('m0', 'r1', 'r2'), parameters: Mapping[Literal['skl', 'gry', 'wht', 'csf', 'mrw', 'dura', 'fat', 'fat2', 'mus', 'm-s', 'ves'], BrainwebTissue] = VALUES_3T_RANDOMIZED, orientation: Literal['axial', 'coronal', 'sagittal'] = 'axial', skip_slices: tuple[tuple[int, int], tuple[int, int], tuple[int, int]] = ((80, 80), (100, 100), (100, 100)), step: int = 1, slice_preparation: Callable[[Tensor, Generator | None], Tensor] = DEFAULT_AUGMENT_256, mask_values: Mapping[str, float | None] = DEFAULT_VALUES, seed: int | Literal['index', 'random'] = 'random') None [source]
Initialize Brainweb qMRI slice phantom.
- Parameters:
folder (
str
|Path
, default:CACHE_DIR
) – Folder with Brainweb data as HDF5 files.what (
Sequence
[Union
[Literal
['r1'
,'r2'
,'m0'
,'t1'
,'t2'
,'mask'
,'tissueclass'
],Literal
['skl'
,'gry'
,'wht'
,'csf'
,'mrw'
,'dura'
,'fat'
,'fat2'
,'mus'
,'m-s'
,'ves'
]]], default:('m0', 'r1', 'r2')
) –What to return for each slice. Possible values are:
r1: R1 relaxation rate.
r2: R2 relaxation rate.
m0: M0 magnetization.
t1: T1 relaxation time.
t2: T2 relaxation time.
mask: mask indicating valid data.
tissueclass: class index.
parameters (
Mapping
[Literal
['skl'
,'gry'
,'wht'
,'csf'
,'mrw'
,'dura'
,'fat'
,'fat2'
,'mus'
,'m-s'
,'ves'
],BrainwebTissue
], default:VALUES_3T_RANDOMIZED
) –Parameters for each tissue class. The Brainweb tissue classes are:
skl: skull
gry: gray matter
wht: white matter
csf: cerebrospinal fluid
mrw: bone marrow
dura: dura
fat: fat
fat2: fat and Tissue
mus: muscle
m-s: skin
ves: vessels
orientation (
Literal
['axial'
,'coronal'
,'sagittal'
], default:'axial'
) – Orientation of slices (axial, coronal, or sagittal).skip_slices (
tuple
[tuple
[int
,int
],tuple
[int
,int
],tuple
[int
,int
]], default:((80, 80), (100, 100), (100, 100))
) – Specifies how much many slices to skip from the beginning and end for each of axial, coronal, or sagittal orientation.step (
int
, default:1
) – Step size between slices, in voxel units (1 mm).slice_preparation (
Callable
[[Tensor
,Generator
|None
],Tensor
], default:DEFAULT_AUGMENT_256
) – Callable that performs slice augmentation and resizing, seeresize
oraugment
for examples. The default applies slight random rotation, shear, scaling, and flips, and scales to 256x256 images.mask_values (
Mapping
[str
,float
|None
], default:DEFAULT_VALUES
) – Default values to use for masked out regions.seed (
Union
[int
,Literal
['index'
,'random'
]], default:'random'
) – Random seed. Can be an int, the stringsindex
to use slice index as seed, orrandom
for random seed.
- static download(output_directory: str | PathLike = CACHE_DIR, workers: int = 4, progress: bool = False, compress: bool = False) None [source]
Download Brainweb data.
- Parameters:
output_directory (
str
|PathLike
, default:CACHE_DIR
) – Directory to save the data.workers (
int
, default:4
) – Number of parallel downloads.progress (
bool
, default:False
) – Show progress bar.compress (
bool
, default:False
) – Use compression for HDF5 files. Saves disk space but might slow down or speed up access, depending on the file system and access pattern.
- __eq__(value, /)
Return self==value.
- __new__(**kwargs)