Common MRI Transforms#

class atommic.collections.common.parts.transforms.Composer(transforms: Optional[Union[List[Callable], Callable]])[source]#

Bases: object

Composes multiple transforms together.

Returns

composed_data – Composed data.

Return type

torch.Tensor

Example

>>> import torch
>>> from atommic.collections.common.parts.transforms import Composer, Masker, Normalizer
>>> data = torch.randn(1, 32, 320, 320, 2)  1j * torch.randn(1, 32, 320, 320, 2)
>>> print(torch.min(torch.abs(data)), torch.max(torch.abs(data)))
tensor(1e-06) tensor(1.4142)
>>> masker = Masker(mask_func="random", padding="reflection", seed=0)
>>> normalizer = Normalizer(normalization_type="max")
>>> composer = Composer([masker, normalizer])
>>> composed_data = composer(data)
>>> print(torch.min(torch.abs(composed_data)), torch.max(torch.abs(composed_data)))
tensor(0.) tensor(1.)
__init__(transforms: Optional[Union[List[Callable], Callable]])[source]#

Inits Composer.

Parameters

transforms (list) – List of transforms to compose.

class atommic.collections.common.parts.transforms.Cropper(cropping_size: Tuple, fft_centered: bool = False, fft_normalization: str = 'backward', spatial_dims: Sequence[int] = (-2, -1))[source]#

Bases: object

Crops data to a given size.

Returns

cropped_data – Cropped data.

Return type

torch.Tensor

Example

>>> import torch
>>> from atommic.collections.common.parts.transforms import Cropper
>>> data = torch.randn(1, 15, 320, 320, 2)
>>> cropping = Cropper(cropping_size=(256, 256), spatial_dims=(-2, -1)) # don't account for complex dim
>>> cropped_data = cropping(data)
>>> cropped_data.shape
[1, 15, 256, 256, 2]
__init__(cropping_size: Tuple, fft_centered: bool = False, fft_normalization: str = 'backward', spatial_dims: Sequence[int] = (-2, -1))[source]#

Inits Cropper.

Parameters
  • cropping_size (tuple) – Size of the cropped data.

  • fft_centered (bool) – If True, the input is assumed to be centered in the frequency domain. Default is False.

  • fft_normalization (str) – Normalization of the FFT. Default is backward.

  • spatial_dims (tuple) – Spatial dimensions.

forward(data: torch.Tensor, apply_backward_transform: bool = False, apply_forward_transform: bool = False) torch.Tensor[source]#

Forward pass of Cropper.

Parameters
  • data (torch.Tensor) – Input data to crop.

  • apply_backward_transform (bool) – Apply backward transform, i.e. Inverse Fast Fourier Transform. Default is False.

  • apply_forward_transform (bool) – Apply forward transform, i.e. Fast Fourier Transform. Default is False.

class atommic.collections.common.parts.transforms.EstimateCoilSensitivityMaps(coil_sensitivity_maps_type: str = 'espirit', gaussian_sigma: Optional[float] = None, espirit_threshold: float = 0.05, espirit_kernel_size: int = 6, espirit_crop: float = 0.95, espirit_max_iters: int = 30, fft_centered: bool = False, fft_normalization: str = 'backward', spatial_dims: Sequence[int] = (-2, -1), coil_dim: int = 1)[source]#

Bases: object

Data Transformer for training MRI reconstruction models.

Estimates sensitivity maps given masked k-space data using one of three methods:

  • Unit: unit sensitivity map in case of single coil acquisition.

  • RSS-estimate: sensitivity maps estimated by using the root-sum-of-squares of the autocalibration-signal.

  • ESPIRIT: sensitivity maps estimated with the ESPIRIT method [Uecker2014].

References

Uecker2014

Uecker M, Lai P, Murphy MJ, Virtue P, Elad M, Pauly JM, Vasanawala SS, Lustig M. ESPIRiT–an eigenvalue approach to autocalibrating parallel MRI: where SENSE meets GRAPPA. Magn Reson Med. 2014 Mar;71(3):990-1001. doi: 10.1002/mrm.24751. PMID: 23649942; PMCID: PMC4142121.

__init__(coil_sensitivity_maps_type: str = 'espirit', gaussian_sigma: Optional[float] = None, espirit_threshold: float = 0.05, espirit_kernel_size: int = 6, espirit_crop: float = 0.95, espirit_max_iters: int = 30, fft_centered: bool = False, fft_normalization: str = 'backward', spatial_dims: Sequence[int] = (-2, -1), coil_dim: int = 1) None[source]#

