mr2.data.traj_calculators.KTrajectoryCartesian
- class mr2.data.traj_calculators.KTrajectoryCartesian[source]
Bases:
KTrajectoryCalculatorCartesian trajectory.
- __init__()
- classmethod fullysampled(encoding_matrix: SpatialDimension[int]) KTrajectory[source]
Generate fully sampled Cartesian trajectory.
- Parameters:
encoding_matrix (
SpatialDimension[int]) – Encoded K-space size.- Returns:
Cartesian trajectory.
- classmethod gaussian_variable_density(encoding_matrix: SpatialDimension[int] | int, acceleration: float = 2.0, n_center: int = 10, fwhm_ratio: float = 1.0, n_other: Sequence[int] = (1,), seed: int | None = None) KTrajectory[source]
Generate k-space Gaussian weighted variable density sampling.
- Parameters:
encoding_matrix (
Union[SpatialDimension[int],int]) – Encoded K-space size, must haveencoding_matrix.z=1. If a single integer, a square k-space is considered.acceleration (
float, default:2.0) – Acceleration factor (undersampling rate).n_center (
int, default:10) – Number of fully-sampled center lines to always include.fwhm_ratio (
float, default:1.0) – Full-width at half-maximum of the Gaussian relative to encoding_matrix.y. Larger values approach uniform sampling. Set to infinity for uniform sampling.n_other (
Sequence[int], default:(1,)) – Batch size(s). The trajectory is different for each batch sample.seed (
int|None, default:None) – Random seed for reproducibility.
- Returns:
Cartesian trajectory.
- Raises:
ValueError – If
n_centerexceeds the total number of lines to keep given the acceleration.NotImplementedError – If called with a 3D encoding matrix.
- classmethod uniform_undersampling(encoding_matrix: SpatialDimension[int] | int, acceleration: float = 2.0, n_center: int = 10) KTrajectory[source]
Generate deterministic uniformly undersampled Cartesian sampling.
Every
acceleration-th line in k1 is sampled, and center k-space lines are always sampled vian_center.- Parameters:
encoding_matrix (
Union[SpatialDimension[int],int]) – Encoded K-space size, must haveencoding_matrix.z=1. If a single integer, a square k-space is considered.acceleration (
float, default:2.0) – Uniform undersampling factor. Must be an integer value >= 1. For example,acceleration=4samples every 4th line.n_center (
int, default:10) –Number of fully-sampled center lines to always include.
Note: if
n_center > 0, the effective acceleration is lower thanaccelerationbecause ACS lines are added on top of regular samples.
- Returns:
Cartesian trajectory.
- Raises:
ValueError – If acceleration is invalid or
n_centeris outside[0, n_k1].NotImplementedError – If called with a 3D encoding matrix.
- __call__(*, n_k0: int, k0_center: int | Tensor, k1_idx: Tensor, k1_center: int | Tensor, k2_idx: Tensor, k2_center: int | Tensor, reversed_readout_mask: Tensor | None = None, **_) KTrajectory[source]
Calculate Cartesian trajectory for given KHeader.
- static gaussian_variable_density_nd(encoding_matrix: SpatialDimension[int], acceleration: SpatialDimension[float], n_center: SpatialDimension[int] | int = 10, fwhm_ratio: SpatialDimension[float] | float = 1.0, n_other: Sequence[int] = (1,), seed: int | None = None) KTrajectory[source]
Generate Gaussian weighted variable density Cartesian undersampling.
Undersampling is applied independently in each dimension where
acceleration > 1.- Parameters:
encoding_matrix (
SpatialDimension[int]) – Encoded K-space size.acceleration (
SpatialDimension[float]) – Per-axis acceleration factors. Dimensions withacceleration <= 1are fully sampled.n_center (
Union[SpatialDimension[int],int], default:10) – Number of fully-sampled center lines to always include per axis. If given as an integer, the same value is used for all axes.fwhm_ratio (
Union[SpatialDimension[float],float], default:1.0) – Per-axis full-width at half-maximum of the Gaussian relative to the encoded matrix size. Larger values approach uniform sampling. If given as a scalar, the same value is used for all axes.n_other (
Sequence[int], default:(1,)) – Batch size(s). The trajectory is different for each batch sample.seed (
int|None, default:None) – Random seed for reproducibility.
- Returns:
Cartesian trajectory.
- Raises:
ValueError – If any acceleration is non-positive, if any
n_centeris outside the corresponding encoding range, or if a requested center region exceeds the number of retained samples along an undersampled axis.
- __eq__(value, /)
Return self==value.
- __new__(**kwargs)