msl 1.1.0
 
Loading...
Searching...
No Matches
gradient_pulses.h
Go to the documentation of this file.
1// Copyright 2025 Julien Lamy, ICube, Université de Strasbourg-CNRS.
2// Part of msl, distributed under the terms of the MIT license.
3
4#ifndef _d6067f26_790d_47d2_9843_9ffef6843fbb
5#define _d6067f26_790d_47d2_9843_9ffef6843fbb
6
7#include <algorithm>
8
9#include <MrImagingFW/libMath/MrException.h>
10#include <MrImagingFW/libSeqSysProp/SysProperties.h>
11
12#include <MrMeasSrv/SeqIF/libRT/libRTDefines.h>
13
14#include "helpers.h"
15#include "GradientPulse.h"
16#include "GradientSpecs.h"
17#include "Vector.h"
18
19namespace msl
20{
21
27{
28
37 Vector3d const & k, double maxAmplitude, double minRiseTime);
38
45GradientPulse quickest(Vector3d const & k, GradientSpecs const & specs);
46
57 Vector3d const & kPlateau, long plateauDuration,
58 double maxAmplitude, double minRiseTime);
59
69 Vector3d const & kPlateau, long plateauDuration,
70 GradientSpecs const & specs);
71
82 Vector3d const & k, long rampDuration, long plateauDuration,
83 double maxAmplitude, double minRiseTime);
84
94 Vector3d const & k, GradientPulse const & reference,
95 double maxAmplitude, double minRiseTime);
96
106 Vector3d const & k, long rampDuration, long plateauDuration,
107 GradientSpecs const & specs);
108
117 Vector3d const & k, GradientPulse const & reference,
118 GradientSpecs const & specs);
119
126template<typename T>
127GradientPulse sliceSelection(T && pulse, double maxAmplitude, double minRiseTime)
128{
129 auto const amplitude =
130 pulse.getBandwidth() / (pulse.getLarmorConst() * pulse.getThickness());
131 if(amplitude > maxAmplitude)
132 {
133 throw MrException("Maximum amplitude exceeded");
134 }
135
136 auto rampDuration = std::lround(roundUp(
137 std::max(
138 minRiseTime * amplitude, double(SysProperties::getCoilCtrlLead())),
139 GRAD_RASTER_TIME));
140 auto plateauDuration = std::lround(
141 roundUp(pulse.getDuration(), GRAD_RASTER_TIME));
142 return {{0., 0., amplitude}, rampDuration, plateauDuration};
143}
144
150template<typename T>
152{
153 return sliceSelection(pulse, specs.maxAmplitude, specs.minRiseTime);
154}
155
156}
157
158}
159
160#endif // _d6067f26_790d_47d2_9843_9ffef6843fbb
Trapezoidal gradient pulse on three axes, with matching ramp and plateau durations on all axes and eq...
Definition GradientPulse.h:19
Functions generating gradient pulses based on user and system constraints.
Definition gradient_pulses.h:27
GradientPulse sliceSelection(T &&pulse, double maxAmplitude, double minRiseTime)
Compute a slice selection gradient.
Definition gradient_pulses.h:127
GradientPulse quickest(Vector3d const &k, double maxAmplitude, double minRiseTime)
Compute the quickest gradient pulse to achieve the given k-space vector.
GradientPulse fixedDuration(Vector3d const &k, long rampDuration, long plateauDuration, double maxAmplitude, double minRiseTime)
Compute a gradient pulse with the requested ramp and plateau durations.
GradientPulse plateau(Vector3d const &kPlateau, long plateauDuration, double maxAmplitude, double minRiseTime)
Compute a gradient pulse with the requested plateau vector and duration.
Definition acceleration.h:17
double roundUp(double value, double base)
Round up the value to the nearest multiple of base.
Vector< 3, double > Vector3d
3D vector of doubles
Definition Vector.h:110
Specifications of the gradient system.
Definition GradientSpecs.h:12
double minRiseTime
Minimum rise time (i.e. inverse of slew rate) in µs/(mT/m)
Definition GradientSpecs.h:17
double maxAmplitude
Maximum gradient amplitude in mT/m.
Definition GradientSpecs.h:14