Inits EstimateSensitivityMapModule.

Parameters
  • type (str) – Type of sensitivity map to estimate. One of “unit”, “rss”, “espirit”. Default is "espirit".

  • gaussian_sigma (float, optional) – If non-zero, acs_image well be calculated

  • espirit_threshold (float) – Threshold for the calibration matrix when `type`==”espirit”. Default: 0.05.

  • espirit_kernel_size (int) – Kernel size for the calibration matrix when `type`==”espirit”. Default: 6.

  • espirit_crop (float) – Output eigenvalue cropping threshold when `type`==”espirit”. Default: 0.95.

  • espirit_max_iters (int) – Power method iterations when `type`==”espirit”. Default: 30.

  • fft_centered (bool) – Whether to center the FFT. Default is False.

  • fft_normalization (str) – Normalization to apply to the FFT. Default is "backward".

  • spatial_dims (Sequence[int]) – Spatial dimensions of the input. Default is (-2, -1).

  • coil_dim (int) – Dimension corresponding to coil. Default: 1.

calculate_acs_mask(kspace: torch.Tensor) torch.Tensor[source]#

Calculates the autocalibration (ACS) mask.

Parameters

kspace (torch.Tensor) – K-space.

Returns

acs_mask – Autocalibration mask.

Return type

torch.Tensor

estimate_acs_image(acs_mask: torch.Tensor, kspace: torch.Tensor, width_dim: int = -2) torch.Tensor[source]#

Estimates the autocalibration (ACS) image by sampling the k-space using the ACS mask.

Parameters
  • acs_mask (torch.Tensor) – Autocalibration mask.

  • kspace (torch.Tensor) – K-space.

  • width_dim (int) – Dimension corresponding to width. Default: -2.

Returns

acs_image – Estimate of the ACS image.

Return type

torch.Tensor

forward(kspace: torch.Tensor) torch.Tensor[source]#

Forward pass of EstimateCoilSensitivityMaps.

class atommic.collections.common.parts.transforms.GeometricDecompositionCoilCompression(virtual_coils: Optional[int] = None, calib_lines: Optional[int] = None, align_data: bool = True, fft_centered: bool = False, fft_normalization: str = 'backward', spatial_dims: Sequence[int] = (-2, -1))[source]#

Bases: object

Geometric Decomposition Coil Compression in PyTorch, as presented in [Zhang2013].

References

Zhang2013

Zhang, T., Pauly, J. M., Vasanawala, S. S., & Lustig, M. (2013). Coil compression for accelerated imaging with Cartesian sampling. Magnetic Resonance in Medicine, 69(2), 571–582. https://doi.org/10.1002/mrm.24267

Returns

Coil compressed data.

Return type

torch.Tensor

Examples

>>> import torch
>>> from atommic.collections.common.parts.transforms import GeometricDecompositionCoilCompression
>>> data = torch.randn([30, 100, 100], dtype=torch.complex64)
>>> gdcc = GeometricDecompositionCoilCompression(virtual_coils=10, calib_lines=24, spatial_dims=[-2, -1])
>>> gdcc(data).shape
torch.Size([10, 100, 100, 2])
__init__(virtual_coils: Optional[int] = None, calib_lines: Optional[int] = None, align_data: bool = True, fft_centered: bool = False, fft_normalization: str = 'backward', spatial_dims: Sequence[int] = (-2, -1))[source]#

Inits GeometricDecompositionCoilCompression.

Parameters
  • virtual_coils (int) – Number of final-“virtual” coils.

  • calib_lines (int) – Calibration lines to sample data points.

  • align_data (bool) – Align data to the first calibration line. Default is True.

  • fft_centered (bool) – Whether to center the fft. Default is False.

  • fft_normalization (str) – FFT normalization. Default is "backward".

  • spatial_dims (Sequence[int]) – Dimensions to apply the FFT. Default is None.

align_compressed_coils()[source]#

Virtual Coil Alignment.

calculate_gcc()[source]#

Calculates Geometric Coil-Compression.

crop()[source]#

Crop to the size of the calibration lines.

forward(data: torch.Tensor, apply_backward_transform: bool = False, apply_forward_transform: bool = False) torch.Tensor[source]#

Forward pass of GeometricDecompositionCoilCompression.

