00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef ODINPULSE_H
00019 #define ODINPULSE_H
00020
00021 #include <odinpara/jdxfunction.h>
00022 #include <odinpara/jdxfilter.h>
00023
00024 #include <odinseq/seqpuls.h>
00025
00026
00027 class SeqSimAbstract;
00028 class Sample;
00029
00030
00031
00032 #define _BOUNDARY_VALUE_ 0.005
00033 #define _SETREFGAIN_ADIABATIC_INTERVAL_ 0.01
00034 #define _SETREFGAIN_ADIABATIC_INCR_FACTOR_ 1.1
00035 #define _SETREFGAIN_ITERATIONS_ 3
00036
00037
00038 #define _TRAJ_OPTIMIZE_PARLABEL_ "FreeParameter"
00039
00041
00051 class JDXtrajectory : public JDXfunction, public StaticHandler<JDXtrajectory> {
00052
00053 public:
00054 JDXtrajectory(const STD_string& jdxlabel="unnamedJDXtrajectory") : JDXfunction(trajFunc,jdxlabel) {}
00055
00056 JDXtrajectory(const JDXtrajectory& jt) : JDXfunction(jt) {}
00057
00058 JDXtrajectory& operator = (const JDXtrajectory& jt) {JDXfunction::operator = (jt); return *this;}
00059
00060 void init_trajectory(OdinPulse* pls=0) {if(allocated_function) allocated_function->init_trajectory(pls);}
00061
00062 const kspace_coord& calculate(float s) const;
00063
00064 const traj_info& get_traj_info() const;
00065
00066 static void init_static();
00067 static void destroy_static();
00068 };
00069
00070
00072
00077 class JDXshape : public JDXfunction, public StaticHandler<JDXshape> {
00078
00079 public:
00080 JDXshape(const STD_string& jdxlabel="unnamedJDXshape") : JDXfunction(shapeFunc,jdxlabel) {}
00081
00082 JDXshape(const JDXshape& js) : JDXfunction(js) {}
00083
00084 JDXshape& operator = (const JDXshape& js) {JDXfunction::operator = (js); return *this;}
00085
00086 void init_shape() {if(allocated_function) allocated_function->init_shape();}
00087
00088 STD_complex calculate(const kspace_coord& coord ) const;
00089 STD_complex calculate(float s, float Tp) const;
00090
00091 const shape_info& get_shape_info() const;
00092 farray get_excitation_mask(float fov, unsigned int size) const;
00093
00094
00095 static void init_static();
00096 static void destroy_static();
00097 };
00098
00099
00100
00102
00103 struct OdinPulseData;
00104
00108
00109
00122 class OdinPulse : public JcampDxBlock, public virtual SeqClass {
00123
00124 public:
00125
00130 OdinPulse(const STD_string& pulse_label="unnamedOdinPulse",bool interactive=false);
00131
00135 OdinPulse(const OdinPulse& pulse);
00136
00137
00138 virtual ~OdinPulse();
00139
00143 OdinPulse& operator = (const OdinPulse& pulse);
00144
00149 OdinPulse& set_dim_mode(funcMode dmode);
00150
00155 funcMode get_dim_mode() const;
00156
00161 unsigned int get_size() const;
00162
00163
00168 OdinPulse& resize(unsigned int newsize);
00169
00174 OdinPulse& set_Tp(double duration);
00175
00180 double get_Tp() const;
00181
00187 OdinPulse& set_consider_system_cond(bool flag);
00188
00194 bool get_consider_system_cond() const;
00195
00196
00197
00203 OdinPulse& set_consider_Nyquist_cond(bool flag);
00204
00210 bool get_consider_Nyquist_cond() const;
00211
00212
00213
00219 OdinPulse& set_spat_resolution(double sigma);
00220
00225 OdinPulse& use_min_spat_resolution(bool flag);
00226
00231 double get_spat_resolution() const;
00232
00237 OdinPulse& set_field_of_excitation(double fox);
00238
00243 double get_field_of_excitation() const;
00244
00249 OdinPulse& set_spatial_offset(direction direction, double offset);
00250
00255 double get_spatial_offset(direction direction) const;
00256
00261 OdinPulse& set_nucleus(const STD_string& nucleusname);
00262
00267 STD_string get_nucleus() const;
00268
00274 OdinPulse& set_pulse_type(pulseType type);
00275
00280 pulseType get_pulse_type() const;
00281
00290 OdinPulse& set_composite_pulse(const STD_string& cpstring);
00291
00297 farray get_composite_pulse_parameters() const;
00298
00303 bool is_composite_pulse() const;
00304
00309 unsigned int get_numof_composite_pulse() const;
00310
00315 bool is_adiabatic() const;
00316
00317
00324 float get_rel_center() const;
00325
00330 double get_pulse_gain() const;
00331
00336 float get_flipangle_corr_factor() const;
00337
00342 OdinPulse& set_flipangle(double angle);
00343
00348 double get_flipangle() const;
00349
00354 OdinPulse& generate();
00355
00360 OdinPulse& set_pulse_gain();
00361
00362
00367 virtual OdinPulse& update();
00368
00369
00374 float get_power_depos() const;
00375
00376
00382 OdinPulse& set_shape(const STD_string& shapeval);
00383
00384
00385
00391 OdinPulse& set_trajectory(const STD_string& shapeval);
00392
00393
00399 OdinPulse& set_filter(const STD_string& shapeval);
00400
00401
00406 OdinPulse& set_shape_parameter(const STD_string& parameter_label, const STD_string& value);
00407
00412 OdinPulse& set_trajectory_parameter(const STD_string& parameter_label, const STD_string& value);
00413
00418 OdinPulse& set_filter_parameter(const STD_string& parameter_label, const STD_string& value);
00419
00424 STD_string get_shape_parameter(const STD_string& parameter_label) const;
00425
00430 STD_string get_trajectory_parameter(const STD_string& parameter_label) const;
00431
00436 STD_string get_filter_parameter(const STD_string& parameter_label) const;
00437
00438
00443 STD_string get_shape() const;
00444
00449 STD_string get_trajectory() const;
00450
00455 STD_string get_filter() const;
00456
00460 const fvector& get_Grad(direction channel) const;
00461
00466 double get_G0() const;
00467
00471 const cvector& get_B1() const;
00472
00477 double get_B10() const;
00478
00483 void simulate_pulse(SeqSimAbstract& sim, const Sample& sample) const;
00484
00490 int write_rf_waveform (const STD_string& filename) const;
00491
00497 int load_rf_waveform (const STD_string& filename);
00498
00499
00500
00501 int load(const STD_string& filename);
00502 int write(const STD_string& filename) const;
00503
00504
00505 protected:
00506 virtual void update_B10andPower();
00507
00508 OdinPulse& recalc_pulse();
00509
00510 double get_Tp_1pulse() const;
00511
00512 private:
00513 int append_all_members();
00514
00515 static float ensure_unit_range(float x);
00516
00517 OdinPulse& make_composite_pulse();
00518
00519
00520 static float gradient_system_max (const fvector& Gvec, float Gmax, float maxslew, float Tp);
00521 static float max_kspace_step(const fvector& Gz,float gamma,float Tp,float G0);
00522 static float max_kspace_step2(const fvector& Gx, const fvector& Gy, float gamma,float Tp,float G0);
00523
00524 OdinPulse& resize_noupdate(unsigned int newsize);
00525
00526
00527
00528 OdinPulseData* data;
00529
00530 };
00531
00535 #endif