00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifdef HAVE_CONFIG_H
00025 #include <config.h>
00026 #endif
00027
00028
00029
00030
00031 #include <string.h>
00032 #include <strings.h>
00033 #include <cpl.h>
00034
00035 #include "muse_scipost_make_cube_z.h"
00036
00037
00043
00046
00047
00048
00049 static const char *muse_scipost_make_cube_help =
00050 "This recipe takes a pixel table and resamples it to either a FITS cube or a Euro3D table and optionally to a stacked spectrum. This is a part of the muse_scipost recipe.";
00051
00052 static const char *muse_scipost_make_cube_help_esorex =
00053 "\n\nInput frames for raw frame tag \"PIXTABLE_OBJECT\":\n"
00054 "\n Frame tag Type Req #Fr Description"
00055 "\n -------------------- ---- --- --- ------------"
00056 "\n PIXTABLE_OBJECT raw Y Input pixel table"
00057 "\n FILTER_LIST calib . 1 File to be used to create field-of-view images."
00058 "\n OUTPUT_WCS calib . 1 WCS to override output cube location / dimensions"
00059 "\n\nProduct frames for raw frame tag \"PIXTABLE_OBJECT\":\n"
00060 "\n Frame tag Level Description"
00061 "\n -------------------- -------- ------------"
00062 "\n DATACUBE_FINAL final Output datacube"
00063 "\n IMAGE_FOV final Field-of-view images corresponding to the \"filter\" parameter."
00064 "\n OBJECT_RESAMPLED final Stacked image (if --stacked=true)";
00065
00066
00074
00075 static cpl_recipeconfig *
00076 muse_scipost_make_cube_new_recipeconfig(void)
00077 {
00078 cpl_recipeconfig *recipeconfig = cpl_recipeconfig_new();
00079
00080 cpl_recipeconfig_set_tag(recipeconfig, "PIXTABLE_OBJECT", 1, -1);
00081 cpl_recipeconfig_set_input(recipeconfig, "PIXTABLE_OBJECT", "FILTER_LIST", -1, 1);
00082 cpl_recipeconfig_set_input(recipeconfig, "PIXTABLE_OBJECT", "OUTPUT_WCS", -1, 1);
00083 cpl_recipeconfig_set_output(recipeconfig, "PIXTABLE_OBJECT", "DATACUBE_FINAL");
00084 cpl_recipeconfig_set_output(recipeconfig, "PIXTABLE_OBJECT", "IMAGE_FOV");
00085 cpl_recipeconfig_set_output(recipeconfig, "PIXTABLE_OBJECT", "OBJECT_RESAMPLED");
00086
00087 return recipeconfig;
00088 }
00089
00090
00100
00101 static cpl_error_code
00102 muse_scipost_make_cube_prepare_header(const char *aFrametag, cpl_propertylist *aHeader)
00103 {
00104 cpl_ensure_code(aFrametag, CPL_ERROR_NULL_INPUT);
00105 cpl_ensure_code(aHeader, CPL_ERROR_NULL_INPUT);
00106 if (!strcmp(aFrametag, "DATACUBE_FINAL")) {
00107 } else if (!strcmp(aFrametag, "IMAGE_FOV")) {
00108 } else if (!strcmp(aFrametag, "OBJECT_RESAMPLED")) {
00109 } else {
00110 cpl_msg_warning(__func__, "Frame tag %s is not defined", aFrametag);
00111 return CPL_ERROR_ILLEGAL_INPUT;
00112 }
00113 return CPL_ERROR_NONE;
00114 }
00115
00116
00125
00126 static cpl_frame_level
00127 muse_scipost_make_cube_get_frame_level(const char *aFrametag)
00128 {
00129 if (!aFrametag) {
00130 return CPL_FRAME_LEVEL_NONE;
00131 }
00132 if (!strcmp(aFrametag, "DATACUBE_FINAL")) {
00133 return CPL_FRAME_LEVEL_FINAL;
00134 }
00135 if (!strcmp(aFrametag, "IMAGE_FOV")) {
00136 return CPL_FRAME_LEVEL_FINAL;
00137 }
00138 if (!strcmp(aFrametag, "OBJECT_RESAMPLED")) {
00139 return CPL_FRAME_LEVEL_FINAL;
00140 }
00141 return CPL_FRAME_LEVEL_NONE;
00142 }
00143
00144
00153
00154 static muse_frame_mode
00155 muse_scipost_make_cube_get_frame_mode(const char *aFrametag)
00156 {
00157 if (!aFrametag) {
00158 return MUSE_FRAME_MODE_ALL;
00159 }
00160 if (!strcmp(aFrametag, "DATACUBE_FINAL")) {
00161 return MUSE_FRAME_MODE_MASTER;
00162 }
00163 if (!strcmp(aFrametag, "IMAGE_FOV")) {
00164 return MUSE_FRAME_MODE_SEQUENCE;
00165 }
00166 if (!strcmp(aFrametag, "OBJECT_RESAMPLED")) {
00167 return MUSE_FRAME_MODE_MASTER;
00168 }
00169 return MUSE_FRAME_MODE_ALL;
00170 }
00171
00172
00182
00183 static int
00184 muse_scipost_make_cube_create(cpl_plugin *aPlugin)
00185 {
00186
00187 cpl_recipe *recipe;
00188 if (cpl_plugin_get_type(aPlugin) == CPL_PLUGIN_TYPE_RECIPE) {
00189 recipe = (cpl_recipe *)aPlugin;
00190 } else {
00191 return -1;
00192 }
00193
00194
00195
00196 muse_processinginfo_register(recipe,
00197 muse_scipost_make_cube_new_recipeconfig(),
00198 muse_scipost_make_cube_prepare_header,
00199 muse_scipost_make_cube_get_frame_level,
00200 muse_scipost_make_cube_get_frame_mode);
00201
00202
00203
00204 if (muse_cplframework() == MUSE_CPLFRAMEWORK_ESOREX) {
00205 cpl_msg_set_time_on();
00206 }
00207
00208
00209 recipe->parameters = cpl_parameterlist_new();
00210
00211 cpl_parameter *p;
00212
00213
00214 p = cpl_parameter_new_value("muse.muse_scipost_make_cube.lambdamin",
00215 CPL_TYPE_DOUBLE,
00216 "Cut off the data below this wavelength after loading the pixel table(s).",
00217 "muse.muse_scipost_make_cube",
00218 (double)4000.);
00219 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "lambdamin");
00220 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "lambdamin");
00221
00222 cpl_parameterlist_append(recipe->parameters, p);
00223
00224
00225 p = cpl_parameter_new_value("muse.muse_scipost_make_cube.lambdamax",
00226 CPL_TYPE_DOUBLE,
00227 "Cut off the data above this wavelength after loading the pixel table(s).",
00228 "muse.muse_scipost_make_cube",
00229 (double)10000.);
00230 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "lambdamax");
00231 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "lambdamax");
00232
00233 cpl_parameterlist_append(recipe->parameters, p);
00234
00235
00236 p = cpl_parameter_new_enum("muse.muse_scipost_make_cube.resample",
00237 CPL_TYPE_STRING,
00238 "The resampling technique to use for the final output cube.",
00239 "muse.muse_scipost_make_cube",
00240 (const char *)"drizzle",
00241 6,
00242 (const char *)"nearest",
00243 (const char *)"linear",
00244 (const char *)"quadratic",
00245 (const char *)"renka",
00246 (const char *)"drizzle",
00247 (const char *)"lanczos");
00248 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "resample");
00249 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "resample");
00250
00251 cpl_parameterlist_append(recipe->parameters, p);
00252
00253
00254 p = cpl_parameter_new_value("muse.muse_scipost_make_cube.dx",
00255 CPL_TYPE_DOUBLE,
00256 "Horizontal step size for resampling (in arcsec or pixel). The following defaults are taken when this value is set to 0.0: 0.2'' for WFM, 0.075'' for NFM, 1.0 if data is in pixel units.",
00257 "muse.muse_scipost_make_cube",
00258 (double)0.0);
00259 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "dx");
00260 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "dx");
00261
00262 cpl_parameterlist_append(recipe->parameters, p);
00263
00264
00265 p = cpl_parameter_new_value("muse.muse_scipost_make_cube.dy",
00266 CPL_TYPE_DOUBLE,
00267 "Vertical step size for resampling (in arcsec or pixel). The following defaults are taken when this value is set to 0.0: 0.2'' for WFM, 0.075'' for NFM, 1.0 if data is in pixel units.",
00268 "muse.muse_scipost_make_cube",
00269 (double)0.0);
00270 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "dy");
00271 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "dy");
00272
00273 cpl_parameterlist_append(recipe->parameters, p);
00274
00275
00276 p = cpl_parameter_new_value("muse.muse_scipost_make_cube.dlambda",
00277 CPL_TYPE_DOUBLE,
00278 "Wavelength step size (in Angstrom). Natural instrument sampling is used, if this is 0.0",
00279 "muse.muse_scipost_make_cube",
00280 (double)0.0);
00281 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "dlambda");
00282 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "dlambda");
00283
00284 cpl_parameterlist_append(recipe->parameters, p);
00285
00286
00287 p = cpl_parameter_new_enum("muse.muse_scipost_make_cube.crtype",
00288 CPL_TYPE_STRING,
00289 "Type of statistics used for detection of cosmic rays during final resampling. \"iraf\" uses the variance information, \"mean\" uses standard (mean/stdev) statistics, \"median\" uses median and the median median of the absolute median deviation.",
00290 "muse.muse_scipost_make_cube",
00291 (const char *)"median",
00292 3,
00293 (const char *)"iraf",
00294 (const char *)"mean",
00295 (const char *)"median");
00296 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "crtype");
00297 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "crtype");
00298
00299 cpl_parameterlist_append(recipe->parameters, p);
00300
00301
00302 p = cpl_parameter_new_value("muse.muse_scipost_make_cube.crsigma",
00303 CPL_TYPE_DOUBLE,
00304 "Sigma rejection factor to use for cosmic ray rejection during final resampling. A zero or negative value switches cosmic ray rejection off.",
00305 "muse.muse_scipost_make_cube",
00306 (double)15.);
00307 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "crsigma");
00308 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "crsigma");
00309
00310 cpl_parameterlist_append(recipe->parameters, p);
00311
00312
00313 p = cpl_parameter_new_value("muse.muse_scipost_make_cube.rc",
00314 CPL_TYPE_DOUBLE,
00315 "Critical radius for the \"renka\" resampling method.",
00316 "muse.muse_scipost_make_cube",
00317 (double)1.25);
00318 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "rc");
00319 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "rc");
00320
00321 cpl_parameterlist_append(recipe->parameters, p);
00322
00323
00324 p = cpl_parameter_new_value("muse.muse_scipost_make_cube.pixfrac",
00325 CPL_TYPE_DOUBLE,
00326 "Pixel down-scaling factor for the \"drizzle\" resampling method.",
00327 "muse.muse_scipost_make_cube",
00328 (double)0.8);
00329 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "pixfrac");
00330 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "pixfrac");
00331
00332 cpl_parameterlist_append(recipe->parameters, p);
00333
00334
00335 p = cpl_parameter_new_value("muse.muse_scipost_make_cube.ld",
00336 CPL_TYPE_INT,
00337 "Number of adjacent pixels to take into account during resampling in all three directions (loop distance); this affects all resampling methods except \"nearest\".",
00338 "muse.muse_scipost_make_cube",
00339 (int)1);
00340 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "ld");
00341 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "ld");
00342
00343 cpl_parameterlist_append(recipe->parameters, p);
00344
00345
00346 p = cpl_parameter_new_enum("muse.muse_scipost_make_cube.format",
00347 CPL_TYPE_STRING,
00348 "Type of output file format, \"Cube\" is a standard FITS cube with NAXIS=3 and multiple extensions (for data and variance). The extended \"x\" formats include the reconstructed image(s) in FITS image extensions within the same file.",
00349 "muse.muse_scipost_make_cube",
00350 (const char *)"Cube",
00351 4,
00352 (const char *)"Cube",
00353 (const char *)"Euro3D",
00354 (const char *)"xCube",
00355 (const char *)"xEuro3D");
00356 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "format");
00357 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "format");
00358
00359 cpl_parameterlist_append(recipe->parameters, p);
00360
00361
00362 p = cpl_parameter_new_value("muse.muse_scipost_make_cube.stacked",
00363 CPL_TYPE_BOOL,
00364 "If true, write an additional output file in form of a 2D stacked image (x direction is pseudo-spatial, y direction is wavelength).",
00365 "muse.muse_scipost_make_cube",
00366 (int)FALSE);
00367 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "stacked");
00368 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "stacked");
00369
00370 cpl_parameterlist_append(recipe->parameters, p);
00371
00372
00373 p = cpl_parameter_new_value("muse.muse_scipost_make_cube.filter",
00374 CPL_TYPE_STRING,
00375 "The filter name(s) to be used for the output field-of-view image. Each name has to correspond to an EXTNAME in an extension of the FILTER_LIST file. If an unsupported filter name is given, creation of the respective image is omitted. If multiple filter names are given, they have to be comma separated.",
00376 "muse.muse_scipost_make_cube",
00377 (const char *)"white");
00378 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CFG, "filter");
00379 cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "filter");
00380
00381 cpl_parameterlist_append(recipe->parameters, p);
00382
00383 return 0;
00384 }
00385
00386
00397
00398 static int
00399 muse_scipost_make_cube_params_fill(muse_scipost_make_cube_params_t *aParams, cpl_parameterlist *aParameters)
00400 {
00401 cpl_ensure_code(aParams, CPL_ERROR_NULL_INPUT);
00402 cpl_ensure_code(aParameters, CPL_ERROR_NULL_INPUT);
00403 cpl_parameter *p;
00404
00405 p = cpl_parameterlist_find(aParameters, "muse.muse_scipost_make_cube.lambdamin");
00406 cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
00407 aParams->lambdamin = cpl_parameter_get_double(p);
00408
00409 p = cpl_parameterlist_find(aParameters, "muse.muse_scipost_make_cube.lambdamax");
00410 cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
00411 aParams->lambdamax = cpl_parameter_get_double(p);
00412
00413 p = cpl_parameterlist_find(aParameters, "muse.muse_scipost_make_cube.resample");
00414 cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
00415 aParams->resample_s = cpl_parameter_get_string(p);
00416 aParams->resample =
00417 (!strcasecmp(aParams->resample_s, "nearest")) ? MUSE_SCIPOST_MAKE_CUBE_PARAM_RESAMPLE_NEAREST :
00418 (!strcasecmp(aParams->resample_s, "linear")) ? MUSE_SCIPOST_MAKE_CUBE_PARAM_RESAMPLE_LINEAR :
00419 (!strcasecmp(aParams->resample_s, "quadratic")) ? MUSE_SCIPOST_MAKE_CUBE_PARAM_RESAMPLE_QUADRATIC :
00420 (!strcasecmp(aParams->resample_s, "renka")) ? MUSE_SCIPOST_MAKE_CUBE_PARAM_RESAMPLE_RENKA :
00421 (!strcasecmp(aParams->resample_s, "drizzle")) ? MUSE_SCIPOST_MAKE_CUBE_PARAM_RESAMPLE_DRIZZLE :
00422 (!strcasecmp(aParams->resample_s, "lanczos")) ? MUSE_SCIPOST_MAKE_CUBE_PARAM_RESAMPLE_LANCZOS :
00423 MUSE_SCIPOST_MAKE_CUBE_PARAM_RESAMPLE_INVALID_VALUE;
00424 cpl_ensure_code(aParams->resample != MUSE_SCIPOST_MAKE_CUBE_PARAM_RESAMPLE_INVALID_VALUE,
00425 CPL_ERROR_ILLEGAL_INPUT);
00426
00427 p = cpl_parameterlist_find(aParameters, "muse.muse_scipost_make_cube.dx");
00428 cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
00429 aParams->dx = cpl_parameter_get_double(p);
00430
00431 p = cpl_parameterlist_find(aParameters, "muse.muse_scipost_make_cube.dy");
00432 cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
00433 aParams->dy = cpl_parameter_get_double(p);
00434
00435 p = cpl_parameterlist_find(aParameters, "muse.muse_scipost_make_cube.dlambda");
00436 cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
00437 aParams->dlambda = cpl_parameter_get_double(p);
00438
00439 p = cpl_parameterlist_find(aParameters, "muse.muse_scipost_make_cube.crtype");
00440 cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
00441 aParams->crtype_s = cpl_parameter_get_string(p);
00442 aParams->crtype =
00443 (!strcasecmp(aParams->crtype_s, "iraf")) ? MUSE_SCIPOST_MAKE_CUBE_PARAM_CRTYPE_IRAF :
00444 (!strcasecmp(aParams->crtype_s, "mean")) ? MUSE_SCIPOST_MAKE_CUBE_PARAM_CRTYPE_MEAN :
00445 (!strcasecmp(aParams->crtype_s, "median")) ? MUSE_SCIPOST_MAKE_CUBE_PARAM_CRTYPE_MEDIAN :
00446 MUSE_SCIPOST_MAKE_CUBE_PARAM_CRTYPE_INVALID_VALUE;
00447 cpl_ensure_code(aParams->crtype != MUSE_SCIPOST_MAKE_CUBE_PARAM_CRTYPE_INVALID_VALUE,
00448 CPL_ERROR_ILLEGAL_INPUT);
00449
00450 p = cpl_parameterlist_find(aParameters, "muse.muse_scipost_make_cube.crsigma");
00451 cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
00452 aParams->crsigma = cpl_parameter_get_double(p);
00453
00454 p = cpl_parameterlist_find(aParameters, "muse.muse_scipost_make_cube.rc");
00455 cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
00456 aParams->rc = cpl_parameter_get_double(p);
00457
00458 p = cpl_parameterlist_find(aParameters, "muse.muse_scipost_make_cube.pixfrac");
00459 cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
00460 aParams->pixfrac = cpl_parameter_get_double(p);
00461
00462 p = cpl_parameterlist_find(aParameters, "muse.muse_scipost_make_cube.ld");
00463 cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
00464 aParams->ld = cpl_parameter_get_int(p);
00465
00466 p = cpl_parameterlist_find(aParameters, "muse.muse_scipost_make_cube.format");
00467 cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
00468 aParams->format_s = cpl_parameter_get_string(p);
00469 aParams->format =
00470 (!strcasecmp(aParams->format_s, "Cube")) ? MUSE_SCIPOST_MAKE_CUBE_PARAM_FORMAT_CUBE :
00471 (!strcasecmp(aParams->format_s, "Euro3D")) ? MUSE_SCIPOST_MAKE_CUBE_PARAM_FORMAT_EURO3D :
00472 (!strcasecmp(aParams->format_s, "xCube")) ? MUSE_SCIPOST_MAKE_CUBE_PARAM_FORMAT_XCUBE :
00473 (!strcasecmp(aParams->format_s, "xEuro3D")) ? MUSE_SCIPOST_MAKE_CUBE_PARAM_FORMAT_XEURO3D :
00474 MUSE_SCIPOST_MAKE_CUBE_PARAM_FORMAT_INVALID_VALUE;
00475 cpl_ensure_code(aParams->format != MUSE_SCIPOST_MAKE_CUBE_PARAM_FORMAT_INVALID_VALUE,
00476 CPL_ERROR_ILLEGAL_INPUT);
00477
00478 p = cpl_parameterlist_find(aParameters, "muse.muse_scipost_make_cube.stacked");
00479 cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
00480 aParams->stacked = cpl_parameter_get_bool(p);
00481
00482 p = cpl_parameterlist_find(aParameters, "muse.muse_scipost_make_cube.filter");
00483 cpl_ensure_code(p, CPL_ERROR_DATA_NOT_FOUND);
00484 aParams->filter = cpl_parameter_get_string(p);
00485
00486 return 0;
00487 }
00488
00489
00496
00497 static int
00498 muse_scipost_make_cube_exec(cpl_plugin *aPlugin)
00499 {
00500 if (cpl_plugin_get_type(aPlugin) != CPL_PLUGIN_TYPE_RECIPE) {
00501 return -1;
00502 }
00503 muse_processing_recipeinfo(aPlugin);
00504 cpl_recipe *recipe = (cpl_recipe *)aPlugin;
00505 cpl_msg_set_threadid_on();
00506
00507 cpl_frameset *usedframes = cpl_frameset_new(),
00508 *outframes = cpl_frameset_new();
00509 muse_scipost_make_cube_params_t params;
00510 muse_scipost_make_cube_params_fill(¶ms, recipe->parameters);
00511
00512 cpl_errorstate prestate = cpl_errorstate_get();
00513
00514 muse_processing *proc = muse_processing_new("muse_scipost_make_cube",
00515 recipe);
00516 int rc = muse_scipost_make_cube_compute(proc, ¶ms);
00517 cpl_frameset_join(usedframes, proc->usedframes);
00518 cpl_frameset_join(outframes, proc->outframes);
00519 muse_processing_delete(proc);
00520
00521 if (!cpl_errorstate_is_equal(prestate)) {
00522
00523 cpl_errorstate_dump(prestate, CPL_FALSE, muse_cplerrorstate_dump_some);
00524
00525 cpl_msg_set_level(CPL_MSG_INFO);
00526 }
00527
00528 muse_cplframeset_erase_duplicate(usedframes);
00529 muse_cplframeset_erase_duplicate(outframes);
00530
00531
00532
00533
00534
00535 muse_cplframeset_erase_all(recipe->frames);
00536 cpl_frameset_join(recipe->frames, usedframes);
00537 cpl_frameset_join(recipe->frames, outframes);
00538 cpl_frameset_delete(usedframes);
00539 cpl_frameset_delete(outframes);
00540 return rc;
00541 }
00542
00543
00550
00551 static int
00552 muse_scipost_make_cube_destroy(cpl_plugin *aPlugin)
00553 {
00554
00555 cpl_recipe *recipe;
00556 if (cpl_plugin_get_type(aPlugin) == CPL_PLUGIN_TYPE_RECIPE) {
00557 recipe = (cpl_recipe *)aPlugin;
00558 } else {
00559 return -1;
00560 }
00561
00562
00563 cpl_parameterlist_delete(recipe->parameters);
00564 muse_processinginfo_delete(recipe);
00565 return 0;
00566 }
00567
00568
00578
00579 int
00580 cpl_plugin_get_info(cpl_pluginlist *aList)
00581 {
00582 cpl_recipe *recipe = cpl_calloc(1, sizeof *recipe);
00583 cpl_plugin *plugin = &recipe->interface;
00584
00585 char *helptext;
00586 if (muse_cplframework() == MUSE_CPLFRAMEWORK_ESOREX) {
00587 helptext = cpl_sprintf("%s%s", muse_scipost_make_cube_help,
00588 muse_scipost_make_cube_help_esorex);
00589 } else {
00590 helptext = cpl_sprintf("%s", muse_scipost_make_cube_help);
00591 }
00592
00593
00594 cpl_plugin_init(plugin, CPL_PLUGIN_API, MUSE_BINARY_VERSION,
00595 CPL_PLUGIN_TYPE_RECIPE,
00596 "muse_scipost_make_cube",
00597 "Make a MUSE cube from a MUSE pixel table.",
00598 helptext,
00599 "Ole Streicher",
00600 "usd-help@eso.org",
00601 muse_get_license(),
00602 muse_scipost_make_cube_create,
00603 muse_scipost_make_cube_exec,
00604 muse_scipost_make_cube_destroy);
00605 cpl_pluginlist_append(aList, plugin);
00606 cpl_free(helptext);
00607
00608 return 0;
00609 }
00610