Parameters
  • data (torch.Tensor) – Input data to apply coil compression.

  • apply_backward_transform (bool) – Apply backward transform. Default is False.

  • apply_forward_transform (bool) – Apply forward transform. Default is False.

Returns

Coil compressed data.

Return type

torch.Tensor

rotate_and_compress(data_to_cc)[source]#

Uses compression matrices to project the data onto them -> rotate to the compressed space.

class atommic.collections.common.parts.transforms.N2R(probability: float = 0.0, std_devs: Tuple[float, float] = (0.0, 0.0), rhos: Tuple[float, float] = (0.0, 0.0), use_mask: bool = True)[source]#

Bases: object

Generates Noise to Reconstruction (N2R) sampling masks, as presented in [Desai2022].

References

Desai2022

AD Desai, BM Ozturkler, CM Sandino, et al. Noise2Recon: Enabling Joint MRI Reconstruction and Denoising with Semi-Supervised and Self-Supervised Learning. ArXiv 2022. https://arxiv.org/abs/2110.00075

Returns

sampling_mask_noise – Sampling mask with noise. The shape should be (1, nx, ny, 1).

Return type

torch.Tensor

__init__(probability: float = 0.0, std_devs: Tuple[float, float] = (0.0, 0.0), rhos: Tuple[float, float] = (0.0, 0.0), use_mask: bool = True)[source]#

Inits N2R.

Parameters
  • probability (float, optional) – Probability of sampling. Default is 0.0.

  • std_devs (Tuple[float, float], optional) – Standard deviations of the Gaussian noise. Default is (0.0, 0.0).

  • rhos (Tuple[float, float], optional) – Rho values for the Gaussian noise. Default is (0.0, 0.0).

  • use_mask (bool, optional) – Whether to use the mask. Default is True.

forward(mask: torch.Tensor) torch.Tensor[source]#

Forward pass of N2R.

Parameters

mask (torch.Tensor) – Input mask. The shape should be (nx, ny).

Returns

sampling_mask_noise – Sampling mask with noise. The shape should be (1, nx, ny, 1).

Return type

torch.Tensor

class atommic.collections.common.parts.transforms.NoisePreWhitening(find_patch_size: bool = True, patch_size: Optional[List[int]] = None, scale_factor: float = 1.0, fft_centered: bool = False, fft_normalization: str = 'backward', spatial_dims: Sequence[int] = (-2, -1))[source]#

Bases: object

Applies noise pre-whitening / coil decorrelation.

Examples

>>> import torch
>>> from atommic.collections.common.parts.transforms import NoisePreWhitening
>>> data = torch.randn([30, 100, 100], dtype=torch.complex64)
>>> data = torch.view_as_real(data)
>>> data.mean()
tensor(-0.0011)
>>> noise_prewhitening = NoisePreWhitening(find_patch_size=True, scale_factor=1.0)
>>> noise_prewhitening(data).mean()
tensor(-0.0023)
__init__(find_patch_size: bool = True, patch_size: Optional[List[int]] = None, scale_factor: float = 1.0, fft_centered: bool = False, fft_normalization: str = 'backward', spatial_dims: Sequence[int] = (-2, -1))[source]#

Inits NoisePreWhitening.

Parameters
  • find_patch_size (bool) – Find optimal patch size (automatically) to calculate psi. If False, patch_size must be defined. Default is True.

  • patch_size (list of ints) – Define patch size to calculate psi, [x_start, x_end, y_start, y_end].

  • scale_factor (float) – Applied on the noise covariance matrix. Used to adjust for effective noise bandwidth and difference in sampling rate between noise calibration and actual measurement. scale_factor = (T_acq_dwell/T_noise_dwell)*NoiseReceiverBandwidthRatio Default is 1.0.

  • fft_centered (bool) – If True, the zero-frequency component is located at the center of the spectrum. Default is False.

  • fft_normalization (str) – Normalization mode. Options are "backward", "ortho", "forward". Default is "backward".

  • spatial_dims (sequence of ints) – Spatial dimensions of the input data.

static find_optimal_patch_size(data: torch.Tensor, min_noise: float = 10000000000.0) List[int][source]#

Find optimal patch size for noise pre-whitening.

Parameters
  • data (torch.Tensor) – Input data to find optimal patch size.

  • min_noise (float) – Minimum noise value. It is inversely proportional to the noise level. Default is 1e10.

Returns

