ODIN
seqacqepi.h
1 /***************************************************************************
2  seqacqepi.h - description
3  -------------------
4  begin : Wed Aug 8 2001
5  copyright : (C) 2000-2021 by Thies H. 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 SEQACQEPI_H
19 #define SEQACQEPI_H
20 
21 #include <odinseq/seqacq.h>
22 #include <odinseq/seqgrad.h>
23 #include <odinseq/seqlist.h>
24 #include <odinseq/seqloop.h>
25 #include <odinseq/seqdelay.h>
26 #include <odinseq/seqgradtrapez.h>
27 #include <odinseq/seqgradconst.h>
28 #include <odinseq/seqparallel.h>
29 #include <odinseq/seqdriver.h>
30 
31 
36 class SeqEpiDriver : public SeqDriverBase, public SeqObjList, public virtual SeqAcqInterface, public virtual SeqGradInterface {
37 
38  public:
39 
40  SeqEpiDriver() {}
41  virtual ~SeqEpiDriver() {}
42 
43  virtual void init_driver(const STD_string& object_label,double sweepwidth,
44  float kread_min, float kread_max, unsigned readntps,
45  float kphase_min, float kphase_max, unsigned phasentps,int startindex_phase,
46  bool ramp_sampling,rampType rampmode, float ramp_steepness,
47  const STD_string& nucleus, const dvector& phaselist, const dvector& freqlist, unsigned int echo_pairs) = 0;
48 
49  virtual unsigned get_npts_read() const = 0;
50 
51  virtual unsigned int get_numof_gradechoes() const = 0;
52 
53  virtual double get_echoduration() const = 0;
54 
55  virtual double get_ramp_rastertime() const = 0;
56 
57  virtual float get_gradintegral2center_read() const = 0;
58 
59  virtual float get_gradintegral2center_phase() const = 0;
60 
61  virtual fvector get_readout_shape() const = 0;
62 
63  virtual const kSpaceCoord& get_kcoord_template(unsigned int& padded_zeroes) const = 0;
64 
65  virtual SeqEpiDriver* clone_driver() const = 0;
66 
67  unsigned int get_npts() const {return get_npts_read()*get_numof_gradechoes();}
68 
69 
70  protected:
71  SeqEpiDriver(const SeqEpiDriver& seda) : SeqObjList(seda) {SeqEpiDriver::operator = (seda);}
72 
73  SeqEpiDriver& operator = (const SeqEpiDriver& seda) {
75  return *this;
76  }
77 
78 
79 };
80 
81 
83 
89 
90  // virtual functions of SeqFreqChanInterface are marhshalled to adc
91 
92  public:
95 
97 
98  void init_driver(const STD_string& object_label,double sweepwidth,
99  float kread_min, float kread_max, unsigned readntps,
100  float kphase_min, float kphase_max, unsigned phasentps,int startindex_phase,
101  bool ramp_sampling, rampType rampmode, float ramp_steepness,
102  const STD_string& nucleus,
103  const dvector& phaselist, const dvector& freqlist, unsigned int echo_pairs);
104 
105 
106  // overloading virtual functions from SeqDriverBase
107  odinPlatform get_driverplatform() const {return standalone;}
108 
109 
110  // implemented virtual functions from SeqEpiDriver
111  unsigned int get_npts_read() const {return adc.get_npts();}
112  unsigned int get_numof_gradechoes() const;
113  double get_echoduration() const {return posread.get_gradduration();}
114  double get_ramp_rastertime() const {return posread.get_timestep();}
115  float get_gradintegral2center_read() const {return gradint2center_read;}
116  float get_gradintegral2center_phase() const {return gradint2center_phase;}
117  fvector get_readout_shape() const {return readshape;}
118  const kSpaceCoord& get_kcoord_template(unsigned int& padded_zeroes) const {padded_zeroes=0; return adc.get_kcoord();}
119  SeqEpiDriver* clone_driver() const {return new SeqEpiDriverDefault(*this);}
120 
121 
122  // marshalling virtual functions of SeqAcqInterface to adc, except:
123  double get_acquisition_center() const;
124  double get_acquisition_start() const;
126 
127 
128 
129 
130  // implementing virtual functions of SeqGradInterface
131  SeqGradInterface& set_strength(float gradstrength) {return *this;}
132  SeqGradInterface& invert_strength() {kernel.invert_strength(); return *this;}
133  float get_strength() const {return kernel.get_strength();}
135  double get_gradduration() const {return kernel.get_gradduration();}
136  SeqGradInterface& set_gradrotmatrix(const RotMatrix& matrix) {kernel.set_gradrotmatrix(matrix); return *this;}
137 
138 
139  private:
140  void build_seq();
141 
142  SeqAcq adc;
143  SeqDelay acqdelay_begin;
144  SeqDelay acqdelay_middle;
145  SeqDelay acqdelay_end;
146 
147  SeqGradTrapez posread;
148  SeqGradTrapez negread;
149 
150  SeqGradTrapez phaseblip1st;
151  SeqGradTrapez phaseblip2nd;
152  SeqGradDelay phasezero1st;
153  SeqGradDelay phasezero2nd;
154  SeqGradDelay phasezero_lastblip;
155 
156  SeqGradChanParallel gradkernel;
157  SeqGradChanParallel lastgradkernel;
158  SeqObjList oneadckernel;
159  SeqObjList adckernel;
160  SeqObjList lastadckernel;
161  SeqParallel kernel;
162  SeqParallel lastkernel;
163 
164  SeqObjLoop loop;
165 
166  float gradint2center_read;
167  float gradint2center_phase;
168  int centerindex_phase;
169  fvector readshape;
170  templateType templtype;
171  int echopairs;
172  bool lastecho;
173 };
174 
175 
176 
178 
179 class SeqAcqEPIdephObjs; // forward declaration
180 
191 class SeqAcqEPI : public SeqObjBase, public virtual SeqAcqInterface, public virtual SeqGradInterface {
192 
193  public:
194 
217  SeqAcqEPI(const STD_string& object_label, double sweepwidth,
218  unsigned int read_size, float FOVread,
219  unsigned int phase_size, float FOVphase,
220  unsigned int shots=1, unsigned int reduction=1, float os_factor=1.0, const STD_string& nucleus="",
221  const dvector& phaselist=0, const dvector& freqlist=0,
222  rampType rampmode = linear, bool ramp_sampling=false, float ramp_steepness=1.0,
223  float fourier_factor=0.0, unsigned int echo_pairs=0, bool invert_partial_fourier=false);
224 
225 
226 
230  SeqAcqEPI(const SeqAcqEPI& sae);
231 
235  SeqAcqEPI(const STD_string& object_label="unnamedSeqAcqEPI");
236 
241 
246  unsigned int get_npts_read() const {return driver->get_npts_read();}
247 
252  unsigned int get_numof_gradechoes() const {return driver->get_numof_gradechoes();}
253 
257  fvector get_readout_shape() const {return driver->get_readout_shape();}
258 
263 
264 
265  // forwarding virtual functions of SeqAcqInterface to driver
266  // we cannot use marshalling with a fixed pointer here because
267  // driver may be changed when switching platform
268  double get_acquisition_center() const {return driver->get_acquisition_center();}
269  double get_acquisition_start() const {return driver->get_acquisition_start();}
270  unsigned int get_npts() const {return driver->get_npts();}
271  SeqAcqInterface& set_sweepwidth(double sw, float os_factor); // produce warning
272  double get_sweepwidth() const {return driver->get_sweepwidth();}
273  float get_oversampling() const {return os_factor_cache;}
275  SeqAcqInterface& set_reco_vector(recoDim dim, const SeqVector& vec, const dvector& valvec=dvector()) {driver->set_reco_vector(dim,vec,valvec); return *this;}
276  SeqAcqInterface& set_default_reco_index(recoDim dim, unsigned int index) {driver->set_default_reco_index(dim,index); return *this;}
277 
278  // forwarding virtual functions of SeqFreqChanInterface to driver
279  SeqFreqChanInterface& set_nucleus(const STD_string& nucleus) {driver->set_nucleus(nucleus); return *this;}
280  SeqFreqChanInterface& set_freqlist(const dvector& freqlist) {driver->set_freqlist(freqlist); return *this;}
281  SeqFreqChanInterface& set_phaselist(const dvector& phaselist) {driver->set_phaselist(phaselist); return *this;}
282  const SeqVector& get_freqlist_vector() const {return driver->get_freqlist_vector();}
283  const SeqVector& get_phaselist_vector() const {return driver->get_phaselist_vector();}
284 
285  // forwarding virtual functions of SeqGradInterface to driver
286  SeqGradInterface& set_strength(float gradstrength) {driver->set_strength(gradstrength); return *this;}
287  SeqGradInterface& invert_strength() {driver->invert_strength(); return *this;}
288  float get_strength() const {return driver->get_strength();}
289  fvector get_gradintegral() const {return driver->get_gradintegral();}
290  double get_gradduration() const {return driver->get_gradduration();}
291  SeqGradInterface& set_gradrotmatrix(const RotMatrix& matrix) {driver->set_gradrotmatrix(matrix); return *this;}
292 
293 
294  // forwarding virtual functions of SeqTreeObj to driver
295  STD_string get_program(programContext& context) const {return driver->get_program(context);}
296  double get_duration() const {return driver->get_duration();}
297  SeqValList get_freqvallist(freqlistAction action) const {return driver->get_freqvallist(action);}
298  void query(queryContext& context) const {driver->query(context);}
299  RecoValList get_recovallist(unsigned int reptimes, LDRkSpaceCoords& coords) const;
300  bool contains(const SeqTreeObj* sto) const {return driver->contains(sto);}
301  void tree(SeqTreeCallbackAbstract* display) const {driver->tree(display);}
302  unsigned int event(eventContext& context) const {return driver->event(context);}
303  STD_string get_properties() const {return driver->get_properties();}
304 
305 
306  private:
307 
308  SeqVector& get_mutable_freqlist_vector() {return driver->get_mutable_freqlist_vector();}
309  SeqVector& get_mutable_phaselist_vector() {return driver->get_mutable_phaselist_vector();}
310 
311  // overloaded for SeqAcqDeph
312  const SeqVector* get_dephgrad(SeqGradChanParallel& dephobj, bool rephase) const;
313 
314  // overwriting virtual functions from SeqClass
315  bool prep();
316 
317  void common_init();
318 
319  void create_deph_and_reph();
320 
321 
322  unsigned int readsize_os_cache;
323  float os_factor_cache;
324  unsigned int phasesize_cache;
325  unsigned int segments_cache;
326  unsigned int reduction_cache;
327  int echo_pairs_cache;
328  float blipint_cache;
329  templateType templtype_cache;
330  rampType ramptype_cache;
331 
332  mutable SeqDriverInterface<SeqEpiDriver> driver;
333 
334  SeqAcqEPIdephObjs* dephobjs;
335 };
336 
337 
341 #endif
Rotation Matrix.
Definition: geometry.h:67
Acquisition + echo-planar imaging readout.
Definition: seqacqepi.h:191
float get_strength() const
Definition: seqacqepi.h:288
const SeqVector & get_phaselist_vector() const
Definition: seqacqepi.h:283
unsigned int get_numof_gradechoes() const
Definition: seqacqepi.h:252
SeqFreqChanInterface & set_freqlist(const dvector &freqlist)
Definition: seqacqepi.h:280
SeqAcqInterface & set_template_type(templateType type)
double get_acquisition_start() const
Definition: seqacqepi.h:269
SeqAcqEPI(const SeqAcqEPI &sae)
double get_gradduration() const
Definition: seqacqepi.h:290
SeqAcqEPI(const STD_string &object_label="unnamedSeqAcqEPI")
SeqAcqInterface & set_reco_vector(recoDim dim, const SeqVector &vec, const dvector &valvec=dvector())
Definition: seqacqepi.h:275
SeqAcqEPI(const STD_string &object_label, double sweepwidth, unsigned int read_size, float FOVread, unsigned int phase_size, float FOVphase, unsigned int shots=1, unsigned int reduction=1, float os_factor=1.0, const STD_string &nucleus="", const dvector &phaselist=0, const dvector &freqlist=0, rampType rampmode=linear, bool ramp_sampling=false, float ramp_steepness=1.0, float fourier_factor=0.0, unsigned int echo_pairs=0, bool invert_partial_fourier=false)
SeqAcqEPI & operator=(const SeqAcqEPI &sae)
double get_duration() const
Definition: seqacqepi.h:296
SeqAcqInterface & set_sweepwidth(double sw, float os_factor)
STD_string get_properties() const
Definition: seqacqepi.h:303
unsigned int get_npts() const
Definition: seqacqepi.h:270
unsigned int get_npts_read() const
Definition: seqacqepi.h:246
SeqGradInterface & invert_strength()
Definition: seqacqepi.h:287
float get_oversampling() const
Definition: seqacqepi.h:273
SeqGradInterface & set_strength(float gradstrength)
Definition: seqacqepi.h:286
double get_acquisition_center() const
Definition: seqacqepi.h:268
double get_sweepwidth() const
Definition: seqacqepi.h:272
void query(queryContext &context) const
Definition: seqacqepi.h:298
SeqFreqChanInterface & set_phaselist(const dvector &phaselist)
Definition: seqacqepi.h:281
SeqAcqInterface & set_default_reco_index(recoDim dim, unsigned int index)
Definition: seqacqepi.h:276
unsigned int event(eventContext &context) const
Definition: seqacqepi.h:302
const SeqVector & get_freqlist_vector() const
Definition: seqacqepi.h:282
SeqFreqChanInterface & set_nucleus(const STD_string &nucleus)
Definition: seqacqepi.h:279
RecoValList get_recovallist(unsigned int reptimes, LDRkSpaceCoords &coords) const
SeqGradInterface & set_gradrotmatrix(const RotMatrix &matrix)
Definition: seqacqepi.h:291
fvector get_gradintegral() const
Definition: seqacqepi.h:289
SeqValList get_freqvallist(freqlistAction action) const
Definition: seqacqepi.h:297
STD_string get_program(programContext &context) const
Definition: seqacqepi.h:295
fvector get_readout_shape() const
Definition: seqacqepi.h:257
virtual double get_sweepwidth() const
Definition: seqacq.h:79
virtual double get_acquisition_center() const
Definition: seqacq.h:52
virtual SeqAcqInterface & set_reco_vector(recoDim dim, const SeqVector &vec, const dvector &valvec=dvector())
Definition: seqacq.h:102
virtual double get_acquisition_start() const
Definition: seqacq.h:59
virtual SeqAcqInterface & set_default_reco_index(recoDim dim, unsigned int index)
Definition: seqacq.h:110
Acquisition.
Definition: seqacq.h:206
const kSpaceCoord & get_kcoord() const
unsigned int get_npts() const
Definition: seqacq.h:293
Timing delay.
Definition: seqdelay.h:54
double get_acquisition_center() const
double get_gradduration() const
Definition: seqacqepi.h:135
double get_acquisition_start() const
float get_strength() const
Definition: seqacqepi.h:133
SeqGradInterface & invert_strength()
Definition: seqacqepi.h:132
SeqGradInterface & set_gradrotmatrix(const RotMatrix &matrix)
Definition: seqacqepi.h:136
fvector get_gradintegral() const
SeqAcqInterface & set_template_type(templateType type)
SeqGradInterface & set_strength(float gradstrength)
Definition: seqacqepi.h:131
unsigned int get_npts() const
Definition: seqacqepi.h:67
virtual SeqFreqChanInterface & set_nucleus(const STD_string &nucleus)
Definition: seqfreq.h:42
virtual SeqFreqChanInterface & set_phaselist(const dvector &phaselist)
Definition: seqfreq.h:53
virtual const SeqVector & get_freqlist_vector() const
Definition: seqfreq.h:58
virtual SeqFreqChanInterface & set_freqlist(const dvector &freqlist)
Definition: seqfreq.h:48
virtual const SeqVector & get_phaselist_vector() const
Definition: seqfreq.h:64
Gradient delay.
Definition: seqgradconst.h:84
virtual SeqGradInterface & set_gradrotmatrix(const RotMatrix &matrix)=0
virtual float get_strength() const =0
virtual SeqGradInterface & set_strength(float gradstrength)=0
virtual fvector get_gradintegral() const =0
virtual double get_gradduration() const =0
virtual SeqGradInterface & invert_strength()=0
Trapezoidal gradient.
double get_timestep() const
double get_gradduration() const
Container for sequence objects.
Definition: seqlist.h:87
SeqObjList & operator=(const SeqObjList &so)
STD_string get_program(programContext &context) const
double get_duration() const
STD_string get_properties() const
unsigned int event(eventContext &context) const
SeqValList get_freqvallist(freqlistAction action) const
void query(queryContext &context) const
Sequence Loop.
Definition: seqloop.h:38
float get_strength() const
double get_gradduration() const
SeqGradInterface & invert_strength()
SeqGradInterface & set_gradrotmatrix(const RotMatrix &matrix)
void tree(SeqTreeCallbackAbstract *display) const
bool contains(const SeqTreeObj *sto) const
recoDim
Definition: reco.h:74
odinPlatform
Definition: system.h:39
templateType
Definition: reco.h:91
freqlistAction
Definition: seqtree.h:102
rampType
Definition: seqgradramp.h:42
tjvector< double > dvector
Definition: tjvector.h:451