CR2RE Pipeline Reference Manual 1.7.0
hdrl_catalogue.c
1/*
2 * This file is part of the HDRL
3 * Copyright (C) 2016 European Southern Observatory
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifdef HAVE_CONFIG_H
21#include <config.h>
22#endif
23
24/*-----------------------------------------------------------------------------
25 Includes
26-----------------------------------------------------------------------------*/
27
28#include <assert.h>
29#include <math.h>
30#include <stdint.h>
31
32#include "hdrl_catalogue.h"
33#include "hdrl_image.h"
34#include "hdrl_types.h"
35#include "hdrl_utils.h"
36
37/*-----------------------------------------------------------------------------
38 Static
39 -----------------------------------------------------------------------------*/
40
41
42
43
64/*----------------------------------------------------------------------------*/
65
67
68/*-----------------------------------------------------------------------------
69 Catalogue parameters Definition
70 -----------------------------------------------------------------------------*/
71
73
74typedef struct {
75 HDRL_PARAMETER_HEAD;
76 int obj_min_pixels;
77 double obj_threshold;
78 cpl_boolean obj_deblending;
79 double obj_core_radius;
80 cpl_boolean bkg_estimate;
81 int bkg_mesh_size;
82 hdrl_catalogue_options resulttype;
83 double bkg_smooth_fwhm;
84 double det_eff_gain;
85 double det_saturation;
86} hdrl_catalogue_parameter;
87
88/* parameter type */
89static hdrl_parameter_typeobj hdrl_catalogue_parameter_type = {
90 HDRL_PARAMETER_CATALOGUE, /* type */
91 (hdrl_alloc *)&cpl_malloc, /* fp_alloc */
92 (hdrl_free *)&cpl_free, /* fp_free */
93 NULL, /* fp_destroy */
94 sizeof(hdrl_catalogue_parameter), /* obj_size */
95};
96
97static cpl_error_code hdrl_cleanup_qclist(cpl_propertylist * qclist,
98 cpl_boolean include_experimental_qc);
99static hdrl_catalogue_result * hdrl_catalogue_compute_internal(
100 const cpl_image * image_, const cpl_image * confidence_map,
101 const cpl_wcs * wcs, hdrl_parameter * param_,
102 cpl_boolean include_experimental_qc);
103
104/*----------------------------------------------------------------------------*/
111/*----------------------------------------------------------------------------*/
112static cpl_error_code
113hdrl_catalogue_parameter_verify(const hdrl_parameter * param)
114{
115 cpl_error_ensure(param != NULL, CPL_ERROR_NULL_INPUT,
116 return CPL_ERROR_NULL_INPUT, "NULL Input Parameters");
117 cpl_error_ensure(hdrl_catalogue_parameter_check(param),
118 CPL_ERROR_ILLEGAL_INPUT, return CPL_ERROR_ILLEGAL_INPUT,
119 "Expected catalogue parameter") ;
120
121 const hdrl_catalogue_parameter * param_loc = (const hdrl_catalogue_parameter *)param ;
122
123 cpl_error_ensure(param_loc->obj_min_pixels > 0, CPL_ERROR_ILLEGAL_INPUT,
124 return CPL_ERROR_ILLEGAL_INPUT, "obj.min-pixels > 0");
125
126 cpl_error_ensure(param_loc->obj_threshold > 0., CPL_ERROR_ILLEGAL_INPUT,
127 return CPL_ERROR_ILLEGAL_INPUT, "obj_threshold > 0.");
128
129 cpl_error_ensure(param_loc->obj_core_radius > 0., CPL_ERROR_ILLEGAL_INPUT,
130 return CPL_ERROR_ILLEGAL_INPUT, "obj_core_radius > 0.");
131
132 if (param_loc->bkg_estimate) {
133 cpl_error_ensure(param_loc->bkg_mesh_size > 2, CPL_ERROR_ILLEGAL_INPUT,
134 return CPL_ERROR_ILLEGAL_INPUT, "bkg_mesh_size > 2");
135
136 cpl_error_ensure(param_loc->bkg_smooth_fwhm >= 0., CPL_ERROR_ILLEGAL_INPUT,
137 return CPL_ERROR_ILLEGAL_INPUT, "bkg_mesh_size >= 0.");
138 }
139
140 cpl_error_ensure(param_loc->det_eff_gain > 0., CPL_ERROR_ILLEGAL_INPUT,
141 return CPL_ERROR_ILLEGAL_INPUT, "det_eff_gain > 0.");
142
143 cpl_error_ensure(param_loc->det_saturation > 0. ||
144 param_loc->det_saturation == HDRL_SATURATION_INIT,
145 CPL_ERROR_ILLEGAL_INPUT, return CPL_ERROR_ILLEGAL_INPUT,
146 "det_saturation > 0");
147
148 return CPL_ERROR_NONE ;
149
150}
151
153
154/*----------------------------------------------------------------------------*/
178/*----------------------------------------------------------------------------*/
179hdrl_parameter * hdrl_catalogue_parameter_create(int obj_min_pixels,
180 double obj_threshold, cpl_boolean obj_deblending,
181 double obj_core_radius,
182 cpl_boolean bkg_estimate, int bkg_mesh_size,
183 double bkg_smooth_fwhm, double det_eff_gain,
184 double det_saturation,
185 hdrl_catalogue_options resulttype)
186{
187 hdrl_catalogue_parameter * p = (hdrl_catalogue_parameter *)
188 hdrl_parameter_new(&hdrl_catalogue_parameter_type);
189
190 p->obj_min_pixels = obj_min_pixels;
191 p->obj_threshold = obj_threshold;
192 p->obj_deblending = obj_deblending;
193 p->obj_core_radius = obj_core_radius;
194 p->bkg_estimate = bkg_estimate;
195 p->bkg_mesh_size = bkg_mesh_size;
196 p->resulttype = resulttype;
197 p->bkg_smooth_fwhm = bkg_smooth_fwhm;
198 p->det_eff_gain = det_eff_gain;
199 p->det_saturation = det_saturation;
200
201 if (!bkg_estimate) {
202 p->resulttype &= ~(HDRL_CATALOGUE_BKG);
203 }
204
205 if (hdrl_catalogue_parameter_verify((hdrl_parameter *)p)) {
206 cpl_free(p);
207 return NULL;
208 }
209 return (hdrl_parameter *)p;
210
211}
212
213/*----------------------------------------------------------------------------*/
219/*----------------------------------------------------------------------------*/
220cpl_boolean hdrl_catalogue_parameter_check(const hdrl_parameter * self)
221{
222 return hdrl_parameter_check_type(self, &hdrl_catalogue_parameter_type);
223}
224
225/* ---------------------------------------------------------------------------*/
234/* ---------------------------------------------------------------------------*/
235cpl_error_code hdrl_catalogue_parameter_set_option(hdrl_parameter * par,
236 hdrl_catalogue_options opt)
237{
238 cpl_ensure_code(par, CPL_ERROR_NULL_INPUT);
239 cpl_error_code err = hdrl_catalogue_parameter_verify(par);
240 if (err != CPL_ERROR_NONE) {
241 return err;
242 }
243 hdrl_catalogue_parameter * par_ = (hdrl_catalogue_parameter*)par;
244 par_->resulttype = opt;
245 if (!par_->bkg_estimate) {
246 par_->resulttype &= ~(HDRL_CATALOGUE_BKG);
247 }
248 return hdrl_catalogue_parameter_verify(par);
249}
250
251/*----------------------------------------------------------------------------*/
273/*----------------------------------------------------------------------------*/
275 const char *base_context,
276 const char *prefix,
277 hdrl_parameter *defaults)
278{
279
280 cpl_ensure(prefix && base_context && defaults,
281 CPL_ERROR_NULL_INPUT, NULL);
282
283 cpl_ensure(hdrl_catalogue_parameter_check(defaults),
284 CPL_ERROR_INCOMPATIBLE_INPUT, NULL);
285
286 hdrl_catalogue_parameter *par = (hdrl_catalogue_parameter*)defaults;
287
288 cpl_parameterlist *parlist = cpl_parameterlist_new();
289
290 hdrl_setup_vparameter(parlist, prefix, ".", "obj.", "min-pixels",
291 base_context, "Minimum pixel area for each detected "
292 "object.", CPL_TYPE_INT, par->obj_min_pixels);
293
294 hdrl_setup_vparameter(parlist, prefix, ".", "obj.", "threshold",
295 base_context,
296 "Detection threshold in sigma above sky.",
297 CPL_TYPE_DOUBLE, par->obj_threshold);
298
299 hdrl_setup_vparameter(parlist, prefix, ".", "obj.", "deblending",
300 base_context, "Use deblending?.",
301 CPL_TYPE_BOOL, par->obj_deblending);
302
303 hdrl_setup_vparameter(parlist, prefix, ".", "obj.", "core-radius",
304 base_context, "Value of Rcore in pixels.",
305 CPL_TYPE_DOUBLE, par->obj_core_radius);
306
307 hdrl_setup_vparameter(parlist, prefix, ".", "bkg.", "estimate",
308 base_context, "Estimate background from input, if "
309 "false it is assumed input is already background "
310 "corrected with median 0",
311 CPL_TYPE_BOOL, par->bkg_estimate);
312
313 hdrl_setup_vparameter(parlist, prefix, ".", "bkg.", "mesh-size",
314 base_context, "Background smoothing box size.",
315 CPL_TYPE_INT, par->bkg_mesh_size);
316
317 /* --prefix.result-type not an cpl option*/
318
319 hdrl_setup_vparameter(parlist, prefix, ".", "bkg.", "smooth-gauss-fwhm",
320 base_context, "The FWHM of the Gaussian kernel used "
321 "in convolution for object detection.",
322 CPL_TYPE_DOUBLE, par->bkg_smooth_fwhm);
323
324 hdrl_setup_vparameter(parlist, prefix, ".", "det.", "effective-gain",
325 base_context, "Detector gain value to rescale "
326 "convert intensity to electrons",
327 CPL_TYPE_DOUBLE, par->det_eff_gain);
328
329 hdrl_setup_vparameter(parlist, prefix, ".", "det.", "saturation",
330 base_context, "Detector saturation value",
331 CPL_TYPE_DOUBLE, par->det_saturation);
332
333 if (cpl_error_get_code()) {
334 cpl_parameterlist_delete(parlist);
335 return NULL;
336 }
337
338 return parlist;
339}
340
341/*----------------------------------------------------------------------------*/
362/*----------------------------------------------------------------------------*/
364 const cpl_parameterlist * parlist,
365 const char * prefix)
366{
367 cpl_ensure(prefix && parlist, CPL_ERROR_NULL_INPUT, NULL);
368 char * name ;
369 const cpl_parameter * par;
370 int obj_min_pixels, bkg_mesh_size;
371 cpl_boolean obj_deblending, bkg_estimate;
372 double obj_threshold, obj_core_radius, bkg_smooth_fwhm, det_eff_gain,
373 det_saturation;
374
375
376 name = hdrl_join_string(".", 2, prefix, "obj.min-pixels");
377 par = cpl_parameterlist_find_const(parlist, name);
378 obj_min_pixels = cpl_parameter_get_int(par);
379 cpl_free(name) ;
380
381 name = hdrl_join_string(".", 2, prefix, "obj.threshold");
382 par = cpl_parameterlist_find_const(parlist, name);
383 obj_threshold = cpl_parameter_get_double(par);
384 cpl_free(name) ;
385
386 name = hdrl_join_string(".", 2, prefix, "obj.deblending");
387 par = cpl_parameterlist_find_const(parlist, name);
388 obj_deblending = cpl_parameter_get_bool(par);
389 cpl_free(name) ;
390
391 name = hdrl_join_string(".", 2, prefix, "obj.core-radius");
392 par=cpl_parameterlist_find_const(parlist, name);
393 obj_core_radius = cpl_parameter_get_double(par);
394 cpl_free(name) ;
395
396 name = hdrl_join_string(".", 2, prefix, "bkg.estimate");
397 par = cpl_parameterlist_find_const(parlist, name);
398 bkg_estimate = cpl_parameter_get_bool(par);
399 cpl_free(name) ;
400
401 name = hdrl_join_string(".", 2, prefix, "bkg.mesh-size");
402 par = cpl_parameterlist_find_const(parlist, name);
403 bkg_mesh_size = cpl_parameter_get_int(par);
404 cpl_free(name) ;
405
406 name = hdrl_join_string(".", 2, prefix, "bkg.smooth-gauss-fwhm");
407 par = cpl_parameterlist_find_const(parlist, name);
408 bkg_smooth_fwhm = cpl_parameter_get_double(par);
409 cpl_free(name) ;
410
411 name = hdrl_join_string(".", 2, prefix, "det.effective-gain");
412 par = cpl_parameterlist_find_const(parlist, name);
413 det_eff_gain = cpl_parameter_get_double(par);
414 cpl_free(name) ;
415
416 name = hdrl_join_string(".", 2, prefix, "det.saturation");
417 par = cpl_parameterlist_find_const(parlist, name);
418 det_saturation = cpl_parameter_get_double(par);
419 cpl_free(name) ;
420
421 if (cpl_error_get_code()) {
422 cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
423 "Error while parsing parameterlist with prefix %s", prefix);
424 return NULL;
425 } else {
426 return hdrl_catalogue_parameter_create(obj_min_pixels, obj_threshold,
427 obj_deblending, obj_core_radius,
428 bkg_estimate,
429 bkg_mesh_size, bkg_smooth_fwhm,
430 det_eff_gain, det_saturation,
431 HDRL_CATALOGUE_ALL);
432 }
433
434}
435
436/*----------------------------------------------------------------------------*/
441/*----------------------------------------------------------------------------*/
442void hdrl_catalogue_result_delete(hdrl_catalogue_result * result)
443{
444 if (result == NULL) {
445 return;
446 }
447 cpl_table_delete(result->catalogue);
448 cpl_image_delete(result->background);
449 cpl_image_delete(result->segmentation_map);
450 cpl_propertylist_delete(result->qclist);
451 cpl_free(result);
452}
453/*----------------------------------------------------------------------------*/
463/*----------------------------------------------------------------------------*/
464hdrl_catalogue_result *
465hdrl_catalogue_compute(const cpl_image * image_, const cpl_image * confidence_map,
466 const cpl_wcs * wcs, hdrl_parameter * param_)
467{
468 return hdrl_catalogue_compute_internal(image_, confidence_map, wcs, param_,
469 CPL_FALSE);
470}
471
472/*----------------------------------------------------------------------------*/
486/*----------------------------------------------------------------------------*/
487hdrl_catalogue_result *
488hdrl_catalogue_compute_experimental(const cpl_image * image_,
489 const cpl_image * confidence_map,
490 const cpl_wcs * wcs, hdrl_parameter * param_)
491{
492 return hdrl_catalogue_compute_internal(image_, confidence_map, wcs, param_,
493 CPL_TRUE);
494}
495
496static hdrl_catalogue_result *
497hdrl_catalogue_compute_internal(const cpl_image * image_,
498 const cpl_image * confidence_map,
499 const cpl_wcs * wcs, hdrl_parameter * param_,
500 cpl_boolean include_experimental_qc)
501{
502 hdrl_casu_fits *inf,*inconf = NULL;
503 hdrl_casu_result * intres = NULL;
504 cpl_ensure(image_, CPL_ERROR_NULL_INPUT, NULL);
505 if (hdrl_catalogue_parameter_verify((hdrl_parameter *)param_)) {
506 return NULL;
507 }
508
509 CPL_DIAG_PRAGMA_PUSH_IGN(-Wcast-qual);
510
511 hdrl_catalogue_result * res = NULL;
512 const hdrl_catalogue_parameter * param = (hdrl_catalogue_parameter *)param_;
513 cpl_image * image = (cpl_image *)image_;
514 if (cpl_image_get_type(image) != CPL_TYPE_DOUBLE) {
515 image = cpl_image_cast(image, CPL_TYPE_DOUBLE);
516 }
517
518 inf = hdrl_casu_fits_wrap((cpl_image *)image);
519
520 cpl_image * conf_ = (cpl_image*)confidence_map;
521
522 CPL_DIAG_PRAGMA_POP;
523
524
525 if (confidence_map) {
526 if (cpl_image_get_min(confidence_map) < 0) {
527 cpl_error_set_message(cpl_func, CPL_ERROR_INCOMPATIBLE_INPUT,
528 "confidence_map must only contain "
529 "positive numbers");
530 goto cleanup;
531 }
532 }
533
534 if (cpl_image_get_bpm_const(image) != NULL) {
535 if (confidence_map) {
536 conf_ = cpl_image_cast(confidence_map, CPL_TYPE_DOUBLE);
537 }
538 else {
539 conf_ = cpl_image_new(cpl_image_get_size_x(image),
540 cpl_image_get_size_y(image), CPL_TYPE_DOUBLE);
541 cpl_image_add_scalar(conf_, 100);
542 }
543 cpl_image_reject_from_mask(conf_, cpl_image_get_bpm_const(image));
544 cpl_image_fill_rejected(conf_, 0);
545 cpl_image_accept_all(conf_);
546 }
547 else if (confidence_map &&
548 cpl_image_get_type(confidence_map) != CPL_TYPE_DOUBLE) {
549 conf_ = cpl_image_cast(confidence_map, CPL_TYPE_DOUBLE);
550 }
551 inconf = hdrl_casu_fits_wrap((cpl_image *)conf_);
552
553 /* Run catalogue */
554 res = cpl_calloc(1, sizeof(hdrl_catalogue_result));
555 intres = cpl_calloc(1, sizeof(hdrl_casu_result));
556 hdrl_casu_catalogue(inf, inconf, wcs,
557 param->obj_min_pixels, param->obj_threshold,
558 param->obj_deblending, param->obj_core_radius,
559 param->bkg_estimate,
560 param->bkg_mesh_size, (int)param->resulttype,
561 param->bkg_smooth_fwhm, param->det_eff_gain,
562 param->det_saturation, intres);
563
564 if (intres->catalogue) {
565 res->catalogue = cpl_table_duplicate( hdrl_casu_tfits_get_table(intres->catalogue));
566 res->qclist = cpl_propertylist_duplicate(hdrl_casu_tfits_get_ehu( intres->catalogue));
567 hdrl_cleanup_qclist(res->qclist, include_experimental_qc);
568 }
569 res->segmentation_map = intres->segmentation_map;
570 res->background = intres->background;
571
572cleanup:
573 inf->image = NULL;
574 if (image_ != image) {
575 cpl_image_delete(image);
576 }
577 if (inconf && inconf->image == confidence_map) {
578 inconf->image = NULL;
579 }
581 if (intres) {
582 hdrl_casu_tfits_delete(intres->catalogue);
583 }
584 hdrl_casu_fits_delete(inconf);
585 cpl_free(intres);
586
587 return res;
588}
589
590/*----------------------------------------------------------------------------*/
596
597static cpl_error_code hdrl_cleanup_qclist(cpl_propertylist * qclist,
598 cpl_boolean include_experimental_qc){
599
600 cpl_propertylist * qclocal = cpl_propertylist_duplicate(qclist);
601 cpl_propertylist_empty(qclist);
602
603 if (cpl_propertylist_has(qclocal, "APCOR1"))
604 cpl_propertylist_copy_property(qclist, qclocal, "APCOR1");
605 if (cpl_propertylist_has(qclocal, "APCOR2"))
606 cpl_propertylist_copy_property(qclist, qclocal, "APCOR2");
607 if (cpl_propertylist_has(qclocal, "APCOR3"))
608 cpl_propertylist_copy_property(qclist, qclocal, "APCOR3");
609 if (cpl_propertylist_has(qclocal, "APCOR4"))
610 cpl_propertylist_copy_property(qclist, qclocal, "APCOR4");
611 if (cpl_propertylist_has(qclocal, "APCOR5"))
612 cpl_propertylist_copy_property(qclist, qclocal, "APCOR5");
613 if (cpl_propertylist_has(qclocal, "APCOR6"))
614 cpl_propertylist_copy_property(qclist, qclocal, "APCOR6");
615 if (cpl_propertylist_has(qclocal, "APCOR7"))
616 cpl_propertylist_copy_property(qclist, qclocal, "APCOR7");
617 if (cpl_propertylist_has(qclocal, "APCORPK"))
618 cpl_propertylist_copy_property(qclist, qclocal, "APCORPK");
619 if (cpl_propertylist_has(qclocal, "SYMBOL1"))
620 cpl_propertylist_copy_property(qclist, qclocal, "SYMBOL1");
621 if (cpl_propertylist_has(qclocal, "SYMBOL2"))
622 cpl_propertylist_copy_property(qclist, qclocal, "SYMBOL2");
623 if (cpl_propertylist_has(qclocal, "SYMBOL3"))
624 cpl_propertylist_copy_property(qclist, qclocal, "SYMBOL3");
625 if (cpl_propertylist_has(qclocal, "SYMBOL4"))
626 cpl_propertylist_copy_property(qclist, qclocal, "SYMBOL4");
627 if (cpl_propertylist_has(qclocal, "SYMBOL5"))
628 cpl_propertylist_copy_property(qclist, qclocal, "SYMBOL5");
629 if (cpl_propertylist_has(qclocal, "SYMBOL6"))
630 cpl_propertylist_copy_property(qclist, qclocal, "SYMBOL6");
631 if (cpl_propertylist_has(qclocal, "SYMBOL7"))
632 cpl_propertylist_copy_property(qclist, qclocal, "SYMBOL7");
633 if (cpl_propertylist_has(qclocal, "SYMBOL8"))
634 cpl_propertylist_copy_property(qclist, qclocal, "SYMBOL8");
635 if (cpl_propertylist_has(qclocal, "SYMBOL9"))
636 cpl_propertylist_copy_property(qclist, qclocal, "SYMBOL9");
637
638 /* Keep baseline qclist cleanup, and optionally append experimental keys. */
639 if (include_experimental_qc) {
640 if (cpl_propertylist_has(qclocal, "ESO DRS CLASSIFD"))
641 cpl_propertylist_copy_property(qclist, qclocal, "ESO DRS CLASSIFD");
642 if (cpl_propertylist_has(qclocal, "ESO DRS CROWDED"))
643 cpl_propertylist_copy_property(qclist, qclocal, "ESO DRS CROWDED");
644 if (cpl_propertylist_has(qclocal, "ESO DRS FILTFWHM"))
645 cpl_propertylist_copy_property(qclist, qclocal, "ESO DRS FILTFWHM");
646 if (cpl_propertylist_has(qclocal, "ESO DRS MINPIX"))
647 cpl_propertylist_copy_property(qclist, qclocal, "ESO DRS MINPIX");
648 if (cpl_propertylist_has(qclocal, "ESO DRS NXOUT"))
649 cpl_propertylist_copy_property(qclist, qclocal, "ESO DRS NXOUT");
650 if (cpl_propertylist_has(qclocal, "ESO DRS NYOUT"))
651 cpl_propertylist_copy_property(qclist, qclocal, "ESO DRS NYOUT");
652 if (cpl_propertylist_has(qclocal, "ESO DRS RCORE"))
653 cpl_propertylist_copy_property(qclist, qclocal, "ESO DRS RCORE");
654 if (cpl_propertylist_has(qclocal, "ESO DRS SEEING"))
655 cpl_propertylist_copy_property(qclist, qclocal, "ESO DRS SEEING");
656 if (cpl_propertylist_has(qclocal, "ESO DRS THRESHOL"))
657 cpl_propertylist_copy_property(qclist, qclocal, "ESO DRS THRESHOL");
658 if (cpl_propertylist_has(qclocal, "ESO DRS XCOL"))
659 cpl_propertylist_copy_property(qclist, qclocal, "ESO DRS XCOL");
660 if (cpl_propertylist_has(qclocal, "ESO DRS YCOL"))
661 cpl_propertylist_copy_property(qclist, qclocal, "ESO DRS YCOL");
662 if (cpl_propertylist_has(qclocal, "ESO QC APERTURE_CORR"))
663 cpl_propertylist_copy_property(qclist, qclocal, "ESO QC APERTURE_CORR");
664 if (cpl_propertylist_has(qclocal, "ESO QC ELLIPTICITY"))
665 cpl_propertylist_copy_property(qclist, qclocal, "ESO QC ELLIPTICITY");
666 if (cpl_propertylist_has(qclocal, "ESO QC IMAGE_SIZE"))
667 cpl_propertylist_copy_property(qclist, qclocal, "ESO QC IMAGE_SIZE");
668 if (cpl_propertylist_has(qclocal, "ESO QC MEAN_SKY"))
669 cpl_propertylist_copy_property(qclist, qclocal, "ESO QC MEAN_SKY");
670 if (cpl_propertylist_has(qclocal, "ESO QC NOISE_OBJ"))
671 cpl_propertylist_copy_property(qclist, qclocal, "ESO QC NOISE_OBJ");
672 if (cpl_propertylist_has(qclocal, "ESO QC POSANG"))
673 cpl_propertylist_copy_property(qclist, qclocal, "ESO QC POSANG");
674 if (cpl_propertylist_has(qclocal, "ESO QC SATURATION"))
675 cpl_propertylist_copy_property(qclist, qclocal, "ESO QC SATURATION");
676 if (cpl_propertylist_has(qclocal, "ESO QC SKY_NOISE"))
677 cpl_propertylist_copy_property(qclist, qclocal, "ESO QC SKY_NOISE");
678 if (cpl_propertylist_has(qclocal, "HISTORY"))
679 cpl_propertylist_copy_property(qclist, qclocal, "HISTORY");
680 }
681
682 cpl_propertylist_delete(qclocal);
683
684 return cpl_error_get_code();
685}
hdrl_casu_fits * hdrl_casu_fits_wrap(cpl_image *im)
Wrap an image in a hdrl_casu_fits wrapper.
cpl_propertylist * hdrl_casu_tfits_get_ehu(hdrl_casu_tfits *p)
Get the propertylist for the extension header for a given hdrl_casu_tfits image.
void hdrl_casu_tfits_delete(hdrl_casu_tfits *p)
Free all the workspace associated with a hdrl_casu_fits object.
void hdrl_casu_fits_delete(hdrl_casu_fits *p)
Free all the workspace associated with a hdrl_casu_fits object.
cpl_table * hdrl_casu_tfits_get_table(hdrl_casu_tfits *p)
Get the CPL table from the hdrl_casu_tfits object.
cpl_error_code hdrl_casu_catalogue(hdrl_casu_fits *infile, hdrl_casu_fits *conf, const cpl_wcs *wcs, cpl_size ipix, double threshold, cpl_size icrowd, double rcore, cpl_size bkg_subtr, cpl_size nbsize, hdrl_catalogue_options cattype, double filtfwhm, double gainloc, double saturation, hdrl_casu_result *res)
Generate object catalogues from input images.
hdrl_catalogue_result * hdrl_catalogue_compute(const cpl_image *image_, const cpl_image *confidence_map, const cpl_wcs *wcs, hdrl_parameter *param_)
build object catalog
hdrl_catalogue_result * hdrl_catalogue_compute_experimental(const cpl_image *image_, const cpl_image *confidence_map, const cpl_wcs *wcs, hdrl_parameter *param_)
build object catalog (experimental QC mode)
void hdrl_catalogue_result_delete(hdrl_catalogue_result *result)
delete hdrl parameter result object
hdrl_parameter * hdrl_catalogue_parameter_create(int obj_min_pixels, double obj_threshold, cpl_boolean obj_deblending, double obj_core_radius, cpl_boolean bkg_estimate, int bkg_mesh_size, double bkg_smooth_fwhm, double det_eff_gain, double det_saturation, hdrl_catalogue_options resulttype)
Creates catalogue Parameters object.
cpl_boolean hdrl_catalogue_parameter_check(const hdrl_parameter *self)
Check that the parameter is a catalogue parameter.
hdrl_parameter * hdrl_catalogue_parameter_parse_parlist(const cpl_parameterlist *parlist, const char *prefix)
Parse parameter list to create input parameters for the catalogue.
cpl_parameterlist * hdrl_catalogue_parameter_create_parlist(const char *base_context, const char *prefix, hdrl_parameter *defaults)
Create parameter list for the catalogue computation.
cpl_error_code hdrl_catalogue_parameter_set_option(hdrl_parameter *par, hdrl_catalogue_options opt)
set result option of catalogue parameter
char * hdrl_join_string(const char *sep_, int n,...)
join strings together
Definition hdrl_utils.c:810