Optimal patch size, [x_start, x_end, y_start, y_end].

Return type

List[int]

forward(data: torch.Tensor, apply_backward_transform: bool = False, apply_forward_transform: bool = False) torch.Tensor[source]#

Forward pass of NoisePreWhitening.

Parameters
  • data (torch.Tensor) – Input data to apply noise pre-whitening.

  • apply_backward_transform (bool) – Apply backward transform before noise pre-whitening.

  • apply_forward_transform (bool) – Apply forward transform before noise pre-whitening.

Returns

Noise pre-whitened data.

Return type

torch.Tensor

class atommic.collections.common.parts.transforms.Normalizer(normalization_type: Optional[str] = None, kspace_normalization: bool = False, fft_centered: bool = False, fft_normalization: str = 'backward', spatial_dims: Sequence[int] = (-2, -1))[source]#

Bases: object

Normalizes data given a normalization type.

Returns

normalized_data – Normalized data to range according to the normalization type.

Return type

torch.Tensor

Example

>>> import torch
>>> from atommic.collections.common.parts.transforms import Normalizer
>>> data = torch.randn(1, 32, 320, 320, 2)  1j * torch.randn(1, 32, 320, 320, 2)
>>> print(torch.min(torch.abs(data)), torch.max(torch.abs(data)))
tensor(1e-06) tensor(1.4142)
>>> normalizer = Normalizer(normalization_type="max")
>>> normalized_data = normalizer(data)
>>> print(torch.min(torch.abs(data)), torch.max(torch.abs(data)))
tensor(0.) tensor(1.)
__init__(normalization_type: Optional[str] = None, kspace_normalization: bool = False, fft_centered: bool = False, fft_normalization: str = 'backward', spatial_dims: Sequence[int] = (-2, -1))[source]#

Inits Normalizer.

Parameters
  • normalization_type (str, optional) – Normalization type. It can be one of the following: - “max”: normalize data by its maximum value. - “mean”: normalize data by its mean value. - “minmax”: normalize data by its minimum and maximum values. - None: do not normalize data. It can be useful to verify FFT normalization. Default is None.

  • kspace_normalization (str, optional) – Normalize in k-space.

  • fft_centered (bool, optional) – If True, the FFT will be centered. Default is False. Should be set for complex data normalization.

  • fft_normalization (str, optional) – FFT normalization type. It can be one of the following: - “backward”: normalize the FFT by the number of elements in the input. - “ortho”: normalize the FFT by the number of elements in the input and the square root of the product of the sizes of the input dimensions. - “forward”: normalize the FFT by the square root of the number of elements in the input. Default is “backward”.

  • spatial_dims (tuple, optional) – Spatial dimensions. Default is (-2, -1).

forward(data: torch.Tensor, apply_backward_transform: bool = False, apply_forward_transform: bool = False) Tuple[torch.Tensor, Dict][source]#

Forward pass of Normalizer.

Parameters
  • data (torch.Tensor) – Input data.

  • apply_backward_transform (bool, optional) – If True, apply backward transform. Default is False.

  • apply_forward_transform (bool, optional) – If True, apply forward transform. Default is False.

Returns

  • data (torch.Tensor) – Normalized data.

  • attrs (dict) – Normalization attributes.

class atommic.collections.common.parts.transforms.SNREstimator(patch_size: List[int], apply_ifft: bool = True, fft_centered: bool = False, fft_normalization: str = 'backward', spatial_dims: Sequence[int] = (-2, -1), coil_dim: int = 1, multicoil: bool = True)[source]#

Bases: object

Estimates Signal-to-Noise Ratio.

Returns

snr – Estimated SNR.

Return type

float

Example

>>> import torch
>>> from atommic.collections.common.parts.transforms import SNREstimator
>>> data = torch.randn(1, 32, 320, 320, 2)  1j * torch.randn(1, 32, 320, 320, 2)
>>> print(torch.min(torch.abs(data)), torch.max(torch.abs(data)))
tensor(1e-06) tensor(1.4142)
>>> snr_estimator = SNREstimator()
>>> snr_estimator(data)
3.2
__init__(patch_size: List[int], apply_ifft: bool = True, fft_centered: bool = False, fft_normalization: str = 'backward', spatial_dims: Sequence[int] = (-2, -1), coil_dim: int = 1, multicoil: bool = True)[source]#

Inits SNREstimator.

