ODIN
odinpulse.h
1 /***************************************************************************
2  odinpulse.h - description
3  -------------------
4  begin : Tue Jun 4 2002
5  copyright : (C) 2000-2021 by Thies Jochimsen
6  email : thies@jochimsen.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef ODINPULSE_H
19 #define ODINPULSE_H
20 
21 #include <odinpara/ldrfunction.h>
22 #include <odinpara/ldrfilter.h>
23 
24 #include <odinseq/seqpuls.h>
25 
26 
27 class SeqSimAbstract; // forward declaration
28 class Sample; // forward declaration
29 
30 
31 
32 #define _BOUNDARY_VALUE_ 0.005
33 #define _SETREFGAIN_ADIABATIC_INTERVAL_ 0.01
34 #define _SETREFGAIN_ADIABATIC_INCR_FACTOR_ 1.1
35 #define _SETREFGAIN_ITERATIONS_ 3
36 
37  // Parameter values of this optimization parameter must be in range [0,1]
38 #define _TRAJ_OPTIMIZE_PARLABEL_ "FreeParameter"
39 
41 
51 class LDRtrajectory : public LDRfunction, public StaticHandler<LDRtrajectory> {
52 
53  public:
54  LDRtrajectory(const STD_string& ldrlabel="unnamedLDRtrajectory") : LDRfunction(trajFunc,ldrlabel) {}
55 
56  LDRtrajectory(const LDRtrajectory& jt) : LDRfunction(jt) {}
57 
58  LDRtrajectory& operator = (const LDRtrajectory& jt) {LDRfunction::operator = (jt); return *this;}
59 
60  void init_trajectory(OdinPulse* pls=0) {if(allocated_function) allocated_function->init_trajectory(pls);}
61 
62  const kspace_coord& calculate(float s) const;
63 
64  const traj_info& get_traj_info() const;
65 
66  static void init_static();
67  static void destroy_static();
68 };
69 
70 
72 
77 class LDRshape : public LDRfunction, public StaticHandler<LDRshape> {
78 
79  public:
80  LDRshape(const STD_string& ldrlabel="unnamedLDRshape") : LDRfunction(shapeFunc,ldrlabel) {}
81 
82  LDRshape(const LDRshape& js) : LDRfunction(js) {}
83 
84  LDRshape& operator = (const LDRshape& js) {LDRfunction::operator = (js); return *this;}
85 
86  void init_shape() {if(allocated_function) allocated_function->init_shape();}
87 
88  STD_complex calculate(const kspace_coord& coord ) const;
89  STD_complex calculate(float s, float Tp) const;
90 
91  const shape_info& get_shape_info() const;
92  farray get_excitation_mask(float fov, unsigned int size) const;
93 
94 
95  static void init_static();
96  static void destroy_static();
97 };
98 
99 
100 
102 
103 struct OdinPulseData; // forward declaration
104 
109 
122 class OdinPulse : public LDRblock, public virtual SeqClass {
123 
124  public:
125 
130  OdinPulse(const STD_string& pulse_label="unnamedOdinPulse",bool interactive=false);
131 
135  OdinPulse(const OdinPulse& pulse);
136 
137 
138  virtual ~OdinPulse();
139 
144 
150 
156 
161  unsigned int get_size() const;
162 
163 
168  OdinPulse& resize(unsigned int newsize);
169 
174  OdinPulse& set_Tp(double duration);
175 
180  double get_Tp() const;
181 
188 
195 
196 
197 
204 
211 
212 
213 
220 
226 
231  double get_spat_resolution() const;
232 
238 
243  double get_field_of_excitation() const;
244 
250 
256 
261  OdinPulse& set_nucleus(const STD_string& nucleusname);
262 
267  STD_string get_nucleus() const;
268 
275 
281 
290  OdinPulse& set_composite_pulse(const STD_string& cpstring);
291 
298 
303  bool is_composite_pulse() const;
304 
309  unsigned int get_numof_composite_pulse() const;
310 
315  bool is_adiabatic() const;
316 
317 
324  float get_rel_center() const;
325 
330  double get_pulse_gain() const;
331 
337 
342  OdinPulse& set_flipangle(double angle);
343 
348  double get_flipangle() const;
349 
355 
361 
362 
367  virtual OdinPulse& update();
368 
369 
374  float get_power_depos() const;
375 
376 
382  OdinPulse& set_shape(const STD_string& shapeval);
383 
384 
385 
391  OdinPulse& set_trajectory(const STD_string& shapeval);
392 
393 
399  OdinPulse& set_filter(const STD_string& shapeval);
400 
401 
406  OdinPulse& set_shape_parameter(const STD_string& parameter_label, const STD_string& value);
407 
412  OdinPulse& set_trajectory_parameter(const STD_string& parameter_label, const STD_string& value);
413 
418  OdinPulse& set_filter_parameter(const STD_string& parameter_label, const STD_string& value);
419 
424  STD_string get_shape_parameter(const STD_string& parameter_label) const;
425 
430  STD_string get_trajectory_parameter(const STD_string& parameter_label) const;
431 
436  STD_string get_filter_parameter(const STD_string& parameter_label) const;
437 
438 
443  STD_string get_shape() const;
444 
449  STD_string get_trajectory() const;
450 
455  STD_string get_filter() const;
456 
460  const fvector& get_Grad(direction channel) const;
461 
466  double get_G0() const;
467 
471  const cvector& get_B1() const;
472 
477  double get_B10() const;
478 
483  void simulate_pulse(SeqSimAbstract& sim, const Sample& sample) const;
484 
490  int write_rf_waveform (const STD_string& filename) const;
491 
497  int load_rf_waveform (const STD_string& filename);
498 
499 
500  // overloading virtual functions of LDRblock
501  int load(const STD_string& filename, const LDRserBase& serializer=LDRserJDX());
502 
503 
504  protected:
505  virtual void update_B10andPower();
506 
507  OdinPulse& recalc_pulse();
508 
509  double get_Tp_1pulse() const;
510 
511  private:
512  int append_all_members();
513 
514  static float ensure_unit_range(float x);
515 
516  OdinPulse& make_composite_pulse();
517 
518 
519  static float gradient_system_max (const fvector& Gvec, float Gmax, float maxslew, float Tp);
520  static float max_kspace_step(const fvector& Gz,float gamma,float Tp,float G0);
521  static float max_kspace_step2(const fvector& Gx, const fvector& Gy, float gamma,float Tp,float G0);
522 
523  OdinPulse& resize_noupdate(unsigned int newsize);
524 
525 
526  // this pointer holds all data of the pulse
527  OdinPulseData* data;
528 
529 };
530 
534 #endif
Advandced RF pulses.
Definition: odinpulse.h:122
STD_string get_trajectory() const
OdinPulse & set_flipangle(double angle)
double get_B10() const
OdinPulse & set_filter(const STD_string &shapeval)
OdinPulse & operator=(const OdinPulse &pulse)
float get_power_depos() const
OdinPulse & set_consider_system_cond(bool flag)
double get_field_of_excitation() const
void simulate_pulse(SeqSimAbstract &sim, const Sample &sample) const
OdinPulse & set_spatial_offset(direction direction, double offset)
OdinPulse & set_trajectory_parameter(const STD_string &parameter_label, const STD_string &value)
float get_flipangle_corr_factor() const
OdinPulse & set_pulse_gain()
OdinPulse(const STD_string &pulse_label="unnamedOdinPulse", bool interactive=false)
double get_spatial_offset(direction direction) const
funcMode get_dim_mode() const
OdinPulse(const OdinPulse &pulse)
OdinPulse & use_min_spat_resolution(bool flag)
pulseType get_pulse_type() const
STD_string get_filter() const
OdinPulse & set_Tp(double duration)
OdinPulse & set_shape(const STD_string &shapeval)
double get_spat_resolution() const
STD_string get_shape_parameter(const STD_string &parameter_label) const
OdinPulse & resize(unsigned int newsize)
STD_string get_filter_parameter(const STD_string &parameter_label) const
float get_rel_center() const
unsigned int get_size() const
int write_rf_waveform(const STD_string &filename) const
bool get_consider_system_cond() const
OdinPulse & set_pulse_type(pulseType type)
double get_G0() const
OdinPulse & set_consider_Nyquist_cond(bool flag)
STD_string get_shape() const
bool get_consider_Nyquist_cond() const
double get_flipangle() const
const cvector & get_B1() const
OdinPulse & set_composite_pulse(const STD_string &cpstring)
farray get_composite_pulse_parameters() const
OdinPulse & generate()
bool is_composite_pulse() const
OdinPulse & set_dim_mode(funcMode dmode)
virtual OdinPulse & update()
bool is_adiabatic() const
OdinPulse & set_trajectory(const STD_string &shapeval)
STD_string get_trajectory_parameter(const STD_string &parameter_label) const
int load(const STD_string &filename, const LDRserBase &serializer=LDRserJDX())
unsigned int get_numof_composite_pulse() const
OdinPulse & set_nucleus(const STD_string &nucleusname)
OdinPulse & set_filter_parameter(const STD_string &parameter_label, const STD_string &value)
OdinPulse & set_field_of_excitation(double fox)
const fvector & get_Grad(direction channel) const
double get_pulse_gain() const
int load_rf_waveform(const STD_string &filename)
OdinPulse & set_shape_parameter(const STD_string &parameter_label, const STD_string &value)
OdinPulse & set_spat_resolution(double sigma)
STD_string get_nucleus() const
double get_Tp() const
Virtual Sample for Simulation.
Definition: sample.h:55
funcMode
Definition: ldrfunction.h:39
direction
Definition: odinpara.h:41
pulseType
Definition: seqpuls.h:42