IIINSTRUMENT Pipeline Reference Manual 4.5.1
visir_util_join.c
1/* $Id: visir_util_join.c,v 1.13 2013-05-13 16:03:43 jtaylor Exp $
2 *
3 * This file is part of the VISIR Pipeline
4 * Copyright (C) 2011 European Southern Observatory
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
19 */
20
21/*
22 * $Author: jtaylor $
23 * $Date: 2013-05-13 16:03:43 $
24 * $Revision: 1.13 $
25 * $Name: not supported by cvs2svn $
26 */
27
28#ifdef HAVE_CONFIG_H
29#include <config.h>
30#endif
31
32/*-----------------------------------------------------------------------------
33 Includes
34 -----------------------------------------------------------------------------*/
35
36#include "visir_recipe.h"
37#include <string.h>
38
39/*-----------------------------------------------------------------------------
40 Defines
41 -----------------------------------------------------------------------------*/
42
43#define RECIPE_STRING "visir_util_join"
44
45/*-----------------------------------------------------------------------------
46 Private Functions prototypes
47 -----------------------------------------------------------------------------*/
48
49static
50cpl_error_code visir_util_join_one(cpl_frameset *,
51 const irplib_framelist *,
52 const irplib_framelist *,
53 const irplib_framelist *,
54 const irplib_framelist *,
55 const irplib_framelist *,
56 const irplib_framelist *,
57 int, cpl_boolean, cpl_boolean,
58 cpl_boolean, cpl_boolean,
59 cpl_boolean,
60 const cpl_parameterlist *);
61
62#ifdef VISIR_CHAIN
63#define cpl_plugin_get_info visir_util_join_get_info
64#endif
65VISIR_RECIPE_DEFINE(visir_util_join, 0,
66 "Extend the final product with extensions containing its "
67 "error map, bad pixel map and weight or contribution map",
68 "The files listed in the Set Of Frames (SOF-file) "
69 "must be tagged:\n"
70 "VISIR-data.fits " VISIR_UTIL_DATA "\n"
71 "\nOptionally, the SOF may also contain one or more of "
72 "the following:\n"
73 "VISIR-bad-pixel-map.fits " VISIR_CALIB_BPM "\n"
74 "VISIR-error.fits " VISIR_UTIL_WEIGHT2ERROR_PROCATG
75 "\n"
76 "VISIR-contribution-map.fits " VISIR_IMG_CLIPPED_MAP_PROCATG
77 "\n"
78 "VISIR-weight-map.fits " VISIR_UTIL_WEIGHT2ERROR
79 "\n"
80 "\nThe product(s) will have a FITS card\n"
81 "'HIERARCH " CPL_DFS_PRO_CATG "' with a value of:\n"
82 VISIR_UTIL_JOIN_PROCATG);
83
84/*----------------------------------------------------------------------------*/
88/*----------------------------------------------------------------------------*/
89
90/*-----------------------------------------------------------------------------
91 Functions code
92 -----------------------------------------------------------------------------*/
93
94/*----------------------------------------------------------------------------*/
101/*----------------------------------------------------------------------------*/
102static int visir_util_join(cpl_frameset * framelist,
103 const cpl_parameterlist * parlist)
104{
105 irplib_framelist * allframes = NULL;
106 irplib_framelist * rawframes = NULL;
107 irplib_framelist * bpmframes = NULL;
108 irplib_framelist * errframes = NULL;
109 irplib_framelist * conframes = NULL;
110 irplib_framelist * wgtframes = NULL;
111 irplib_framelist * qcframes = NULL;
112 int n;
113 int nbad = 0, nerr = 0, ncon = 0, nwgt = 0, nqc = 0;
114
115
116 /* Identify the RAW and TAB frames in the input frameset */
117 skip_if (visir_dfs_set_groups(framelist));
118 FOR_EACH_FRAMESET(frm, framelist)
119 cpl_frame_set_group(frm, CPL_FRAME_GROUP_RAW);
120
121 /* Objects observation */
122 allframes = irplib_framelist_cast(framelist);
123 skip_if(allframes == NULL);
124
125 rawframes =
126 irplib_framelist_extract_regexp(allframes, "^("
127 VISIR_UTIL_DATA
128 "|" VISIR_IMG_PHOT_ONEBEAM_PROCATG
129 "|" VISIR_IMG_PHOT_COMBINED_PROCATG
130 "|COADDED_IMAGE"
131 "|" VISIR_IMG_COADDED_IMG
132 ")$",
133 CPL_FALSE);
134
135 skip_if(rawframes == NULL);
136
137 n = irplib_framelist_get_size(rawframes);
138
139 if (cpl_frameset_find_const(framelist, VISIR_CALIB_BPM)) {
140 bpmframes = irplib_framelist_extract(allframes, VISIR_CALIB_BPM);
141 skip_if (bpmframes == NULL);
142
143 nbad = irplib_framelist_get_size(bpmframes);
144 error_if(nbad != n && nbad != 1, CPL_ERROR_INCOMPATIBLE_INPUT,
145 "%d raw-frames <=> %d bpm frames", n, nbad);
146 }
147
148 if (cpl_frameset_find_const(framelist, VISIR_UTIL_ERROR_MAP_PROCATG)) {
149 errframes = irplib_framelist_extract(allframes,
150 VISIR_UTIL_ERROR_MAP_PROCATG);
151 skip_if (errframes == NULL);
152
153 nerr = irplib_framelist_get_size(errframes);
154 error_if(nerr != n && nerr != 1, CPL_ERROR_INCOMPATIBLE_INPUT,
155 "%d raw-frames <=> %d error frames", n, nerr);
156
157 }
158
159 if (cpl_frameset_find_const(framelist, VISIR_IMG_CLIPPED_MAP_PROCATG)) {
160 conframes = irplib_framelist_extract(allframes,
161 VISIR_IMG_CLIPPED_MAP_PROCATG);
162 skip_if (conframes == NULL);
163
164 ncon = irplib_framelist_get_size(conframes);
165 error_if(ncon % n != 0 && ncon != 1, CPL_ERROR_INCOMPATIBLE_INPUT,
166 "%d raw-frames <=> %d contribution frames", n, ncon);
167 }
168
169 if (cpl_frameset_find_const(framelist, VISIR_UTIL_WEIGHT_MAP_PROCATG)) {
170 wgtframes = irplib_framelist_extract(allframes,
171 VISIR_UTIL_WEIGHT_MAP_PROCATG);
172 skip_if (wgtframes == NULL);
173
174 nwgt = irplib_framelist_get_size(wgtframes);
175 error_if(nwgt != n && nwgt != 1, CPL_ERROR_INCOMPATIBLE_INPUT,
176 "%d raw-frames <=> %d weight frames", n, nwgt);
177 }
178
179 if (cpl_frameset_find_const(framelist, VISIR_UTIL_QC_PROCATG)) {
180 qcframes = irplib_framelist_extract(allframes, VISIR_UTIL_QC_PROCATG);
181 skip_if (qcframes == NULL);
182
183 nqc = irplib_framelist_get_size(qcframes);
184 error_if(nqc != n && nqc != 1, CPL_ERROR_INCOMPATIBLE_INPUT,
185 "%d raw-frames <=> %d qc frames", n, nqc);
186 }
187
188 for (int i = 0; i < n; i++) {
189 cpl_msg_info(cpl_func, "Joining frame %d/%d", 1+i, n);
190
191 skip_if (visir_util_join_one(framelist, rawframes, bpmframes, errframes,
192 conframes, wgtframes, qcframes, i, nbad == 1,
193 nerr == 1, ncon == 1, nwgt == 1, nqc == 1,
194 parlist));
195 }
196
197 end_skip;
198
199 irplib_framelist_delete(allframes);
200 irplib_framelist_delete(rawframes);
201 irplib_framelist_delete(bpmframes);
202 irplib_framelist_delete(errframes);
203 irplib_framelist_delete(conframes);
204 irplib_framelist_delete(wgtframes);
205 irplib_framelist_delete(qcframes);
206
207 return cpl_error_get_code();
208}
209
210
211/*----------------------------------------------------------------------------*/
230/*----------------------------------------------------------------------------*/
231static
232cpl_error_code visir_util_join_one(cpl_frameset * framelist,
233 const irplib_framelist * rawframes,
234 const irplib_framelist * bpmframes,
235 const irplib_framelist * errframes,
236 const irplib_framelist * conframes,
237 const irplib_framelist * wgtframes,
238 const irplib_framelist * qcframes,
239 int i,
240 cpl_boolean bshared, cpl_boolean eshared,
241 cpl_boolean cshared, cpl_boolean wshared,
242 cpl_boolean qcshared,
243 const cpl_parameterlist * parlist)
244{
245
246 const int n = irplib_framelist_get_size(rawframes);
247 const cpl_frame * frame;
248 cpl_frameset * products = cpl_frameset_new();
249 cpl_frameset * usedframes = cpl_frameset_new();
250 const char * filename;
251 cpl_propertylist * img_plist = NULL;
252 char * proname = NULL;
253 cpl_image * img = NULL;
254 cpl_image * csum = NULL;
255 const char * bunit = NULL;
256 char * inpcatg = NULL;
257
258 cpl_image * bpm = NULL;
259 cpl_image * err = NULL;
260 cpl_image * wgt = NULL;
261 cpl_image * con = NULL;
262
263 cpl_propertylist * bpm_plist = NULL;
264 cpl_propertylist * err_plist = NULL;
265 cpl_propertylist * wgt_plist = NULL;
266 cpl_propertylist * con_plist = NULL;
267 cpl_propertylist * qc_plist = NULL;
268
269 const char * procatg = VISIR_UTIL_JOIN_PROCATG;
270
271 bug_if(cpl_frameset_insert(usedframes, cpl_frame_duplicate
272 (irplib_framelist_get_const(rawframes, i))));
273
274 /* 1) The data frame */
275 frame = irplib_framelist_get_const(rawframes, i);
276 filename = cpl_frame_get_filename(frame);
277
278 img_plist = cpl_propertylist_load(filename, 0);
279 skip_if(img_plist == NULL);
280
281 img = cpl_image_load(filename, CPL_TYPE_UNSPECIFIED, 0, 0);
282 skip_if(img == NULL);
283
284 if (qcframes) {
285 const cpl_frame * qcframe =
286 irplib_framelist_get_const(qcframes, qcshared ? 0 : i);
287 filename = cpl_frame_get_filename(qcframe);
288 qc_plist = cpl_propertylist_load_regexp(filename, 0,
289 "ESO QC |BUNIT|ESO DRS CATG", CPL_FALSE);
290 skip_if (qc_plist == NULL);
291 if (cpl_propertylist_has(qc_plist, "BUNIT")) {
292 bunit = cpl_propertylist_get_string(qc_plist, "BUNIT");
293 }
294 if (cpl_propertylist_has(qc_plist, "ESO DRS CATG")) {
295 inpcatg =
296 cpl_strdup(cpl_propertylist_get_string(qc_plist, "ESO DRS CATG"));
297 cpl_propertylist_erase(qc_plist, "ESO DRS CATG");
298 }
299 }
300
301 if (bunit == NULL && cpl_propertylist_has(img_plist, "BUNIT")) {
302 bunit = cpl_propertylist_get_string(img_plist, "BUNIT");
303 }
304 if (inpcatg == NULL && cpl_propertylist_has(img_plist, "ESO DRS CATG")) {
305 inpcatg =
306 cpl_strdup(cpl_propertylist_get_string(img_plist, "ESO DRS CATG"));
307 cpl_propertylist_erase(img_plist, "ESO DRS CATG");
308 }
309 cpl_propertylist_append(img_plist, qc_plist);
310
311 if (!strcmp(cpl_frame_get_tag(frame), VISIR_IMG_PHOT_ONEBEAM_PROCATG))
312 procatg = VISIR_IMG_PHOT_ONEBEAM_PROCATG;
313 else if (!strcmp(cpl_frame_get_tag(frame), VISIR_IMG_PHOT_COMBINED_PROCATG))
314 procatg = VISIR_IMG_PHOT_COMBINED_PROCATG;
315 else if (!strcmp(cpl_frame_get_tag(frame), VISIR_IMG_COADDED_IMG))
316 procatg = VISIR_IMG_OBJ_COMBINED_PROCATG;
317 else if (!strcmp(cpl_frame_get_tag(frame), "COADDED_IMAGE"))
318 procatg = VISIR_IMG_OBJ_ONEBEAM_PROCATG;
319
320 procatg = visir_dfs_output_catg(inpcatg, procatg);
321
322 if (cpl_propertylist_has(img_plist, "ESO QC BEAMID")) {
323 const char * b = cpl_propertylist_get_string(img_plist,
324 "ESO QC BEAMID");
325 proname = cpl_sprintf(RECIPE_STRING "_b%s_%03d"
326 CPL_DFS_FITS, b, 1+i);
327 }
328 else
329 proname = cpl_sprintf(RECIPE_STRING "_%03d"
330 CPL_DFS_FITS, 1+i);
331
332 if (bpmframes != NULL) {
333 /* 3) The bpm frame */
334 frame = irplib_framelist_get_const(bpmframes, bshared ? 0 : i);
335
336 filename = cpl_frame_get_filename(frame);
337
338 bpm = cpl_image_load(filename, CPL_TYPE_INT, 0, 0);
339 skip_if(bpm == NULL);
340
341 bpm_plist = cpl_propertylist_load_regexp(filename, 0, " ESO QC | ESO PRO ",
342 0);
343 skip_if(bpm_plist == NULL);
344 cpl_propertylist_append_string(bpm_plist, "EXTNAME", VISIR_EXTN_BPM);
345 }
346
347 if (errframes != NULL) {
348 /* 3) The error frame */
349
350 frame = irplib_framelist_get_const(errframes, eshared ? 0 : i);
351
352 filename = cpl_frame_get_filename(frame);
353
354 err = cpl_image_load(filename, CPL_TYPE_UNSPECIFIED, 0, 0);
355 skip_if(err == NULL);
356
357 err_plist = cpl_propertylist_load_regexp(filename, 0, " ESO QC | ESO PRO ",
358 0);
359 skip_if(err_plist == NULL);
360 cpl_propertylist_append_string(err_plist, "EXTNAME", VISIR_EXTN_ERROR);
361 if (bunit) {
362 cpl_propertylist_append_string(err_plist, "BUNIT", bunit);
363 }
364
365 if (wgtframes == NULL) {
366 wgt = cpl_image_new(cpl_image_get_size_x(err),
367 cpl_image_get_size_y(err),
368 CPL_TYPE_FLOAT);
369 cpl_image_add_scalar(wgt, 1.0);
370 cpl_image_divide(wgt, err);
371 cpl_image_power(wgt, 2);
372 wgt_plist = cpl_propertylist_new();
373 cpl_propertylist_append_string(wgt_plist, "EXTNAME", VISIR_EXTN_WEIGHT);
374 skip_if(0);
375 }
376
377 }
378
379 if (conframes != NULL) {
380 /* 4) The contribution frame(s) */
381
382 if (cshared || irplib_framelist_get_size(conframes) == n) {
383
384 frame = irplib_framelist_get_const(conframes, cshared ? 0 : i);
385
386 filename = cpl_frame_get_filename(frame);
387
388 con = cpl_image_load(filename, CPL_TYPE_INT, 0, 0);
389 skip_if(con == NULL);
390
391 con_plist = cpl_propertylist_load_regexp(filename, 0, " ESO QC | ESO PRO ",
392 0);
393 skip_if(con_plist == NULL);
394
395 } else {
396
397 const int ncon = irplib_framelist_get_size(conframes);
398 const int nz = ncon / n;
399 int j;
400
401 for (j = i * nz; j < i * nz + nz; j ++) {
402 frame = irplib_framelist_get_const(conframes, j);
403 bug_if(cpl_frameset_insert(usedframes,
404 cpl_frame_duplicate(frame)));
405
406 filename = cpl_frame_get_filename(frame);
407
408 if (j == i * nz) {
409
410 con = cpl_image_load(filename, CPL_TYPE_INT, 0, 0);
411 skip_if(con == NULL);
412
413 } else {
414 csum = cpl_image_load(filename, CPL_TYPE_INT, 0, 0);
415 skip_if(csum == NULL);
416 skip_if(cpl_image_add(con, csum));
417 }
418 }
419
420 }
421
422 if (bpm == NULL) {
423 bpm = cpl_image_duplicate(con);
424
425 /* FIXME: Find a better way to create a image BPM */
426 bug_if(cpl_image_threshold(bpm, -0.5, 1.0, 0.5, 1.0));
427 bug_if(cpl_image_multiply_scalar(bpm, -1.0));
428 bug_if(cpl_image_add_scalar(bpm, 1.0));
429
430 bpm_plist = cpl_propertylist_new();
431 cpl_propertylist_append_string(bpm_plist, "EXTNAME", VISIR_EXTN_BPM);
432 }
433 }
434
435
436 if (wgtframes != NULL) {
437 /* 5) The weight frame */
438
439 frame = irplib_framelist_get_const(wgtframes, wshared ? 0 : i);
440
441 filename = cpl_frame_get_filename(frame);
442
443 wgt_plist = cpl_propertylist_load_regexp(filename, 0, " ESO QC | ESO PRO ",
444 0);
445 skip_if(wgt_plist == NULL);
446
447 bug_if(cpl_propertylist_append_string(wgt_plist, "EXTNAME", VISIR_EXTN_WEIGHT));
448
449 wgt = cpl_image_load(filename, CPL_TYPE_FLOAT, 0, 0);
450 skip_if(wgt == NULL);
451
452 if (err == NULL) {
453 err = cpl_image_new(cpl_image_get_size_x(wgt),
454 cpl_image_get_size_y(wgt), CPL_TYPE_FLOAT);
455 cpl_image_add_scalar(err, 1.0);
456 cpl_image_divide(err, wgt);
457 cpl_image_power(err, 0.5);
458 cpl_image_fill_rejected(err, INFINITY);
459 err_plist = cpl_propertylist_new();
460 cpl_propertylist_append_string(err_plist, "EXTNAME", VISIR_EXTN_ERROR);
461 if (bunit) {
462 cpl_propertylist_append_string(err_plist, "BUNIT", bunit);
463 }
464 skip_if(0);
465 }
466
467 }
468
469 if (err != NULL && con == NULL && bpm == NULL) {
470
471 /* FIXME: Find a better way to create a image BPM */
472 cpl_mask * mbpm = cpl_mask_threshold_image_create(err, -DBL_EPSILON, 1e8);
473 cpl_mask_not(mbpm);
474 bpm = cpl_image_new_from_mask(mbpm);
475 cpl_mask_delete(mbpm);
476
477 bpm_plist = cpl_propertylist_new();
478 cpl_propertylist_append_string(bpm_plist, "EXTNAME", VISIR_EXTN_BPM);
479 }
480 skip_if(0);
481
482 /* try to compute gauss fwhm also for science images, may fail (PIPE-6158) */
483 if (!cpl_propertylist_has(img_plist, "ESO QC GAUSSFIT FWHM_MAX")) {
484 cpl_errorstate cleanstate = cpl_errorstate_get();
485 double fwhm_x = -1., fwhm_y = -1.,
486 peak = -1., peak_err = 0.,
487 major = -1., major_err = 0.,
488 minor = -1., minor_err = 0.,
489 angle = -1., angle_err = 0.;
490 cpl_size x_pos = cpl_propertylist_get_double(img_plist, "CRPIX1");
491 cpl_size y_pos = cpl_propertylist_get_double(img_plist, "CRPIX2");
492 cpl_image * lwgt = wgt;
493
494 /* Compute the FWHM */
495 cpl_image_get_fwhm(img, (int)x_pos, (int)y_pos, &fwhm_x, &fwhm_y);
496
497 if (lwgt == NULL) {
498 lwgt = cpl_image_new(cpl_image_get_size_x(img), cpl_image_get_size_y(img), CPL_TYPE_DOUBLE);
499 cpl_image_add_scalar(lwgt, 1);
500 }
501 if (fit_2d_gauss(img, lwgt, (cpl_size)x_pos, (cpl_size)y_pos,
502 fwhm_x, fwhm_y, &peak, &peak_err,
503 &major, &major_err, &minor, &minor_err,
504 &angle, &angle_err) == CPL_ERROR_NONE) {
505 cpl_msg_info(cpl_func, "Peak: %g +- %g, FWHM : %g +- %g major ; %g +- %g minor, "
506 "angle %g +- %g", peak, peak_err,
507 major, major_err, minor, minor_err,
508 angle * CPL_MATH_DEG_RAD,
509 angle_err * CPL_MATH_DEG_RAD);
510 cpl_propertylist_append_double(img_plist, "ESO QC GAUSSFIT FWHM_MAX",
511 major);
512 cpl_propertylist_set_comment(img_plist, "ESO QC GAUSSFIT FWHM_MAX",
513 "major axis [pix]");
514 cpl_propertylist_append_double(img_plist, "ESO QC GAUSSFIT FWHM_MAX_ERR",
515 major_err);
516 cpl_propertylist_append_double(img_plist, "ESO QC GAUSSFIT FWHM_MIN",
517 minor);
518 cpl_propertylist_set_comment(img_plist, "ESO QC GAUSSFIT FWHM_MIN",
519 "minor axis [pix]");
520 cpl_propertylist_append_double(img_plist, "ESO QC GAUSSFIT FWHM_MIN_ERR",
521 minor_err);
522 cpl_propertylist_append_double(img_plist, "ESO QC GAUSSFIT ANGLE",
523 angle * CPL_MATH_DEG_RAD);
524 cpl_propertylist_set_comment(img_plist, "ESO QC GAUSSFIT ANGLE",
525 "[deg]");
526 cpl_propertylist_append_double(img_plist, "ESO QC GAUSSFIT ANGLE_ERR",
527 angle_err * CPL_MATH_DEG_RAD);
528 cpl_propertylist_append_double(img_plist, "ESO QC GAUSSFIT PEAK",
529 peak);
530 cpl_propertylist_append_double(img_plist, "ESO QC GAUSSFIT PEAK_ERR",
531 peak_err);
532 }
533 else {
534 cpl_msg_warning(cpl_func, "2D gauss fit failed, approximate FWHM : %g"
535 "in x ; %g in y ", fwhm_x, fwhm_y);
536 }
537
538 if (lwgt != wgt) {
539 cpl_image_delete(lwgt);
540 }
541 /* ignore all errors */
542 cpl_errorstate_set(cleanstate);
543 }
544
545 skip_if(irplib_dfs_save_image(products, parlist, usedframes,
546 img, CPL_TYPE_UNSPECIFIED,
547 RECIPE_STRING,
548 procatg, img_plist,
549 NULL, visir_pipe_id, proname));
550
551 if (bpm) {
552 if (bpmframes) {
553 frame = irplib_framelist_get_const(bpmframes, bshared ? 0 : i);
554 bug_if(cpl_frameset_insert(usedframes, cpl_frame_duplicate(frame)));
555 }
556 skip_if(cpl_image_save(bpm, proname, CPL_BPP_8_UNSIGNED,
557 bpm_plist, CPL_IO_EXTEND));
558 }
559 if (err) {
560 if (errframes) {
561 frame = irplib_framelist_get_const(errframes, eshared ? 0 : i);
562 bug_if(cpl_frameset_insert(usedframes, cpl_frame_duplicate(frame)));
563 }
564 skip_if(cpl_image_save(err, proname, CPL_TYPE_UNSPECIFIED,
565 err_plist, CPL_IO_EXTEND));
566 }
567 if (con) {
568 if (conframes) {
569 frame = irplib_framelist_get_const(conframes, cshared ? 0 : i);
570 bug_if(cpl_frameset_insert(usedframes, cpl_frame_duplicate(frame)));
571 }
572 skip_if(cpl_image_save(con, proname, CPL_TYPE_UNSPECIFIED,
573 con_plist, CPL_IO_EXTEND));
574 }
575 if (wgt) {
576 if (wgtframes) {
577 frame = irplib_framelist_get_const(wgtframes, wshared ? 0 : i);
578 bug_if(cpl_frameset_insert(usedframes, cpl_frame_duplicate(frame)));
579 }
580 skip_if(cpl_image_save(wgt, proname, CPL_TYPE_UNSPECIFIED,
581 wgt_plist, CPL_IO_EXTEND));
582 }
583
584 FOR_EACH_FRAMESET_C(frm, products) {
585 cpl_frame * copy = cpl_frame_duplicate(frm);
586 cpl_error_code error = cpl_frameset_insert(framelist, copy);
587
588 if (error) break;
589 }
590
591 end_skip;
592
593 cpl_image_delete(img);
594 cpl_image_delete(err);
595 cpl_image_delete(wgt);
596 cpl_image_delete(con);
597 cpl_image_delete(bpm);
598 cpl_image_delete(csum);
599 cpl_free(proname);
600 cpl_free(inpcatg);
601 cpl_propertylist_delete(img_plist);
602 cpl_propertylist_delete(err_plist);
603 cpl_propertylist_delete(wgt_plist);
604 cpl_propertylist_delete(con_plist);
605 cpl_propertylist_delete(bpm_plist);
606 cpl_propertylist_delete(qc_plist);
607 cpl_frameset_delete(usedframes);
608 cpl_frameset_delete(products);
609
610 return cpl_error_get_code();
611}
int visir_dfs_set_groups(cpl_frameset *set)
Set the group as RAW or CALIB in a frameset.
Definition: visir_dfs.c:72