system.h

00001 /***************************************************************************
00002                           system.h  -  description
00003                              -------------------
00004     begin                : Wed Jun 29 2005
00005     copyright            : (C) 2001 by Thies H. Jochimsen
00006     email                : jochimse@cns.mpg.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef SYSTEM_H
00019 #define SYSTEM_H
00020 
00021 #include <tjutils/tjhandler.h>
00022 
00023 #include <odinpara/jdxblock.h>
00024 #include <odinpara/jdxnumbers.h>
00025 #include <odinpara/jdxarrays.h>
00026 #include <odinpara/odinpara.h>
00027 
00028 
00029 // defaults for systemInfo
00030 #define _DEFAULT_B0_                  3000 // 3 Tesla
00031 #define _DEFAULT_MAX_SYSTEM_GRADIENT_ 0.04
00032 #define _DEFAULT_MAX_SYSTEM_SLEWRATE_ 0.2
00033 
00034 
00039 typedef enum odinPlatform {standalone=0, paravision, numaris_4, epic, numof_platforms};
00040 
00046 typedef enum objCategory {unknownObj=0,delayObj,pulsObj,gradObj,loopObj,acqObj,freqObj,syncObj,endObj};
00047 
00049 
00054 class Nuclei {
00055 
00056  public:
00057   Nuclei();
00058 
00062   double get_gamma(const STD_string& nucName) const;
00063 
00067   double get_nuc_freq(const STD_string& nucName,float B0) const;
00068 
00069 
00073   JDXenum get_nuc_enum() const;
00074 
00075  private:
00076   typedef STD_pair<STD_string, double> Nucleus;
00077   typedef STD_list<Nucleus> NucList; // do not use std::map since we do not want unsorted list
00078 
00079   NucList nuclist;
00080 };
00081 
00083 
00091 class System : public JcampDxBlock {
00092 
00093  public:
00094 
00098    System(const STD_string& object_label="unnamedSystem");
00099 
00103    System(const System& s) {System::operator = (s);}
00104 
00108   System& operator = (const System& s);
00109 
00113   odinPlatform get_platform() const;
00114 
00118   STD_string get_platform_str() const {return platformstr;}
00119 
00123   STD_string get_transmit_coil_name() const {return transmit_coil_name;}
00124 
00128   System& set_transmit_coil_name(const STD_string& tcname);
00129 
00133   STD_string get_main_nucleus() const {return main_nucleus;}
00134 
00138   System& set_main_nucleus(const STD_string& nucname);
00139 
00143   float get_max_grad() const {return max_grad;}
00144 
00148   float get_max_slew_rate() const {return max_slew_rate;}
00149 
00153   float get_grad_switch_time(float graddiff) const;
00154 
00158   float get_inter_grad_delay() const {return inter_grad_delay;}
00159 
00163   float get_inter_adc_delay() const {return inter_adc_delay;}
00164 
00165 
00169   System& set_scandir(const STD_string& dir);
00170 
00174   STD_string get_scandir() const;
00175 
00176 
00180   float get_grad_shift_delay() const {return grad_shift;}
00181 
00185   double get_B0() const {return B0;}
00186 
00191   System& set_B0_from_freq(double freq, const STD_string& nucName="");
00192 
00196   double get_gamma(const STD_string& nucName="") const;
00197 
00201   System& set_reference_gain(float refgain);
00202 
00206   float get_reference_gain() const {return reference_gain;}
00207 
00211   double get_nuc_freq(const STD_string& nucName="") const;
00212 
00213 
00217   JDXenum get_nuc_enum() const;
00218 
00222   double get_min_duration(objCategory c) const {return min_duration[c];}
00223 
00227   double get_min_grad_rastertime() const {return min_grad_rastertime;}
00228 
00232   double get_rastertime(objCategory cat) const;
00233 
00237   double get_rasteredtime(objCategory cat, double time) const;
00238 
00242   int get_max_rf_samples() const {return  max_rf_samples;}
00243 
00247   int get_max_grad_samples() const {return  max_grad_samples;}
00248 
00252   System& set_data_type(const STD_string& type) {datatype=type;  return *this;}
00253 
00257   STD_string get_data_type() const {return datatype;}
00258 
00259 
00260  private:
00261   friend class SeqMethod;
00262   friend class SeqIdea;
00263   friend class SeqParavision;
00264   friend class SeqStandAlone;
00265   friend class SeqEpic;
00266 
00267   // overwriting virtual functions from JcampDxClass
00268   int load(const STD_string &filename);
00269 
00270 
00271 
00272 
00273   int append_all_members();
00274 
00275   Nuclei nuc;
00276 
00277   JDXstring platformstr;
00278   JDXenum   main_nucleus;
00279   JDXdouble max_grad;
00280   JDXdouble max_slew_rate;
00281   JDXdouble grad_shift;
00282   JDXdouble inter_grad_delay;
00283   JDXdouble inter_adc_delay;
00284   JDXdouble B0;
00285   JDXdouble reference_gain;
00286   JDXstring transmit_coil_name;
00287 
00288   JDXdoubleArr min_duration;
00289   JDXdouble delay_rastertime;
00290   JDXdouble rf_rastertime;
00291   JDXdouble grad_rastertime;
00292   JDXdouble min_grad_rastertime;
00293   JDXdouble acq_rastertime;
00294 
00295   JDXint max_rf_samples;
00296   JDXint max_grad_samples;
00297 
00298   JDXstring scandir;
00299   JDXstring datatype;
00300 
00301 };
00302 
00303 
00305 
00311 class SystemInterface : public StaticHandler<SystemInterface> {
00312  public:
00313 
00314   SystemInterface()  {}
00315 
00316   System& operator *  () {return *get_sysinfo_ptr();}
00317   const System& operator * () const {return *get_const_sysinfo_ptr();}
00318 
00319   System* operator -> () {return get_sysinfo_ptr();}
00320   const System* operator -> () const {return get_const_sysinfo_ptr();}
00321 
00322   // functions to initialize/delete static members by the StaticHandler template class
00323   static void init_static();
00324   static void destroy_static();
00325 
00326   static void set_current_pf(odinPlatform pf);
00327 
00328   static odinPlatform get_current_pf() { // make it inline to speed up driver access
00329     if(current_pf) return odinPlatform(current_pf->operator int ());
00330 //    else STD_cerr << "ERROR: SystemInterface::get_current_pf: current_pf not yet initialized" << STD_endl;
00331     return odinPlatform(0);
00332   }
00333 
00334 
00335  private:
00336 //  friend class System;
00337   friend class SeqIdea;
00338   friend class SeqParavision;
00339   friend class SeqStandAlone;
00340   friend class SeqEpic;
00341 //  friend class SeqPlatformInstances;
00342 
00343 
00344   static System* get_sysinfo_ptr();
00345   static const System* get_const_sysinfo_ptr();
00346 
00347   // the actual platform
00348   static SingletonHandler<JDXint,false> current_pf;
00349 
00350   // separate systemInfo for each platform
00351   static SingletonHandler<System,false>* systemInfo_platform;
00352 };
00353 
00354 
00355 
00356 #endif

Generated on Sat Jun 14 12:31:22 2008 by  doxygen 1.5.1