JEMRIS  2.8.1
open-source MRI simulations
Module.h
Go to the documentation of this file.
1 
5 /*
6  * JEMRIS Copyright (C)
7  * 2006-2015 Tony Stoecker
8  * 2007-2015 Kaveh Vahedipour
9  * 2009-2015 Daniel Pflugfelder
10  *
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25  */
26 
27 #ifndef MODULE_H_
28 #define MODULE_H_
29 
30 
31 #include "Prototype.h"
32 
33 // Declaration to avoid inclusion of the header resulting in circular referentation
34 class SequenceTree;
35 class Parameters;
36 class ConcatSequence;
37 
38 
40 
41 class Module : public Prototype {
42 
43  public:
44 
50  Module ();
51 
57  virtual ~Module () {};
58 
64  Module (const Module&);
65 
71  virtual Module* Clone() const = 0;
72 
84  virtual void GetValue (double * dAllVal, double const time) {};
85 
86  /*
87  * @brief Get values for available Transmit coils for simulation only.
88  *
89  * Get the values for each Transmit channel in this atomic sequence. And
90  * return the in dAllVal.
91  *
92  * @param dAllVal represents the pointer to array where results are returned.
93  * @param time represents the time of invocation.
94  * @param pos represents the position in x, y, z.
95  */
96  //virtual void GetValue (double * dAllVal, double const time, double * pos[3]) {};
97 
106  virtual bool Prepare (const PrepareMode mode);
107 
108 
118  void Initialize (DOMNode* node );
119 
125  Module* GetParent ();
126 
132  virtual double GetDuration () = 0;
133 
139  virtual int GetNumOfTPOIs () { return m_tpoi.GetSize(); };
140 
146  vector<Module*> GetChildren () const;
147 
153  Module* GetChild (unsigned int position) const;
154 
160  int GetNumberOfChildren () const;
161 
168  bool InsertChild (const string& name);
169 
170  virtual Module* GetPrototypeByAttributeValue (string name, string attrib);
171 
179  bool AddDOMattribute (const string attribute, const string value);
180 
184  void AddAllDOMattributes (bool show_hidden = true);
185 
191  virtual TPOI* GetTPOIs () { return &m_tpoi; }
192 
201  void DumpTree (const string& file="", Module* mod=NULL, int ichild = 0, int level = 0) ;
202 
208  int GetDepth (int depth = 0) ;
209 
228  int GetHardwareMode () { return m_hardware_mode; }
229 
236  bool WriteStaticXML(const string& xml_file);
237 
247  bool StaticDOM(DOMDocument* doc, DOMNode* node, bool append = true);
248 
249 
250  void SetSeqTree (SequenceTree* pST) { m_seq_tree= pST; };
251  SequenceTree* GetSeqTree ( ) { return m_seq_tree;};
252 
253 
254  protected:
255 
261  virtual string GetInfo () { return ""; };
262 
267  string m_info;
268  double m_duration;
269  int m_calls;
272  private:
273 
274 
275 };
276 
277 #endif
virtual Module * Clone() const =0
Clone a module.
bool WriteStaticXML(const string &xml_file)
Rewrite XML-tree where all expressions are evaluated (for IDEA)
Definition: Module.cpp:378
int m_calls
Number of calls of this module.
Definition: Module.h:269
TPOI m_tpoi
Time points of interest are stored the referred repository.
Definition: Module.h:265
void DumpTree(const string &file="", Module *mod=NULL, int ichild=0, int level=0)
Dump the sequence tree.
Definition: Module.cpp:272
Implementation of JEMRIS Prototype.
virtual ~Module()
Destructor.
Definition: Module.h:57
string m_info
Information string for this module.
Definition: Module.h:267
Concat sequence prototype.
Definition: ConcatSequence.h:37
Parameters * m_parameters
Pointer to the sole instance of the Parameters.
Definition: Module.h:264
SequenceTree * m_seq_tree
Reference to the sequence tree.
Definition: Module.h:261
int GetDepth(int depth=0)
Return tree depth from this module (including depth of Containers)
Definition: Module.cpp:249
virtual string GetInfo()
Get informations on this module.
Definition: Module.h:261
bool AddDOMattribute(const string attribute, const string value)
Add attribute and value to the DOM node of this module.
Definition: Module.cpp:134
World parameters provide the parametric data of the sequence.
Definition: Parameters.h:37
int m_hardware_mode
Hardware mode (-1: simulation only; 0: both; 1: hardware only)
Definition: Module.h:270
double m_duration
The duration of this module.
Definition: Module.h:268
void AddAllDOMattributes(bool show_hidden=true)
Definition: Module.cpp:146
vector< Module * > GetChildren() const
Get Children.
Definition: Module.cpp:90
Definition: TPOI.h:60
virtual Module * GetPrototypeByAttributeValue(string name, string attrib)
Get a Prototype by value of an attribute.
Definition: Module.cpp:77
Module * GetParent()
Get Parent.
Definition: Module.cpp:82
Prototype super class.
Definition: Prototype.h:71
int GetNumberOfChildren() const
Get number of Children.
Definition: Module.cpp:106
Module super class! ABC for all Objects in the sequence framework.
Definition: Module.h:41
mode
Definition: Declarations.h:112
virtual bool Prepare(const PrepareMode mode)
Prepare this pulse.
Definition: Module.cpp:66
int GetSize() const
Definition: TPOI.cpp:57
Tree representation of the sequence.
Definition: SequenceTree.h:45
virtual int GetNumOfTPOIs()
Get the Number of TPOIs of this module.
Definition: Module.h:139
virtual double GetDuration()=0
Module * GetChild(unsigned int position) const
Get Child.
Definition: Module.cpp:98
virtual void GetValue(double *dAllVal, double const time)
Get the value of this element.
Definition: Module.h:84
int GetHardwareMode()
Return the hardware mode of this module.
Definition: Module.h:228
void Initialize(DOMNode *node)
Initialize this module.
Definition: Module.cpp:47
Module()
Constructor.
Definition: Module.cpp:36
bool InsertChild(const string &name)
Insert Child.
Definition: Module.cpp:114
bool StaticDOM(DOMDocument *doc, DOMNode *node, bool append=true)
Create a DOM tree where all expressions are evaluated (for IDEA)
Definition: Module.cpp:414
virtual TPOI * GetTPOIs()
get the TPOIs of this module
Definition: Module.h:191

-- last change 17.06.2016 | Tony Stoecker | Imprint --