Parameters
  • patch_size (list of ints) – Define patch size to calculate noise. x_start, x_end, y_start, y_end

  • apply_ifft (bool) – If data in k-space go to imspace

  • fft_centered (bool) – If True, apply centered FFT

  • fft_normalization (str) – Type of FFT normalization

  • spatial_dims (tuple of ints) – Spatial dimensions

  • coil_dim (int) – Coil dimension

  • multicoil (bool) – If True, multicoil data. Else single coil data.

class atommic.collections.common.parts.transforms.SSDU(mask_type: str = 'Gaussian', rho: float = 0.4, acs_block_size: Sequence[int] = (4, 4), gaussian_std_scaling_factor: float = 4.0, outer_kspace_fraction: float = 0.0, export_and_reuse_masks: bool = False)[source]#

Bases: object

Generates Self-Supervised Data Undersampling (SSDU) masks, as presented in [Yaman2020].

References

Yaman2020

Yaman, B, Hosseini, SAH, Moeller, S, Ellermann, J, Uğurbil, K, Akçakaya, M. Self-supervised learning of physics-guided reconstruction neural networks without fully sampled reference data. Magn Reson Med. 2020; 84: 3172–3191. https://doi.org/10.1002/mrm.28378

Returns

  • loss_mask (torch.Tensor) – Loss mask.

  • training_mask (torch.Tensor) – Training mask.

__init__(mask_type: str = 'Gaussian', rho: float = 0.4, acs_block_size: Sequence[int] = (4, 4), gaussian_std_scaling_factor: float = 4.0, outer_kspace_fraction: float = 0.0, export_and_reuse_masks: bool = False)[source]#

Inits SSDU.

Parameters
  • mask_type (str, optional) – Mask type. It can be one of the following: - “Gaussian”: Gaussian sampling. - “Uniform”: Uniform sampling. Default is “Gaussian”.

  • rho (float, optional) – Split ratio for training and loss masks. Default is 0.4.

  • acs_block_size (Sequence[int], optional) – Keeps a small acs region fully-sampled for training masks, if there is no acs region. The small acs block should be set to zero. Default is (4, 4).

  • gaussian_std_scaling_factor (float, optional) – Scaling factor for standard deviation of the Gaussian noise. If Uniform is select this factor is ignored. Default is 4.0.

  • outer_kspace_fraction (float, optional) – Fraction of the outer k-space region to be kept/unmasked. Default is 0.0.

  • export_and_reuse_masks (bool, optional) – If True, the generated masks are exported to the tmp directory and reused in the next call. This option is useful when the data is too large to be stored in memory. Default is False.

forward(mask: torch.Tensor, fname: str) Tuple[torch.Tensor, torch.Tensor][source]#

Forward pass of SSDU.

Parameters
  • mask (torch.Tensor) – Mask tensor.

  • fname (str) – File name to save the generated masks.

Returns

  • train_mask (torch.Tensor) – Training mask.

  • loss_mask (torch.Tensor) – Loss mask.

class atommic.collections.common.parts.transforms.ZeroFillingPadding(zero_filling_size: Tuple, fft_centered: bool = False, fft_normalization: str = 'backward', spatial_dims: Sequence[int] = (-2, -1))[source]#

Bases: object

Zero-Filling padding in k-space -> changes the Field-of-View (FoV) in image space.

Returns

  • zero_filled_data (torch.Tensor) – Zero filled data.

  • spatial_dims (tuple) – Spatial dimensions.

Example

>>> import torch
>>> from atommic.collections.common.parts.transforms import ZeroFillingPadding
>>> data = torch.randn(1, 15, 320, 320, 2)
>>> zero_filling = ZeroFillingPadding(zero_filling_size=(400, 400), spatial_dims=(-2, -1))
>>> zero_filled_data = zero_filling(data)
>>> zero_filled_data.shape
[1, 15, 400, 400, 2]
__init__(zero_filling_size: Tuple, fft_centered: bool = False, fft_normalization: str = 'backward', spatial_dims: Sequence[int] = (-2, -1))[source]#

Inits ZeroFillingPadding.

Parameters
  • zero_filling_size (tuple) – Size of the zero filled data.

  • fft_centered (bool, optional) – If True, the FFT will be centered. Default is False. Should be set for complex data normalization.

  • fft_normalization (str, optional) – FFT normalization type. It can be one of the following:

  • spatial_dims (tuple, optional) – Spatial dimensions. Default is (-2, -1).

