JEMRIS 2.9.1
open-source MRI simulations
Loading...
Searching...
No Matches
TPOI.h
Go to the documentation of this file.
1
5/*
6 * JEMRIS Copyright (C)
7 * 2006-2023 Tony Stoecker
8 * 2007-2018 Kaveh Vahedipour
9 * 2009-2019 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 TPOI_H_
28#define TPOI_H_
29
30#include <cstdlib>
31#include <vector>
32#include <ostream>
33#include <iostream>
34#include <bitset>
35#include <cmath>
36
37using namespace std;
38
39#include "Declarations.h"
40
41//const double TIME_ERR_TOL = 1e-6; // Avoid CVODE warnings. Doesn't affect physics.
42
44
45template<class T> inline T BIT (const T& x) { return T(1) << x; }
46
47//static const size_t JTPOI_T (0); //standard JEMRIS TPOI (never used!?)
48static const size_t ADC_T (0); // 1 : ADC
49static const size_t ADC_IMG_T (1); // 2 : an imaging ADC (for ismrmrd output)
50static const size_t ADC_ACS_T (2); // 4 : auto-calibration scan (for ismrmrd output)
51static const size_t ADC_PC_T (3); // 8 : phase correction scan (for ismrmrd output)
52static const size_t ADC_NOISE_T (4); // 16 : noise scan (for ismrmrd output)
53static const size_t EXCITE_T (5); // 32 : excitation pulse
54static const size_t REFOCUS_T (6); // 64 : refocusing pulse
55
56template<class T, class S> inline bool check_bit (const T& x, const S& y) { return 0 != (x & BIT(y)); }
57
58template<class T, class S> inline void set_bit (T& x, const S& y) { x |= T(1) << y; }
59
60
61class TPOI {
62
63 public:
64
66 struct set {
67
68
69 double dtime;
70 double dphase;
71 size_t bmask;
79 inline set (const double time, const double phase = -1., const size_t mask = 0) : dtime(time), dphase (phase), bmask(mask) {}
80
81 };
82
89 TPOI() {
90 // Reset my data repository
91 Reset();
92 };
93
94
98 void Reset () {
99 // Set position back to first slot and values to zero
100 m_time.clear();
101 m_phase.clear();
102 m_mask.clear();
103 }
104
110 ~TPOI() {}
111
112
120 void operator += (const TPOI& tpoi);
121
130 TPOI& operator + (const TPOI& tpoi);
131
138 void operator + (const set& data);
139
145 int GetSize () const ;
146
147
148 void Print () const ;
149
150 void PrintMeta (const size_t pos) const ;
151
158 inline double GetTime (const size_t pos) const {return m_time[pos]; }
159
166 inline double GetPhase (const size_t pos) const {return m_phase[pos]; }
167
168 bool IsADC (const size_t pos) const {return check_bit (m_mask[pos], ADC_T); }
169 bool IsImg (const size_t pos) const {return check_bit (m_mask[pos], ADC_IMG_T); }
170 bool IsACS (const size_t pos) const {return check_bit (m_mask[pos], ADC_ACS_T); }
171 bool IsPC (const size_t pos) const {return check_bit (m_mask[pos], ADC_PC_T); }
172 bool IsNoise (const size_t pos) const {return check_bit (m_mask[pos], ADC_NOISE_T); }
173 bool IsExcitation (const size_t pos) const {return check_bit (m_mask[pos], EXCITE_T); }
174 bool IsRefocussing (const size_t pos) const {return check_bit (m_mask[pos], REFOCUS_T); }
175
176 inline size_t GetMask (const size_t pos) const {return m_mask[pos];}
177
181 void Sort ();
182
186 void Purge ();
187
188 private:
189
190 vector<double> m_time;
191 vector<double> m_phase;
192 vector<size_t> m_mask;
194};
195
196
197
198
199#endif
Implementation of JEMRIS Declarations.
T BIT(const T &x)
bitmask for JEMRIS TPOIs (Time points of interest of all modules)
Definition: TPOI.h:45
Definition: TPOI.h:61
void Sort()
Definition: TPOI.cpp:63
void Purge()
Definition: TPOI.cpp:105
vector< size_t > m_mask
Definition: TPOI.h:192
TPOI & operator+(const TPOI &tpoi)
Definition: TPOI.cpp:40
~TPOI()
Definition: TPOI.h:110
void operator+=(const TPOI &tpoi)
Definition: TPOI.cpp:31
double GetPhase(const size_t pos) const
Definition: TPOI.h:166
int GetSize() const
Definition: TPOI.cpp:57
TPOI()
Definition: TPOI.h:89
vector< double > m_phase
Definition: TPOI.h:191
double GetTime(const size_t pos) const
Definition: TPOI.h:158
vector< double > m_time
Definition: TPOI.h:190
void Reset()
Definition: TPOI.h:98
The set of data of each time point of interest.
Definition: TPOI.h:66
double dphase
Definition: TPOI.h:70
set(const double time, const double phase=-1., const size_t mask=0)
Constructor.
Definition: TPOI.h:79
size_t bmask
Definition: TPOI.h:71
double dtime
Definition: TPOI.h:69

-- last change 03.10.2023 | Tony Stoecker | Imprint | Data Protection --