00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef SEQACQEPI_H
00019 #define SEQACQEPI_H
00020
00021 #include <odinseq/seqacq.h>
00022 #include <odinseq/seqgrad.h>
00023 #include <odinseq/seqlist.h>
00024 #include <odinseq/seqloop.h>
00025 #include <odinseq/seqdelay.h>
00026 #include <odinseq/seqgradtrapez.h>
00027 #include <odinseq/seqgradconst.h>
00028 #include <odinseq/seqparallel.h>
00029 #include <odinseq/seqdriver.h>
00030
00031
00036 class SeqEpiDriver : public SeqDriverBase, public SeqObjList, public virtual SeqAcqInterface, public virtual SeqGradInterface {
00037
00038 public:
00039
00040 SeqEpiDriver() {}
00041 virtual ~SeqEpiDriver() {}
00042
00043 virtual void init_driver(const STD_string& object_label,double sweepwidth,
00044 float kread_min, float kread_max, unsigned readntps,
00045 float kphase_min, float kphase_max, unsigned phasentps,int startindex_phase,
00046 bool ramp_sampling,rampType rampmode, float ramp_steepness,
00047 const STD_string& nucleus, const dvector& phaselist, const dvector& freqlist, unsigned int echo_pairs) = 0;
00048
00049 virtual unsigned get_npts_read() const = 0;
00050
00051 virtual unsigned int get_numof_gradechoes() const = 0;
00052
00053 virtual double get_echoduration() const = 0;
00054
00055 virtual double get_ramp_rastertime() const = 0;
00056
00057 virtual float get_gradintegral2center_read() const = 0;
00058
00059 virtual float get_gradintegral2center_phase() const = 0;
00060
00061 virtual fvector get_readout_shape() const = 0;
00062
00063 virtual const kSpaceCoord& get_kcoord_template(unsigned int& padded_zeroes) const = 0;
00064
00065 virtual SeqEpiDriver* clone_driver() const = 0;
00066
00067 unsigned int get_npts() const {return get_npts_read()*get_numof_gradechoes();}
00068
00069
00070 protected:
00071 SeqEpiDriver(const SeqEpiDriver& seda) : SeqObjList(seda) {SeqEpiDriver::operator = (seda);}
00072
00073 SeqEpiDriver& operator = (const SeqEpiDriver& seda) {
00074 SeqObjList::operator =(seda);
00075 return *this;
00076 }
00077
00078
00079 };
00080
00081
00083
00088 class SeqEpiDriverDefault : public SeqEpiDriver {
00089
00090
00091
00092 public:
00093 SeqEpiDriverDefault();
00094 ~SeqEpiDriverDefault() {}
00095
00096 SeqEpiDriverDefault(const SeqEpiDriverDefault& sedi);
00097
00098 void init_driver(const STD_string& object_label,double sweepwidth,
00099 float kread_min, float kread_max, unsigned readntps,
00100 float kphase_min, float kphase_max, unsigned phasentps,int startindex_phase,
00101 bool ramp_sampling, rampType rampmode, float ramp_steepness,
00102 const STD_string& nucleus,
00103 const dvector& phaselist, const dvector& freqlist, unsigned int echo_pairs);
00104
00105
00106
00107 odinPlatform get_driverplatform() const {return standalone;}
00108
00109
00110
00111 unsigned int get_npts_read() const {return adc.get_npts();}
00112 unsigned int get_numof_gradechoes() const;
00113 double get_echoduration() const {return posread.get_gradduration();}
00114 double get_ramp_rastertime() const {return posread.get_timestep();}
00115 float get_gradintegral2center_read() const {return gradint2center_read;}
00116 float get_gradintegral2center_phase() const {return gradint2center_phase;}
00117 fvector get_readout_shape() const {return readshape;}
00118 const kSpaceCoord& get_kcoord_template(unsigned int& padded_zeroes) const {padded_zeroes=0; return adc.get_kcoord();}
00119 SeqEpiDriver* clone_driver() const {return new SeqEpiDriverDefault(*this);}
00120
00121
00122
00123 double get_acquisition_center() const;
00124 double get_acquisition_start() const;
00125 SeqAcqInterface& set_template_type(templateType type);
00126
00127
00128
00129
00130
00131 SeqGradInterface& set_strength(float gradstrength) {return *this;}
00132 SeqGradInterface& invert_strength() {kernel.invert_strength(); return *this;}
00133 float get_strength() const {return kernel.get_strength();}
00134 fvector get_gradintegral() const;
00135 double get_gradduration() const {return kernel.get_gradduration();}
00136 SeqGradInterface& set_gradrotmatrix(const RotMatrix& matrix) {kernel.set_gradrotmatrix(matrix); return *this;}
00137
00138
00139 private:
00140 void build_seq();
00141
00142 SeqAcq adc;
00143 SeqDelay acqdelay_begin;
00144 SeqDelay acqdelay_middle;
00145 SeqDelay acqdelay_end;
00146
00147 SeqGradTrapez posread;
00148 SeqGradTrapez negread;
00149
00150 SeqGradTrapez phaseblip1st;
00151 SeqGradTrapez phaseblip2nd;
00152 SeqGradDelay phasezero1st;
00153 SeqGradDelay phasezero2nd;
00154 SeqGradDelay phasezero_lastblip;
00155
00156 SeqGradChanParallel gradkernel;
00157 SeqGradChanParallel lastgradkernel;
00158 SeqObjList oneadckernel;
00159 SeqObjList adckernel;
00160 SeqObjList lastadckernel;
00161 SeqParallel kernel;
00162 SeqParallel lastkernel;
00163
00164 SeqObjLoop loop;
00165
00166 float gradint2center_read;
00167 float gradint2center_phase;
00168 int centerindex_phase;
00169 fvector readshape;
00170 templateType templtype;
00171 int echopairs;
00172 bool lastecho;
00173 };
00174
00175
00176
00178
00179 class SeqAcqEPIdephObjs;
00180
00191 class SeqAcqEPI : public SeqObjBase, public virtual SeqAcqInterface, public virtual SeqGradInterface {
00192
00193 public:
00194
00217 SeqAcqEPI(const STD_string& object_label, double sweepwidth,
00218 unsigned int read_size, float FOVread,
00219 unsigned int phase_size, float FOVphase,
00220 unsigned int shots=1, unsigned int reduction=1, float os_factor=1.0, const STD_string& nucleus="",
00221 const dvector& phaselist=0, const dvector& freqlist=0,
00222 rampType rampmode = linear, bool ramp_sampling=false, float ramp_steepness=1.0,
00223 float fourier_factor=0.0, unsigned int echo_pairs=0);
00224
00225
00226
00230 SeqAcqEPI(const SeqAcqEPI& sae);
00231
00235 SeqAcqEPI(const STD_string& object_label="unnamedSeqAcqEPI");
00236
00240 ~SeqAcqEPI();
00241
00246 unsigned int get_npts_read() const {return driver->get_npts_read();}
00247
00252 unsigned int get_numof_gradechoes() const {return driver->get_numof_gradechoes();}
00253
00257 fvector get_readout_shape() const {return driver->get_readout_shape();}
00258
00262 SeqAcqEPI& operator = (const SeqAcqEPI& sae);
00263
00264
00265
00266
00267
00268 double get_acquisition_center() const {return driver->get_acquisition_center();}
00269 double get_acquisition_start() const {return driver->get_acquisition_start();}
00270 unsigned int get_npts() const {return driver->get_npts();}
00271 SeqAcqInterface& set_sweepwidth(double sw, float os_factor);
00272 double get_sweepwidth() const {return driver->get_sweepwidth();}
00273 float get_oversampling() const {return os_factor_cache;}
00274 SeqAcqInterface& set_template_type(templateType type);
00275 SeqAcqInterface& set_reco_vector(recoDim dim, const SeqVector& vec, const dvector& valvec=dvector()) {driver->set_reco_vector(dim,vec,valvec); return *this;}
00276 SeqAcqInterface& set_default_reco_index(recoDim dim, unsigned int index) {driver->set_default_reco_index(dim,index); return *this;}
00277
00278
00279 SeqFreqChanInterface& set_nucleus(const STD_string& nucleus) {driver->set_nucleus(nucleus); return *this;}
00280 SeqFreqChanInterface& set_freqlist(const dvector& freqlist) {driver->set_freqlist(freqlist); return *this;}
00281 SeqFreqChanInterface& set_phaselist(const dvector& phaselist) {driver->set_phaselist(phaselist); return *this;}
00282 const SeqVector& get_freqlist_vector() const {return driver->get_freqlist_vector();}
00283 const SeqVector& get_phaselist_vector() const {return driver->get_phaselist_vector();}
00284
00285
00286 SeqGradInterface& set_strength(float gradstrength) {driver->set_strength(gradstrength); return *this;}
00287 SeqGradInterface& invert_strength() {driver->invert_strength(); return *this;}
00288 float get_strength() const {return driver->get_strength();}
00289 fvector get_gradintegral() const {return driver->get_gradintegral();}
00290 double get_gradduration() const {return driver->get_gradduration();}
00291 SeqGradInterface& set_gradrotmatrix(const RotMatrix& matrix) {driver->set_gradrotmatrix(matrix); return *this;}
00292
00293
00294
00295 STD_string get_program(programContext& context) const {return driver->get_program(context);}
00296 double get_duration() const {return driver->get_duration();}
00297 SeqValList get_freqvallist(freqlistAction action) const {return driver->get_freqvallist(action);}
00298 void query(queryContext& context) const {driver->query(context);}
00299 RecoValList get_recovallist(unsigned int reptimes, JDXkSpaceCoords& coords) const;
00300 bool contains(const SeqTreeObj* sto) const {return driver->contains(sto);}
00301 void tree(SeqTreeCallbackAbstract* display) const {driver->tree(display);}
00302 unsigned int event(eventContext& context) const {return driver->event(context);}
00303 STD_string get_properties() const {return driver->get_properties();}
00304
00305
00306 private:
00307
00308 SeqVector& get_mutable_freqlist_vector() {return driver->get_mutable_freqlist_vector();}
00309 SeqVector& get_mutable_phaselist_vector() {return driver->get_mutable_phaselist_vector();}
00310
00311
00312 const SeqVector* get_dephgrad(SeqGradChanParallel& dephobj, bool rephase) const;
00313
00314
00315 bool prep();
00316
00317 void common_init();
00318
00319 void create_deph_and_reph();
00320
00321
00322 unsigned int readsize_os_cache;
00323 float os_factor_cache;
00324 unsigned int phasesize_cache;
00325 unsigned int segments_cache;
00326 unsigned int reduction_cache;
00327 int echo_pairs_cache;
00328 float blipint_cache;
00329 templateType templtype_cache;
00330 rampType ramptype_cache;
00331
00332 mutable SeqDriverInterface<SeqEpiDriver> driver;
00333
00334 SeqAcqEPIdephObjs* dephobjs;
00335 };
00336
00337
00341 #endif