forward(data: torch.Tensor, apply_backward_transform: bool = False, apply_forward_transform: bool = False) torch.Tensor[source]#

Forward pass of ZeroFillingPadding.

Parameters
  • data (torch.Tensor) – Input data to crop.

  • apply_backward_transform (bool) – Apply backward transform, i.e. Inverse Fast Fourier Transform. Default is False.

  • apply_forward_transform (bool) – Apply forward transform, i.e. Fast Fourier Transform. Default is False.

class atommic.collections.common.parts.transforms.MRIDataTransforms(dataset_format: Optional[str] = None, apply_prewhitening: bool = False, find_patch_size: bool = True, prewhitening_scale_factor: float = 1.0, prewhitening_patch_start: int = 10, prewhitening_patch_length: int = 30, apply_gcc: bool = False, gcc_virtual_coils: int = 10, gcc_calib_lines: int = 24, gcc_align_data: bool = True, apply_random_motion: bool = False, random_motion_type: str = 'gaussian', random_motion_percentage: Sequence[int] = (10, 20), random_motion_angle: int = 10, random_motion_translation: int = 10, random_motion_center_percentage: float = 0.02, random_motion_num_segments: int = 8, random_motion_random_num_segments: bool = True, random_motion_non_uniform: bool = False, estimate_coil_sensitivity_maps: bool = False, coil_sensitivity_maps_type: str = 'ESPIRiT', coil_sensitivity_maps_gaussian_sigma: float = 0.0, coil_sensitivity_maps_espirit_threshold: float = 0.05, coil_sensitivity_maps_espirit_kernel_size: int = 6, coil_sensitivity_maps_espirit_crop: float = 0.95, coil_sensitivity_maps_espirit_max_iters: int = 30, coil_combination_method: str = 'SENSE', dimensionality: int = 2, mask_func: Optional[Callable] = None, shift_mask: bool = False, mask_center_scale: float = 0.02, partial_fourier_percentage: float = 0.0, remask: bool = False, ssdu: bool = False, ssdu_mask_type: str = 'Gaussian', ssdu_rho: float = 0.4, ssdu_acs_block_size: Sequence[int] = (4, 4), ssdu_gaussian_std_scaling_factor: float = 4.0, ssdu_outer_kspace_fraction: float = 0.0, ssdu_export_and_reuse_masks: bool = False, n2r: bool = False, n2r_supervised_rate: float = 0.0, n2r_probability: float = 0.0, n2r_std_devs: Optional[Tuple[float, float]] = None, n2r_rhos: Optional[Tuple[float, float]] = None, n2r_use_mask: bool = False, unsupervised_masked_target: bool = False, crop_size: Optional[Tuple[int, int]] = None, kspace_crop: bool = False, crop_before_masking: bool = True, kspace_zero_filling_size: Optional[Tuple] = None, normalize_inputs: bool = True, normalization_type: str = 'max', kspace_normalization: bool = False, fft_centered: bool = False, fft_normalization: str = 'backward', spatial_dims: Optional[Sequence[int]] = None, coil_dim: int = 0, consecutive_slices: int = 1, use_seed: bool = True)[source]#

Bases: object

Generic class to apply transforms for MRI data.

