20 #include <odinpara/ldrblock.h>
27 enum funcType {shapeFunc=0, trajFunc, filterFunc};
39 enum funcMode {zeroDeeMode=0,oneDeeMode,twoDeeMode,n_dimModes};
107 shape_info() : ref_x_pos(0), ref_y_pos(0), ref_z_pos(0), adiabatic(
false), fixed_size(-1), spatial_extent(0.0) {}
114 float spatial_extent;
121 traj_info() : rel_center(0), max_kspace_step(0) {}
124 float max_kspace_step;
130 class LDRfunctionPlugIn :
public LDRblock {
133 LDRfunctionPlugIn(
const STD_string& funclabel) :
LDRblock(funclabel) {}
135 LDRfunctionPlugIn(
const LDRfunctionPlugIn& jfp) :
LDRblock(jfp) {}
137 virtual ~LDRfunctionPlugIn() {}
139 LDRfunctionPlugIn& operator = (
const LDRfunctionPlugIn& jfp) {
LDRblock::operator = (jfp);
return *
this;}
141 LDRfunctionPlugIn& register_function(funcType type,
funcMode mode);
144 virtual void init_shape() {}
145 virtual STD_complex calculate_shape(
const kspace_coord& coord )
const {
return STD_complex(0.0);}
146 virtual STD_complex calculate_shape(
float s,
float Tp)
const {
return STD_complex(0.0);}
147 virtual const shape_info& get_shape_properties()
const {
return shape_info_retval;}
151 virtual void init_trajectory(
OdinPulse* pls) {}
152 virtual const kspace_coord& calculate_traj(
float s)
const {
return coord_retval;}
153 virtual const traj_info& get_traj_properties()
const {
return traj_info_retval;}
156 virtual float calculate_filter(
float rel_kradius)
const {
return 0;}
161 virtual LDRfunctionPlugIn* clone()
const = 0;
166 static shape_info shape_info_retval;
167 static traj_info traj_info_retval;
176 struct LDRfunctionEntry {
178 LDRfunctionEntry(LDRfunctionPlugIn* func_plugin, funcType func_type,
funcMode func_mode)
179 : plugin(func_plugin), type(func_type), mode(func_mode) {}
181 LDRfunctionPlugIn* plugin;
186 bool operator == (
const LDRfunctionEntry& jfe)
const;
187 bool operator < (
const LDRfunctionEntry& jfe)
const;
198 ~LDRfunction() {new_plugin(0);}
200 LDRfunction& set_function_mode(
funcMode newmode);
201 funcMode get_function_mode()
const {
return mode;}
203 const STD_string& get_function_label(
unsigned int index)
const;
204 LDRfunction& set_function(
const STD_string& funclabel);
205 LDRfunction& set_function(
unsigned int index);
206 unsigned int get_function_index()
const;
210 LDRfunction& set_funcpars(
const svector& funcpars);
211 LDRfunction& set_funcpars(
const STD_string& funcpars) {STD_string tt(funcpars); parsevalstring(tt);
return *
this;}
214 bool set_parameter(
const STD_string& parameter_label,
const STD_string& value);
215 STD_string get_parameter(
const STD_string& parameter_label)
const;
217 STD_string get_function_name()
const;
219 const STD_string& get_funcdescription()
const;
223 LDRfunction* cast(LDRfunction*) {
return this;}
224 bool parsevalstring(
const STD_string& parstring,
const LDRserBase* ser=0);
225 STD_string printvalstring(
const LDRserBase* ser=0)
const;
226 svector get_alternatives()
const;
227 STD_string get_typeInfo(
bool parx_equivtype=
false)
const {
return "function";}
228 LDRbase* create_copy()
const {
return new LDRfunction(*
this);}
232 static void init_static();
233 static void destroy_static();
239 LDRfunction(funcType function_type,
const STD_string& ldrlabel);
240 LDRfunction(
const LDRfunction& jf);
241 LDRfunction& operator = (
const LDRfunction& jf);
244 LDRfunctionPlugIn* allocated_function;
247 friend class LDRfunctionPlugIn;
252 void new_plugin(LDRfunctionPlugIn* pi);
257 static STD_list<LDRfunctionEntry>* registered_functions;
LDRblock & operator=(const LDRblock &block)
bool operator==(const TinyVector< T, N_rank > &t1, const TinyVector< T, N_rank > &t2)
bool operator<(const STD_complex &c1, const STD_complex &c2)