54#define XSH_UTL_IMA_SHIFT_RECIPE_ID "xsh_util_ima_shift"
55#define XSH_UTL_IMA_SHIFT_RECIPE_AUTHOR "A.Modigliani"
56#define XSH_UTL_IMA_SHIFT_RECIPE_CONTACT "Andrea.Modigliani@eso.org"
57#define PRO_IMA "PRO_IMA"
58#define KEY_VALUE_HPRO_DID "PRO-1.15"
75 "This recipe performs image shift along x or y.\n"
76 "The input file is an image tagged as 'IMA'.\n"
77 "The output is a shifted image\n"
78 "xsh.xsh_util_ima_shift.shiftx having alias 'shiftx'\n"
79 "xsh.xsh_util_ima_shift.shifty having alias 'shifty'\n"
80 "Information on relevant parameters can be found with\n"
81 "esorex --params xsh_util_ima_shift\n"
82 "esorex --help xsh_util_ima_shift\n"
107 cpl_recipe * recipe = cpl_calloc(1,
sizeof *recipe ) ;
108 cpl_plugin * plugin = &recipe->interface ;
110 cpl_plugin_init(plugin,
113 CPL_PLUGIN_TYPE_RECIPE,
124 cpl_pluginlist_append(list, plugin) ;
141 cpl_recipe * recipe ;
148 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
149 recipe = (cpl_recipe *)plugin ;
155 recipe->parameters = cpl_parameterlist_new() ;
160 recipe->parameters ) ) ;
163 p = cpl_parameter_new_value(
"xsh.xsh_util_ima_shift.shiftx",
165 "A possible X shift",
166 "xsh.xsh_util_ima_shiftx",0);
167 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"shiftx") ;
168 cpl_parameterlist_append(recipe->parameters, p) ;
170 p = cpl_parameter_new_value(
"xsh.xsh_util_ima_shift.shifty",
172 "A possible Y shift",
173 "xsh.xsh_util_ima_shifty",0);
174 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI,
"shifty") ;
175 cpl_parameterlist_append(recipe->parameters, p) ;
192 cpl_recipe * recipe ;
194 cpl_errorstate initial_errorstate = cpl_errorstate_get();
197 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
198 recipe = (cpl_recipe *)plugin ;
205 if (!cpl_errorstate_is_equal(initial_errorstate)) {
208 cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL);
223 cpl_recipe * recipe ;
226 if (cpl_plugin_get_type(plugin) == CPL_PLUGIN_TYPE_RECIPE)
227 recipe = (cpl_recipe *)plugin ;
230 cpl_parameterlist_delete(recipe->parameters) ;
244 cpl_frameset * framelist)
246 cpl_parameter * param= NULL ;
249 cpl_image * ima=NULL ;
251 cpl_propertylist * plist=NULL ;
252 cpl_frameset * raw_set=NULL;
257 const char* name=NULL;
259 xsh_msg(
"Welcome to XSHOOTER Pipeline release %d.%d.%d",
260 XSH_MAJOR_VERSION,XSH_MINOR_VERSION,XSH_MICRO_VERSION);
264 check(param=cpl_parameterlist_find(parlist,
265 "xsh.xsh_util_ima_shift.shiftx"));
266 check(shiftx=cpl_parameter_get_int(param));
268 check(param=cpl_parameterlist_find(parlist,
269 "xsh.xsh_util_ima_shift.shifty"));
270 check(shifty=cpl_parameter_get_int(param));
273 n=cpl_frameset_get_size(framelist);
281 "Found no input frames with tag %s",
XSH_IMA);
282 check(nraw=cpl_frameset_get_size(raw_set));
287 for(i=0;i<nraw;i++) {
288 check(frm=cpl_frameset_get_frame(raw_set,i));
289 check(name=cpl_frame_get_filename(frm));
290 check(ima=cpl_image_load(name,CPL_TYPE_FLOAT,0,0));
291 check(cpl_image_shift(ima,shiftx,shifty));
292 check(plist=cpl_propertylist_load(name,0));
293 check(sprintf(name_o,
"shiftx%d_shifty%d_%s",shiftx,shifty,name));
295 check(cpl_image_save(ima,name_o,CPL_BPP_IEEE_FLOAT,plist,CPL_IO_DEFAULT));
307 if (cpl_error_get_code()) {
#define check_msg(COMMAND,...)
#define xsh_msg_error(...)
Print an error message.
#define xsh_msg(...)
Print a message on info level.
int cpl_plugin_get_info(cpl_pluginlist *list)
Build the list of available plugins, for this module.
static int xsh_util_ima_shift_destroy(cpl_plugin *)
Destroy what has been created by the 'create' function.
static int xsh_util_ima_shift_exec(cpl_plugin *)
Execute the plugin instance given by the interface.
static int xsh_util_ima_shift(cpl_parameterlist *, cpl_frameset *)
Get the command line options and execute the data reduction.
static int xsh_util_ima_shift_create(cpl_plugin *)
Setup the recipe options
void xsh_free_image(cpl_image **i)
Deallocate an image and set the pointer to NULL.
void xsh_free_frameset(cpl_frameset **f)
Deallocate a frame set and set the pointer to NULL.
const char * xsh_get_license(void)
Get the pipeline copyright and license.
void xsh_init(void)
Reset library state.
void xsh_free_propertylist(cpl_propertylist **p)
Deallocate a property list and set the pointer to NULL.
cpl_frameset * xsh_frameset_extract(const cpl_frameset *frames, const char *tag)
Extract frames with given tag from frameset.
cpl_error_code xsh_parameters_decode_bp(const char *recipe_id, cpl_parameterlist *plist, const int ival)
void xsh_parameters_generic(const char *recipe_id, cpl_parameterlist *plist)
#define XSH_UTL_IMA_SHIFT_RECIPE_AUTHOR
#define XSH_UTL_IMA_SHIFT_RECIPE_ID
#define XSH_UTL_IMA_SHIFT_RECIPE_CONTACT
static char xsh_util_ima_shift_description_short[]
static char xsh_util_ima_shift_description[]