__init__(dataset_format: Optional[str] = None, apply_prewhitening: bool = False, find_patch_size: bool = True, prewhitening_scale_factor: float = 1.0, prewhitening_patch_start: int = 10, prewhitening_patch_length: int = 30, apply_gcc: bool = False, gcc_virtual_coils: int = 10, gcc_calib_lines: int = 24, gcc_align_data: bool = True, apply_random_motion: bool = False, random_motion_type: str = 'gaussian', random_motion_percentage: Sequence[int] = (10, 20), random_motion_angle: int = 10, random_motion_translation: int = 10, random_motion_center_percentage: float = 0.02, random_motion_num_segments: int = 8, random_motion_random_num_segments: bool = True, random_motion_non_uniform: bool = False, estimate_coil_sensitivity_maps: bool = False, coil_sensitivity_maps_type: str = 'ESPIRiT', coil_sensitivity_maps_gaussian_sigma: float = 0.0, coil_sensitivity_maps_espirit_threshold: float = 0.05, coil_sensitivity_maps_espirit_kernel_size: int = 6, coil_sensitivity_maps_espirit_crop: float = 0.95, coil_sensitivity_maps_espirit_max_iters: int = 30, coil_combination_method: str = 'SENSE', dimensionality: int = 2, mask_func: Optional[Callable] = None, shift_mask: bool = False, mask_center_scale: float = 0.02, partial_fourier_percentage: float = 0.0, remask: bool = False, ssdu: bool = False, ssdu_mask_type: str = 'Gaussian', ssdu_rho: float = 0.4, ssdu_acs_block_size: Sequence[int] = (4, 4), ssdu_gaussian_std_scaling_factor: float = 4.0, ssdu_outer_kspace_fraction: float = 0.0, ssdu_export_and_reuse_masks: bool = False, n2r: bool = False, n2r_supervised_rate: float = 0.0, n2r_probability: float = 0.0, n2r_std_devs: Optional[Tuple[float, float]] = None, n2r_rhos: Optional[Tuple[float, float]] = None, n2r_use_mask: bool = False, unsupervised_masked_target: bool = False, crop_size: Optional[Tuple[int, int]] = None, kspace_crop: bool = False, crop_before_masking: bool = True, kspace_zero_filling_size: Optional[Tuple] = None, normalize_inputs: bool = True, normalization_type: str = 'max', kspace_normalization: bool = False, fft_centered: bool = False, fft_normalization: str = 'backward', spatial_dims: Optional[Sequence[int]] = None, coil_dim: int = 0, consecutive_slices: int = 1, use_seed: bool = True)[source]#

Inits MRIDataTransforms.

