class_docstr: A basic class for under-sampling mask setup. It provides common
  features for under-sampling mask generators.
  For example, RandomMaskFunc and EquispacedMaskFunc (two mask
  transform objects defined right after this module)
  both inherit MaskFunc to properly setup properties like the
  acceleration factor.
docstr: Args:
      center_fractions: Fraction of low-frequency columns to be retained.
          If multiple values are provided, then one of these numbers
          is chosen uniformly each time.
      accelerations: Amount of under-sampling. This should have the
          same length as center_fractions. If multiple values are
          provided, then one of these is chosen uniformly each time.
      spatial_dims: Number of spatial dims (e.g., it's 2 for a 2D data;
          it's also 2 for pseudo-3D datasets like the fastMRI dataset).
          The last spatial dim is selected for sampling. For the fastMRI
          dataset, k-space has the form (...,num_slices,num_coils,H,W)
          and sampling is done along W. For a general 3D data with the
          shape (...,num_coils,H,W,D), sampling is done along D.
      is_complex: if True, then the last dimension will be reserved for
          real/imaginary parts.
docstr_tok: ["Args",":","center_fractions",":","Fraction","of","low-frequency","columns","to","be","retained",".","If","multiple","values","are","provided",",","then","one","of","these","numbers","is","chosen","uniformly","each","time",".","accelerations",":","Amount","of","under-sampling",".","This","should","have","the","same","length","as","center_fractions",".","If","multiple","values","are","provided",",","then","one","of","these","is","chosen","uniformly","each","time",".","spatial_dims",":","Number","of","spatial","dims","(","e.g.",",","it","'s","2","for","a","2D","data",";","it","'s","also","2","for","pseudo-3D","datasets","like","the","fastMRI","dataset",")",".","The","last","spatial","dim","is","selected","for","sampling",".","For","the","fastMRI","dataset",",","k-space","has","the","form","(","...",",","num_slices",",","num_coils",",","H",",","W",")","and","sampling","is","done","along","W.","For","a","general","3D","data","with","the","shape","(","...",",","num_coils",",","H",",","W",",","D",")",",","sampling","is","done","along","D.","is_complex",":","if","True",",","then","the","last","dimension","will","be","reserved","for","real\/imaginary","parts","."]
code: def __init__(
      self,
      center_fractions: Sequence[float],
      accelerations: Sequence[float],
      spatial_dims: int = 2,
      is_complex: bool = True,
  ):
      """
      Args:
          center_fractions: Fraction of low-frequency columns to be retained.
              If multiple values are provided, then one of these numbers
              is chosen uniformly each time.
          accelerations: Amount of under-sampling. This should have the
              same length as center_fractions. If multiple values are
              provided, then one of these is chosen uniformly each time.
          spatial_dims: Number of spatial dims (e.g., it's 2 for a 2D data;
              it's also 2 for pseudo-3D datasets like the fastMRI dataset).
              The last spatial dim is selected for sampling. For the fastMRI
              dataset, k-space has the form (...,num_slices,num_coils,H,W)
              and sampling is done along W. For a general 3D data with the
              shape (...,num_coils,H,W,D), sampling is done along D.
          is_complex: if True, then the last dimension will be reserved for
              real/imaginary parts.
      """
      if len(center_fractions) != len(accelerations):
          raise ValueError(
              "Number of center fractions \
                  should match number of accelerations"
          )
  
      self.center_fractions = center_fractions
      self.accelerations = accelerations
      self.spatial_dims = spatial_dims
      self.is_complex = is_complex
  
imports: from __future__ import annotations
  from abc import abstractmethod
  from collections.abc import Sequence
  import numpy
  from torch import Tensor
  from monai.apps.reconstruction.complex_utils import complex_abs, convert_to_tensor_complex
  from monai.apps.reconstruction.mri_utils import root_sum_of_squares
  from monai.config.type_definitions import NdarrayOrTensor
  from monai.data.fft_utils import ifftn_centered
  from monai.transforms.transform import RandomizableTransform
  from monai.utils.enums import TransformBackends
  from monai.utils.type_conversion import convert_to_tensor
label_desc: Use image node_id 1 to create a new KspaceMask object from inherited base classes: RandomizableTransform with example: obj = KspaceMask(center_fractions, accelerations, spatial_dims, is_complex)