JEMRIS  2.8.1
open-source MRI simulations
Event.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 EVENT_H_
28 #define EVENT_H_
29 
30 #include "Declarations.h"
31 #include <vector>
32 
36 class Event
37 {
38 public:
42  Event(){};
43 
47  virtual ~Event(){};
54  virtual bool operator==(const Event &other) const { return false; };
55 
56 };
57 
63 class DelayEvent : public Event
64 {
65 public:
70  bool operator==(const DelayEvent &other) const {
71  return (this->m_delay==other.m_delay);
72  }
73 public:
74  double m_delay;
75 };
76 
85 class RFEvent : public Event
86 {
87 public:
92  bool operator==(const RFEvent &other) const {
93  return (this->m_amplitude==other.m_amplitude && this->m_mag_shape==other.m_mag_shape && this->m_phase_shape==other.m_phase_shape &&
94  this->m_freq_offset==other.m_freq_offset && this->m_phase_offset==other.m_phase_offset);
95  }
96 public:
97  double m_amplitude;
100  double m_freq_offset;
101  double m_phase_offset;
102  std::vector<double> m_magnitude;
103  std::vector<double> m_phase;
104 };
105 
114 class GradEvent : public Event
115 {
116 public:
121  bool operator==(const GradEvent &other) const {
122  bool ok;
123  if (this->m_shape>=0) // Arbitrary gradient
124  ok = (this->m_shape==other.m_shape);
125  else // Trapezoidal gradient
126  ok = (this->m_ramp_up_time==other.m_ramp_up_time && this->m_flat_time==other.m_flat_time && this->m_ramp_down_time==other.m_ramp_down_time);
127  return (ok && this->m_amplitude==other.m_amplitude && this->m_channel==other.m_channel);
128  }
129 public:
130  int m_channel;
131  double m_amplitude;
132  // Trapezoid:
134  long m_flat_time;
137  // Arbitrary:
138  int m_shape;
139  std::vector<double> m_samples;
140 };
141 
142 
152 class ADCEvent : public Event
153 {
154 public:
159  bool operator==(const ADCEvent &other) const {
160  return (this->m_num_samples==other.m_num_samples && this->m_dwell_time==other.m_dwell_time && this->m_delay==other.m_delay &&
161  this->m_freq_offset==other.m_freq_offset && this->m_phase_offset==other.m_phase_offset);
162  }
163 public:
166  int m_delay;
167  double m_freq_offset;
168  double m_phase_offset;
169 };
170 
171 
172 #endif /*EVENT_H_*/
virtual bool operator==(const Event &other) const
Compare two hardware events.
Definition: Event.h:54
Implementation of JEMRIS Declarations.
int m_shape
ID of gradient waveform (0 if trapezoid)
Definition: Event.h:138
bool operator==(const ADCEvent &other) const
Compare ADC events.
Definition: Event.h:159
int m_num_samples
Number of samples.
Definition: Event.h:164
double m_delay
delay (us)
Definition: Event.h:74
std::vector< double > m_samples
samples of gradient waveform
Definition: Event.h:139
long m_ramp_up_time
Ramp up time (us)
Definition: Event.h:133
int m_channel
Channel (0, 1 or 2 for X,Y,Z)
Definition: Event.h:130
int m_phase_shape
ID of phase shape (set by OutputSequenceData)
Definition: Event.h:99
double m_phase_offset
Phase offset of receiver (rad)
Definition: Event.h:168
int m_mag_shape
ID of magnitude shape (set by OutputSequenceData)
Definition: Event.h:98
int m_dwell_time
Dwell time (ns)
Definition: Event.h:165
double m_freq_offset
Frequency offset (rad/ms)
Definition: Event.h:100
bool operator==(const RFEvent &other) const
Compare two RF events.
Definition: Event.h:92
bool operator==(const GradEvent &other) const
Compare two gradient events.
Definition: Event.h:121
bool operator==(const DelayEvent &other) const
Compare two delay events.
Definition: Event.h:70
long m_flat_time
Flat-top time (us)
Definition: Event.h:134
int m_delay
Initial delay (us)
Definition: Event.h:166
RF hardware event.
Definition: Event.h:85
virtual ~Event()
Default destructor.
Definition: Event.h:47
Gradient hardware event.
Definition: Event.h:114
ADC hardware event.
Definition: Event.h:152
std::vector< double > m_phase
Phase waveform samples.
Definition: Event.h:103
double m_amplitude
Amplitude (rad/ms/mm)
Definition: Event.h:131
Delay hardware event.
Definition: Event.h:63
double m_freq_offset
Frequency offset of receiver (rad/ms)
Definition: Event.h:167
Event()
Default constructor.
Definition: Event.h:42
Base class for hardware events.
Definition: Event.h:36
long m_ramp_down_time
Ramp down time (us)
Definition: Event.h:135
std::vector< double > m_magnitude
Magnitude waveform samples.
Definition: Event.h:102
double m_amplitude
Amplitude (rad/ms)
Definition: Event.h:97
double m_phase_offset
Phase offset (rad)
Definition: Event.h:101

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