Parameters
  • dataset_format (str, optional) – The format of the dataset. For example, 'custom_dataset' or 'public_dataset_name'. Default is None.

  • apply_prewhitening (bool, optional) – Apply prewhitening. If True then the prewhitening arguments are used. Default is False.

  • find_patch_size (bool, optional) – Find optimal patch size (automatically) to calculate psi. If False, patch_size must be defined. Default is True.

  • prewhitening_scale_factor (float, optional) – Prewhitening scale factor. Default is 1.0.

  • prewhitening_patch_start (int, optional) – Prewhitening patch start. Default is 10.

  • prewhitening_patch_length (int, optional) – Prewhitening patch length. Default is 30.

  • apply_gcc (bool, optional) – Apply Geometric Decomposition Coil Compression. If True then the GCC arguments are used. Default is False.

  • gcc_virtual_coils (int, optional) – GCC virtual coils. Default is 10.

  • gcc_calib_lines (int, optional) – GCC calibration lines. Default is 24.

  • gcc_align_data (bool, optional) – GCC align data. Default is True.

  • apply_random_motion (bool, optional) – Simulate random motion in k-space. Default is False.

  • random_motion_type (str, optional) – Random motion type. It can be one of the following: piecewise_transient, piecewise_constant, gaussian. Default is gaussian.

  • random_motion_percentage (Sequence[int], optional) – Random motion percentage. For example, 10%-20% motion can be defined as (10, 20). Default is (10, 10).

  • random_motion_angle (float, optional) – Random motion angle. Default is 10.0.

  • random_motion_translation (float, optional) – Random motion translation. Default is 10.0.

  • random_motion_center_percentage (float, optional) – Random motion center percentage. Default is 0.0.

  • random_motion_num_segments (int, optional) – Random motion number of segments to partition the k-space. Default is 8.

  • random_motion_random_num_segments (bool, optional) – Whether to randomly generate the number of segments. Default is True.

  • random_motion_non_uniform (bool, optional) – Random motion non-uniform sampling. Default is False.

  • estimate_coil_sensitivity_maps (bool, optional) – Automatically estimate coil sensitivity maps. Default is False. If True then the coil sensitivity maps arguments are used. Note that this is different from the estimate_coil_sensitivity_maps_with_nn argument, which uses a neural network to estimate the coil sensitivity maps. The estimate_coil_sensitivity_maps estimates the coil sensitivity maps with methods such as ESPIRiT, RSS or UNit. ESPIRiT is the Eigenvalue to Self-Consistent Parallel Imaging Reconstruction Technique method. RSS is the Root Sum of Squares method. UNit returns a uniform coil sensitivity map.

  • coil_sensitivity_maps_type (str, optional) – Coil sensitivity maps type. It can be one of the following: ESPIRiT, RSS or UNit. Default is ESPIRiT.

  • coil_sensitivity_maps_gaussian_sigma (float, optional) – Coil sensitivity maps Gaussian sigma. Default is 0.0.

  • coil_sensitivity_maps_espirit_threshold (float, optional) – Coil sensitivity maps ESPRIT threshold. Default is 0.05.

  • coil_sensitivity_maps_espirit_kernel_size (int, optional) – Coil sensitivity maps ESPRIT kernel size. Default is 6.

  • coil_sensitivity_maps_espirit_crop (float, optional) – Coil sensitivity maps ESPRIT crop. Default is 0.95.

  • coil_sensitivity_maps_espirit_max_iters (int, optional) – Coil sensitivity maps ESPRIT max iterations. Default is 30.

  • coil_combination_method (str, optional) – Coil combination method. Default is "SENSE".

  • dimensionality (int, optional) – Dimensionality. Default is 2.

  • mask_func (Optional[Callable], optional) – Mask function to retrospectively undersample the k-space. Default is None.

  • shift_mask (bool, optional) – Whether to shift the mask. This needs to be set alongside with the fft_centered argument. Default is False.

  • mask_center_scale (Optional[float], optional) – Center scale of the mask. This defines how much densely sampled will be the center of k-space. Default is 0.02.

  • partial_fourier_percentage (float, optional) – Whether to simulate a half scan. Default is 0.0.

  • remask (bool, optional) – Use the same mask. Default is False.

  • ssdu (bool, optional) – Whether to apply Self-Supervised Data Undersampling (SSDU) masks. Default is False.

  • ssdu_mask_type (str, optional) – Mask type. It can be one of the following: - “Gaussian”: Gaussian sampling. - “Uniform”: Uniform sampling. Default is “Gaussian”.

  • ssdu_rho (float, optional) – Split ratio for training and loss masks. Default is 0.4.

  • ssdu_acs_block_size (tuple, optional) – Keeps a small acs region fully-sampled for training masks, if there is no acs region. The small acs block should be set to zero. Default is (4, 4).

  • ssdu_gaussian_std_scaling_factor (float, optional) – Scaling factor for standard deviation of the Gaussian noise. If Uniform is select this factor is ignored. Default is 4.0.

  • ssdu_outer_kspace_fraction (float, optional) – Fraction of the outer k-space to be kept/unmasked. Default is 0.0.

  • ssdu_export_and_reuse_masks (bool, optional) – Whether to export and reuse the masks. Default is False.

  • n2r (bool, optional) – Whether to apply Noise to Reconstruction (N2R) masks. Default is False.

  • n2r_supervised_rate (Optional[float], optional) – A float between 0 and 1. This controls what fraction of the subjects should be loaded for Noise to Reconstruction (N2R) supervised loss, if N2R is enabled. Default is 0.0.

  • n2r_probability (float, optional) – Probability of applying N2R. Default is 0.0.

  • n2r_std_devs (Optional[Tuple[float, float]], optional) – Standard deviations for the noise. Default is (0.0, 0.0).

  • n2r_rhos (Optional[Tuple[float, float]], optional) – Rho values for the noise. Default is (0.0, 0.0).

  • n2r_use_mask (bool, optional) – Whether to use a mask for N2R. Default is False.

  • unsupervised_masked_target (bool, optional) – Whether to use the masked initial estimation for unsupervised learning. Default is False.

  • crop_size (Optional[Tuple[int, int]], optional) – Center crop size. It applies cropping in image space. Default is None.

  • kspace_crop (bool, optional) – Whether to crop in k-space. Default is False.

  • crop_before_masking (bool, optional) – Whether to crop before masking. Default is True.

  • kspace_zero_filling_size (Optional[Tuple], optional) – Whether to apply zero filling in k-space. Default is None.

  • normalize_inputs (bool, optional) – Whether to normalize the inputs. Default is True.

  • normalization_type (str, optional) – Normalization type. Can be max or mean or minmax. Default is max.

  • kspace_normalization (bool, optional) – Whether to normalize the k-space. Default is False.

  • fft_centered (bool, optional) – Whether to center the FFT. Default is False.

  • fft_normalization (str, optional) – FFT normalization. Default is "backward".

  • spatial_dims (Sequence[int], optional) – Spatial dimensions. Default is None.

  • coil_dim (int, optional) – Coil dimension. Default is 0, meaning that the coil dimension is the first dimension before applying batch.

  • consecutive_slices (int, optional) – Consecutive slices. Default is 1.

  • use_seed (bool, optional) – Whether to use seed. Default is True.