JEMRIS  2.8.1
open-source MRI simulations
OutputSequenceData.h
Go to the documentation of this file.
1 
5 #ifndef OUTPUTSEQUENCEDATA_H_
6 #define OUTPUTSEQUENCEDATA_H_
7 
8 #include "Event.h"
9 #include "Declarations.h"
10 
11 #include <vector>
12 #include <map>
13 
21 class SeqBlock
22 {
23 public:
27  enum EventCode {
28  DELAY,
29  RF,
30  XGRAD,
31  YGRAD,
32  ZGRAD,
33  ADC
34  };
35 
39  static const int NUM_EVENTS = (ADC+1);
40 
44  SeqBlock(){ for (int i=0; i<NUM_EVENTS; i++) events[i]=0; }
45 
53  int events[NUM_EVENTS]; // DELAY RF X Y Z ADC
54 
55 };
56 
78 {
86  {
87  public:
93  bool operator==(const CompressedShape &other) const {
94  if (this->m_num_uncompressed_samples!=other.m_num_uncompressed_samples) return false;
95  if (this->m_samples.size()!=other.m_samples.size()) return false;
96  for (int i=0; i<this->m_samples.size(); i++) {
97  if (this->m_samples[i]!=other.m_samples[i]) return false;
98  }
99  return true;
100  }
101 
103  std::vector<double> m_samples;
104  };
105 
106  public:
107 
111  OutputSequenceData () : m_duration(0.0) {
112  SetRotationMatrix(0.0,0.0,0.0);
113  };
114 
119 
126  void AddEvents(std::vector<Event*> &events, double duration=0.0);
127 
138  void SetRotationMatrix(double alpha, double theta, double phi);
139 
143  void SetDefinitions(std::map<std::string,std::string> &defs) {m_definitions=defs; };
144 
148  void WriteFiles(const std::string &outDir, const std::string &outFile);
149 
150  private:
154  template<typename T> int SearchLibrary(std::vector<T> &library, T &obj);
155 
159  void CompressShape(std::vector<double> &shape, CompressedShape *out);
160 
161 
162  double m_rot_matrix[3][3];
163  double m_duration;
165  std::map<std::string,std::string> m_definitions;
167  std::vector<SeqBlock> m_blocks;
169  std::vector<DelayEvent> m_delay_library;
170  std::vector<RFEvent> m_rf_library;
171  std::vector<GradEvent> m_grad_library;
172  std::vector<ADCEvent> m_adc_library;
174  std::vector<CompressedShape> m_shape_library;
176 };
177 
178 #endif /*OUTPUTSEQUENCEDATA_H_*/
Implementation of JEMRIS Declarations.
Maintain libraries of hardware events and write sequence file.
Definition: OutputSequenceData.h:77
std::vector< DelayEvent > m_delay_library
Library of delay events.
Definition: OutputSequenceData.h:169
std::vector< CompressedShape > m_shape_library
Library of compressed shapes (referenced by events)
Definition: OutputSequenceData.h:174
SeqBlock()
Constructor.
Definition: OutputSequenceData.h:44
std::vector< GradEvent > m_grad_library
Library of gradient events.
Definition: OutputSequenceData.h:171
~OutputSequenceData()
Default destructor.
Definition: OutputSequenceData.h:118
Sequence block for execution on hardware.
Definition: OutputSequenceData.h:21
OutputSequenceData()
Default constructor.
Definition: OutputSequenceData.h:111
double m_duration
Total duration of sequence blocks.
Definition: OutputSequenceData.h:163
int events[NUM_EVENTS]
List of event IDs.
Definition: OutputSequenceData.h:53
std::vector< double > m_samples
The compressed waveform samples.
Definition: OutputSequenceData.h:103
int m_num_uncompressed_samples
Number of samples of the uncompressed waveforms.
Definition: OutputSequenceData.h:102
void SetDefinitions(std::map< std::string, std::string > &defs)
Set custom scan definitions.
Definition: OutputSequenceData.h:143
bool operator==(const CompressedShape &other) const
Compare two compressed shapes.
Definition: OutputSequenceData.h:93
std::vector< SeqBlock > m_blocks
List of sequence blocks.
Definition: OutputSequenceData.h:167
Implementation of JEMRIS sequence Event for hardware execution.
std::vector< RFEvent > m_rf_library
Library of RF events.
Definition: OutputSequenceData.h:170
Compressed shape object.
Definition: OutputSequenceData.h:85
EventCode
Open file format event order.
Definition: OutputSequenceData.h:27
static const int NUM_EVENTS
Number of event types per sequence block.
Definition: OutputSequenceData.h:39
std::vector< ADCEvent > m_adc_library
Library of ADC events.
Definition: OutputSequenceData.h:172
std::map< std::string, std::string > m_definitions
Custom definitions for user-specific purposes to be output in file.
Definition: OutputSequenceData.h:165

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