snake.core.sampling.samplers

Contents

snake.core.sampling.samplers#

Samplers generate kspace trajectories.

Module Contents#

Classes#

NonCartesianAcquisitionSampler

Base class for non-cartesian acquisition samplers.

LoadTrajectorySampler

Load a trajectory from a file.

StackOfSpiralSampler

Spiral 2D Acquisition Handler to generate k-space data.

RotatedStackOfSpiralSampler

Spiral 2D Acquisition Handler to generate k-space data.

EPI3dAcquisitionSampler

Sampling pattern for EPI-3D.

EVI3dAcquisitionSampler

SAmpler for EVI acquisition.

Functions#

dir_cos

Compute the directional cosine of the vector from beg to end point.

API#

class snake.core.sampling.samplers.NonCartesianAcquisitionSampler[source]#

Bases: snake.core.sampling.base.BaseSampler

Base class for non-cartesian acquisition samplers.

Parameters:
  • constant (bool) – If True, the trajectory is constant.

  • obs_time_ms (int) – Time spent to acquire a single shot

  • in_out (bool) – If true, the trajectory is acquired with a double join pattern from/to the periphery

  • ndim (int) – Number of dimensions of the trajectory (2 or 3)

__engine__ = 'NUFFT'#
in_out: bool = True#
obs_time_ms: int = 30#
add_all_acq_mrd(dataset: ismrmrd.Dataset, sim_conf: snake.core.simulation.SimConfig) ismrmrd.Dataset[source]#

Generate all mrd_acquisitions.

class snake.core.sampling.samplers.LoadTrajectorySampler[source]#

Bases: snake.core.sampling.samplers.NonCartesianAcquisitionSampler

Load a trajectory from a file.

Parameters:
  • constant (bool) – If True, the trajectory is constant.

  • obs_time_ms (int) – Time spent to acquire a single shot

  • in_out (bool) – If true, the trajectory is acquired with a double join pattern from/to the periphery

__sampler_name__ = 'load-trajectory'#
__engine__ = 'NUFFT'#
path: str = None#
constant: bool = True#
obs_time_ms: int = 25#
raster_time: float = 0.05#
in_out: bool = True#
_single_frame(sim_conf: snake.core.simulation.SimConfig) numpy.typing.NDArray[source]#

Load the trajectory.

class snake.core.sampling.samplers.StackOfSpiralSampler[source]#

Bases: snake.core.sampling.samplers.NonCartesianAcquisitionSampler

Spiral 2D Acquisition Handler to generate k-space data.

Parameters:
  • acsz (float | int) – Number/ proportion of lines to be acquired in the center of k-space.

  • accelz (int) – Acceleration factor for the rest of the lines.

  • directionz (Literal["center-out", "random"]) – Direction of the acquisition. Either “center-out” or “random”.

  • pdfz (Literal["gaussian", "uniform"]) – Probability density function of the sampling. Either “gaussian” or “uniform”.

  • obs_ms (int) – Time spent to acquire a single shot

  • nb_revolutions (int) – Number of revolutions of the spiral.

  • in_out (bool) – If true, the spiral is acquired with a double join pattern from/to the periphery

  • **kwargs – Extra arguments (smaps, n_jobs, backend etc…)

__sampler_name__ = 'stack-of-spiral'#
acsz: float | int = None#
accelz: int = None#
orderz: str | snake.core.sampling.factories.VDSorder = None#
nb_revolutions: int = 10#
spiral_name: str = 'archimedes'#
pdfz: str | snake.core.sampling.factories.VDSpdf = None#
constant: bool = False#
in_out: bool = True#
rotate_angle: snake.core.sampling.factories.AngleRotation = None#
obs_time_ms: int = 30#
n_shot_slices: int = 1#
_single_frame(sim_conf: snake.core.simulation.SimConfig) numpy.typing.NDArray[source]#

Generate the sampling pattern.

class snake.core.sampling.samplers.RotatedStackOfSpiralSampler[source]#

Bases: snake.core.sampling.samplers.StackOfSpiralSampler

Spiral 2D Acquisition Handler to generate k-space data.

Parameters:
  • rotate_frame_angle (AngleRotation | int) – Angle of rotation of the frame.

  • frame_index (int) – Index of the frame.

  • **kwargs – Extra arguments (smaps, n_jobs, backend etc…)

__sampler_name__ = 'rotated-stack-of-spiral'#
rotate_frame_angle: snake.core.sampling.factories.AngleRotation | int = 0#
frame_index: int = 0#
fix_angle_rotation(frame: collections.abc.Generator[numpy.ndarray, None, None], angle: snake.core.sampling.factories.AngleRotation | float = 0) collections.abc.Generator[numpy.ndarray, None, None][source]#

Rotate the trajectory by a given angle.

get_next_frame(sim_conf: snake.core.simulation.SimConfig) numpy.typing.NDArray[source]#

Generate the next rotated frame.

class snake.core.sampling.samplers.EPI3dAcquisitionSampler[source]#

Bases: snake.core.sampling.base.BaseSampler

Sampling pattern for EPI-3D.

__sampler_name__ = 'epi-3d'#
__engine__ = 'EPI'#
in_out = True#
acsz: float | int = None#
accelz: int = None#
orderz: snake.core.sampling.factories.VDSorder = None#
pdfz: snake.core.sampling.factories.VDSpdf = None#
_single_frame(sim_conf: snake.core.simulation.SimConfig) numpy.typing.NDArray[source]#

Generate the sampling pattern.

add_all_acq_mrd(dataset: ismrmrd.Dataset, sim_conf: snake.core.simulation.SimConfig) ismrmrd.Dataset[source]#

Create the acquisitions associated with this sampler.

class snake.core.sampling.samplers.EVI3dAcquisitionSampler[source]#

Bases: snake.core.sampling.base.BaseSampler

SAmpler for EVI acquisition.

__sampler_name__ = 'evi'#
__engine__ = 'EVI'#
in_out = True#
_single_frame(sim_conf: snake.core.simulation.SimConfig) numpy.typing.NDArray[source]#

Generate the sampling pattern.

add_all_acq_mrd(dataset: ismrmrd.Dataset, sim_conf: snake.core.simulation.SimConfig) ismrmrd.Dataset[source]#

Create the acquisitions associated with this sampler.

snake.core.sampling.samplers.dir_cos(start: numpy.typing.NDArray, end: numpy.typing.NDArray) tuple[numpy.float32][source]#

Compute the directional cosine of the vector from beg to end point.