/usr/include/odinpara/jdxfunction.h is in libodin-dev 1.8.8-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | /***************************************************************************
jdxfunction.h - description
-------------------
begin : Mon Jun 24 2002
copyright : (C) 2000-2014 by Thies H. Jochimsen
email : thies@jochimsen.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef JDXFUNCTION_H
#define JDXFUNCTION_H
#include <odinpara/jdxblock.h>
/**
* @addtogroup jcampdx
* @{
*/
enum funcType {shapeFunc=0, trajFunc, filterFunc};
/**
*
* Dimension Mode Enum:
*
* - zeroDeeMode : Only RF waveform will be calculated
* - oneDeeMode : RF and gradient shape will be calculated according
* to the selected shape/trajectory for 1D pulses
* - twoDeeMode : RF and gradient shape will be calculated according
* to the selected shape/trajectory for 2D pulses
*/
enum funcMode {zeroDeeMode=0,oneDeeMode,twoDeeMode,n_dimModes};
///////////////////////////////////////////
class OdinPulse; // forward declaration
///////////////////////////////////////////
/**
*
* Structure to return k-space coordinates, gradient strengts and sampling density
* compensations of trajectories.
*/
struct kspace_coord {
kspace_coord() : index(-1), traj_s(0.0), kx(0), ky(0), kz(0), Gx(0), Gy(0), Gz(0), denscomp(1.0) {}
/**
* The current index in the array
*/
mutable int index;
/**
* The dimension-less time parameter which will be used for the shape and filter, ranging from 0 to 1
*/
float traj_s;
/**
* The dimension-less x-coordinate in k-space, ranging from -1 to 1
*/
float kx;
/**
* The dimension-less y-coordinate in k-space, ranging from -1 to 1
*/
float ky;
/**
* The dimension-less z-coordinate in k-space, ranging from -1 to 1
*/
float kz;
/**
* The dimension-less x-gradient, i.e. the derivative of kx by s (the dimension-less time parameter)
*/
float Gx;
/**
* The dimension-less y-gradient, i.e. the derivative of kx by s (the dimension-less time parameter)
*/
float Gy;
/**
* The dimension-less z-gradient, i.e. the derivative of kx by s (the dimension-less time parameter)
*/
float Gz;
/**
* Compensation for differing sampling density, RF shape or RF signal will be multiplied by this function
*/
float denscomp;
};
///////////////////////////////////////////
struct shape_info {
shape_info() : ref_x_pos(0), ref_y_pos(0), ref_z_pos(0), adiabatic(false), fixed_size(-1), spatial_extent(0.0) {}
float ref_x_pos; // Reference position to adjust flip angle
float ref_y_pos;
float ref_z_pos;
bool adiabatic; // Whether pulse is adiabatic
int fixed_size; // Pulse has fixed size (for imported pulses)
float spatial_extent;
};
///////////////////////////////////////////
struct traj_info {
traj_info() : rel_center(0), max_kspace_step(0) {}
float rel_center;
float max_kspace_step;
};
///////////////////////////////////////////
class JDXfunctionPlugIn : public JcampDxBlock {
public:
JDXfunctionPlugIn(const STD_string& funclabel) : JcampDxBlock(funclabel) {}
JDXfunctionPlugIn(const JDXfunctionPlugIn& jfp) : JcampDxBlock(jfp) {}
virtual ~JDXfunctionPlugIn() {}
JDXfunctionPlugIn& operator = (const JDXfunctionPlugIn& jfp) {JcampDxBlock::operator = (jfp); return *this;}
JDXfunctionPlugIn& register_function(funcType type, funcMode mode);
// virtual functions for pulse shapes
virtual void init_shape() {}
virtual STD_complex calculate_shape(const kspace_coord& coord ) const {return STD_complex(0.0);}
virtual STD_complex calculate_shape(float s, float Tp) const {return STD_complex(0.0);}
virtual const shape_info& get_shape_properties() const {return shape_info_retval;}
// virtual functions for pulse trajectories
virtual void init_trajectory(OdinPulse* pls) {}
virtual const kspace_coord& calculate_traj(float s) const {return coord_retval;}
virtual const traj_info& get_traj_properties() const {return traj_info_retval;}
// virtual functions for filters
virtual float calculate_filter(float rel_kradius) const {return 0;}
// virtual constructor
virtual JDXfunctionPlugIn* clone() const = 0;
// local statics do not work on IDEA
static kspace_coord coord_retval;
// static shape_vals shape_retval;
static shape_info shape_info_retval;
static traj_info traj_info_retval;
};
///////////////////////////////////////////
// Wrapper to bundle JDXfunctionPlugIn and funcType/funcMode together so it can be inserted into lists
// multiple times with different funcTypes and funcModes
struct JDXfunctionEntry {
JDXfunctionEntry(JDXfunctionPlugIn* func_plugin, funcType func_type, funcMode func_mode)
: plugin(func_plugin), type(func_type), mode(func_mode) {}
JDXfunctionPlugIn* plugin;
const funcType type;
const funcMode mode;
bool operator == (const JDXfunctionEntry& jfe) const;
bool operator < (const JDXfunctionEntry& jfe) const;
};
///////////////////////////////////////////
class JDXfunction : public JcampDxClass, public StaticHandler<JDXfunction> {
public:
~JDXfunction() {new_plugin(0);}
JDXfunction& set_function_mode(funcMode newmode);
funcMode get_function_mode() const {return mode;}
const STD_string& get_function_label(unsigned int index) const;
JDXfunction& set_function(const STD_string& funclabel);
JDXfunction& set_function(unsigned int index);
unsigned int get_function_index() const;
JcampDxBlock* get_funcpars_block();
JDXfunction& set_funcpars(const svector& funcpars);
JDXfunction& set_funcpars(const STD_string& funcpars) {STD_string tt(funcpars); parsevalstring(tt); return *this;}
svector get_funcpars() const;
bool set_parameter(const STD_string& parameter_label, const STD_string& value);
STD_string get_parameter(const STD_string& parameter_label) const;
STD_string get_function_name() const;
const STD_string& get_funcdescription() const;
// overwriting virtual functions from JcampDxClass
JDXfunction* cast(JDXfunction*) {return this;}
bool parsevalstring (const STD_string& parstring);
STD_string printvalstring() const;
svector get_alternatives() const;
const char* get_typeInfo() const {return "function";}
JcampDxClass* create_copy() const {return new JDXfunction(*this);}
// stuff for StaticHandler
static void init_static();
static void destroy_static();
protected:
// Make it impossible to create/use instance of JDXfunction directly
JDXfunction(funcType function_type, const STD_string& jdxlabel);
JDXfunction(const JDXfunction& jf);
JDXfunction& operator = (const JDXfunction& jf);
funcMode mode;
JDXfunctionPlugIn* allocated_function;
private:
friend class JDXfunctionPlugIn;
void new_plugin(JDXfunctionPlugIn* pi);
const funcType type;
static STD_list<JDXfunctionEntry>* registered_functions;
};
/** @}
*/
#endif
|