00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifdef HAVE_CONFIG_H
00035 #include <config.h>
00036 #endif
00037
00038
00039 #include <strings.h>
00040 #include <string.h>
00041 #include <stdio.h>
00042
00043
00044 #include <cpl.h>
00045
00046 #include <irplib_utils.h>
00047
00048
00049 #include <sinfo_general_config.h>
00050 #include <sinfo_bp_norm_config.h>
00051 #include <sinfo_bp_lin_config.h>
00052 #include <sinfo_bp_noise_config.h>
00053 #include <sinfo_new_add_bp_map.h>
00054 #include <sinfo_tpl_utils.h>
00055 #include <sinfo_tpl_dfs.h>
00056 #include <sinfo_msg.h>
00057
00058
00059
00060
00061
00062
00063
00064 const char * sinfoni_get_licence(void);
00065 static int sinfo_utl_bp_mask_add_create(cpl_plugin *plugin);
00066 static int sinfo_utl_bp_mask_add_exec(cpl_plugin *plugin);
00067 static int sinfo_utl_bp_mask_add_destroy(cpl_plugin *plugin);
00068 static int sinfo_utl_bp_mask_add(cpl_parameterlist *, cpl_frameset *);
00069
00070
00071
00072
00073
00074 static char sinfo_utl_bp_mask_add_description[] =
00075 "This recipe performs bad pixel map coaddition.\n"
00076 "The input files are several (at least 2) bad pixel masks in the sof file\n"
00077 "Their tab should contain the string BP_MAP.\n"
00078 "The output is an image resulting from the logical operator OR \n"
00079 "applied to all the masks.\n"
00080 "Information on relevant parameters can be found with\n"
00081 "esorex --params sinfo_utl_bp_mask_add\n"
00082 "esorex --help sinfo_utl_bp_mask_add\n"
00083 "\n";
00084
00085
00086
00087
00088
00089
00090
00094
00096
00097
00098 int
00099 cpl_plugin_get_info(cpl_pluginlist *list)
00100 {
00101
00102 cpl_recipe *recipe = cpl_calloc(1, sizeof *recipe);
00103 cpl_plugin *plugin = &recipe->interface;
00104
00105
00106 cpl_plugin_init(plugin,
00107 CPL_PLUGIN_API,
00108 SINFONI_BINARY_VERSION,
00109 CPL_PLUGIN_TYPE_RECIPE,
00110 "sinfo_utl_bp_mask_add",
00111 "Add bad pixels masks",
00112 sinfo_utl_bp_mask_add_description,
00113 "Andrea Modigliani",
00114 "Andrea.Modigliani@eso.org",
00115 sinfo_get_license(),
00116 sinfo_utl_bp_mask_add_create,
00117 sinfo_utl_bp_mask_add_exec,
00118 sinfo_utl_bp_mask_add_destroy);
00119
00120 cpl_pluginlist_append(list, plugin);
00121
00122 return 0;
00123
00124 }
00125
00126
00133 static int
00134 sinfo_utl_bp_mask_add_create(cpl_plugin *plugin)
00135 {
00136
00137
00138
00139
00140
00141
00142 cpl_recipe *recipe = (cpl_recipe *)plugin;
00143 recipe->parameters = cpl_parameterlist_new();
00144 if(recipe->parameters == NULL) {
00145 return 1;
00146 }
00147 cpl_error_reset();
00148 irplib_reset();
00149
00150
00151
00152
00153
00154
00155 return 0;
00156
00157 }
00158
00159
00165 static int
00166 sinfo_utl_bp_mask_add_exec(cpl_plugin *plugin)
00167 {
00168
00169
00170 cpl_recipe *recipe = (cpl_recipe *) plugin;
00171 if(recipe->parameters == NULL ) {
00172 return 1;
00173 }
00174 if(recipe->frames == NULL) {
00175 return 1;
00176 }
00177
00178 return sinfo_utl_bp_mask_add(recipe->parameters, recipe->frames);
00179
00180 }
00181
00182
00189 static int
00190 sinfo_utl_bp_mask_add_destroy(cpl_plugin *plugin)
00191 {
00192 cpl_recipe *recipe = (cpl_recipe *) plugin;
00193
00194
00195
00196
00197
00198
00199 cpl_parameterlist_delete(recipe->parameters);
00200 return 0;
00201
00202 }
00203
00204
00205
00206
00207
00208
00209
00223 static int
00224 sinfo_utl_bp_mask_add(cpl_parameterlist *config, cpl_frameset *sof)
00225 {
00226
00227 sinfo_msg("Welcome to SINFONI Pipeline release %d.%d.%d",
00228 SINFONI_MAJOR_VERSION,SINFONI_MINOR_VERSION,SINFONI_MICRO_VERSION);
00229
00230 if(sinfo_dfs_set_groups(sof)) {
00231 sinfo_msg_error("Cannot indentify RAW and CALIB frames") ;
00232 return -1;
00233 }
00234 sinfo_new_add_bp_map(cpl_func,config,sof);
00235 return 0 ;
00236
00237
00238
00239 }