ODIN
sample.h
1 /***************************************************************************
2  sample.h - description
3  -------------------
4  begin : Mon Jul 11 2005
5  copyright : (C) 2000-2021 by Thies H. Jochimsen
6  email : thies@jochimsen.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef SAMPLE_H
19 #define SAMPLE_H
20 
21 #include <odinpara/ldrblock.h>
22 #include <odinpara/ldrnumbers.h>
23 #include <odinpara/ldrarrays.h>
24 #include <odinpara/odinpara.h>
25 
41 enum sampleDim { frameDim=0, freqDim, zDim, yDim, xDim, n_sampleDim };
42 
43 
45 
46 
55 class Sample : public LDRblock {
56 
57  public:
58 
64  Sample(const STD_string& label="unnamedSample", bool uniformFOV=true, bool uniformT1T2=false);
65 
69  Sample(const Sample& ss);
70 
74  Sample& operator = (const Sample& ss);
75 
79  Sample& set_FOV(float fov);
80 
84  Sample& set_FOV(axis direction, float fov);
85 
89  float get_FOV(axis direction) const;
90 
94  Sample& set_spatial_offset(axis direction, float offs) {offset[direction]=offs; return *this;}
95 
99  float get_spatial_offset(axis direction) const {return offset[direction];}
100 
104  Sample& set_freqrange(float range) {freqrange=range; return *this;}
105 
109  float get_freqrange() const {return freqrange;}
110 
114  Sample& set_freqoffset(float offs) {freqoffset=offs; return *this;}
115 
119  float get_freqoffset() const {return freqoffset;}
120 
121 
127  Sample& set_frame_durations(const dvector& intervals) {frameDurations=intervals; return *this;}
128 
132  const dvector& get_frame_durations() const {return frameDurations;}
133 
134 
143  Sample& resize(unsigned int framesize, unsigned int freqsize, unsigned int zsize, unsigned int ysize, unsigned int xsize);
144 
148  const ndim& get_extent() const {return spinDensity.get_extent();}
149 
153  Sample& set_T1(float relaxation_time) {T1=relaxation_time; haveT1map=false; return *this;}
154 
158  Sample& set_T2(float relaxation_time) {T2=relaxation_time; haveT2map=false; return *this;}
159 
163  Sample& set_T1map(const farray& t1map);
164 
168  const farray& get_T1map() const;
169 
173  Sample& set_T2map(const farray& t2map);
174 
178  const farray& get_T2map() const;
179 
183  Sample& set_ppmMap(const farray& ppmmap);
184 
188  const farray& get_ppmMap() const;
189 
194 
198  const farray& get_spinDensity() const;
199 
203  Sample& set_DcoeffMap(const farray& dmap);
204 
208  const farray& get_DcoeffMap() const;
209 
214 
215 
216  // overwriting virtual functions from LDRbase
217  int load(const STD_string& filename, const LDRserBase& serializer=LDRserJDX());
218 
219 
220  private:
221  friend class SeqSimMagsi;
222 
223  int append_all_members();
224 
225  bool check_and_correct(const char* mapname, const farray& srcmap, farray& dstmap);
226 
227 
228  LDRfloat FOVall;
229  LDRtriple FOV;
230  bool uniFOV;
231  LDRtriple offset;
232 
233  LDRfloat freqrange;
234  LDRfloat freqoffset;
235 
236  LDRdoubleArr frameDurations;
237 
238  mutable LDRfloatArr spinDensity;
239 
240  bool uniT1T2;
241  LDRfloat T1;
242  LDRfloat T2;
243  mutable LDRfloatArr T1map;
244  mutable LDRfloatArr T2map;
245  mutable bool haveT1map;
246  mutable bool haveT2map;
247 
248  mutable LDRfloatArr ppmMap;
249  mutable bool have_ppmMap;
250 
251  mutable LDRfloatArr DcoeffMap;
252  mutable bool have_DcoeffMap;
253 
254 };
255 
256 
260 #endif
Virtual Sample for Simulation.
Definition: sample.h:55
Sample(const STD_string &label="unnamedSample", bool uniformFOV=true, bool uniformT1T2=false)
Sample & set_frame_durations(const dvector &intervals)
Definition: sample.h:127
Sample & set_FOV(float fov)
Sample & set_FOV(axis direction, float fov)
Sample & update()
const farray & get_ppmMap() const
const dvector & get_frame_durations() const
Definition: sample.h:132
Sample & set_ppmMap(const farray &ppmmap)
Sample & resize(unsigned int framesize, unsigned int freqsize, unsigned int zsize, unsigned int ysize, unsigned int xsize)
Sample & set_freqoffset(float offs)
Definition: sample.h:114
int load(const STD_string &filename, const LDRserBase &serializer=LDRserJDX())
Sample & set_T2map(const farray &t2map)
Sample & set_T1map(const farray &t1map)
const ndim & get_extent() const
Definition: sample.h:148
const farray & get_spinDensity() const
Sample & set_freqrange(float range)
Definition: sample.h:104
Sample(const Sample &ss)
const farray & get_T1map() const
Sample & set_spatial_offset(axis direction, float offs)
Definition: sample.h:94
float get_FOV(axis direction) const
float get_spatial_offset(axis direction) const
Definition: sample.h:99
Sample & set_spinDensity(const farray &sd)
const farray & get_DcoeffMap() const
float get_freqoffset() const
Definition: sample.h:119
Sample & operator=(const Sample &ss)
float get_freqrange() const
Definition: sample.h:109
const farray & get_T2map() const
Sample & set_T1(float relaxation_time)
Definition: sample.h:153
Sample & set_DcoeffMap(const farray &dmap)
Sample & set_T2(float relaxation_time)
Definition: sample.h:158
MAGSI-based Magnetization Simulator.
Definition: seqsim.h:113
Definition: tjarray.h:41
const ndim & get_extent() const
sampleDim
Definition: sample.h:41
direction
Definition: odinpara.h:41
axis
Definition: odinpara.h:51