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

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