CR2RE Pipeline Reference Manual 1.7.0
hdrl_imagelist_basic.c
1/*
2 * This file is part of the HDRL
3 * Copyright (C) 2013 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 "hdrl_imagelist.h"
29#include "hdrl_imagelist_view.h"
30#include "hdrl_imagelist_defs.h"
31#include "hdrl_image.h"
32#include "hdrl_collapse.h"
33
34#include <cpl.h>
35#include <assert.h>
36
37
38/*----------------------------------------------------------------------------*/
46/*----------------------------------------------------------------------------*/
47
49
50/*-----------------------------------------------------------------------------
51 Define
52 -----------------------------------------------------------------------------*/
53
54/*----------------------------------------------------------------------------*/
59/*----------------------------------------------------------------------------*/
60typedef enum {
61 HDRL_IMLIST_BASIC_IMLIST = 0,
62 HDRL_IMLIST_BASIC_IMAGE,
63 HDRL_IMLIST_BASIC_SCALAR
65
66typedef cpl_error_code (*hdrl_f_image)(hdrl_image *, const hdrl_image *);
67typedef cpl_error_code (*hdrl_f_scalar)(hdrl_image *, hdrl_value);
68
69/* Union to avoid function pointer to void pointer conversion warnings */
70typedef union {
71 hdrl_f_image f_image;
72 hdrl_f_scalar f_scalar;
73} hdrl_func_ptr;
74
75/*-----------------------------------------------------------------------------
76 Static Prototypes
77 -----------------------------------------------------------------------------*/
78
79static cpl_error_code hdrl_imagelist_basic_operation(
81 hdrl_func_ptr func,
82 hdrl_imagelist *himlist1,
83 const hdrl_imagelist *himlist2,
84 const hdrl_image *himg,
85 hdrl_value *value);
86
87static cpl_error_code hdrl_imagelist_collapse_interface(
88 const hdrl_imagelist *himlist,
89 hdrl_collapse_imagelist_to_image_t *collapse_method,
90 hdrl_image **out,
91 cpl_image **contrib,
92 void **eout);
93
94/*-----------------------------------------------------------------------------
95 Function codes
96 -----------------------------------------------------------------------------*/
97
98/*----------------------------------------------------------------------------*/
113/*----------------------------------------------------------------------------*/
115 hdrl_imagelist * himlist1,
116 const hdrl_imagelist * himlist2)
117{
118 return hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_IMLIST,
119 (hdrl_func_ptr){.f_image = hdrl_image_add_image}, himlist1, himlist2, NULL, NULL);
120}
121
122/*----------------------------------------------------------------------------*/
131/*----------------------------------------------------------------------------*/
133 hdrl_imagelist * himlist1,
134 const hdrl_imagelist * himlist2)
135{
136 return hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_IMLIST,
137 (hdrl_func_ptr){.f_image = hdrl_image_sub_image}, himlist1, himlist2, NULL, NULL);
138}
139
140/*----------------------------------------------------------------------------*/
149/*----------------------------------------------------------------------------*/
151 hdrl_imagelist * himlist1,
152 const hdrl_imagelist * himlist2)
153{
154 return hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_IMLIST,
155 (hdrl_func_ptr){.f_image = hdrl_image_mul_image}, himlist1, himlist2, NULL, NULL);
156}
157
158/*----------------------------------------------------------------------------*/
167/*----------------------------------------------------------------------------*/
169 hdrl_imagelist * himlist1,
170 const hdrl_imagelist * himlist2)
171{
172 return hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_IMLIST,
173 (hdrl_func_ptr){.f_image = hdrl_image_div_image}, himlist1, himlist2, NULL, NULL);
174}
175
176
177/*----------------------------------------------------------------------------*/
190/*----------------------------------------------------------------------------*/
192 hdrl_imagelist * himlist,
193 const hdrl_image * himg)
194{
195 return hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_IMAGE,
196 (hdrl_func_ptr){.f_image = hdrl_image_add_image}, himlist, NULL, himg, NULL);
197}
198
199/*----------------------------------------------------------------------------*/
213/*----------------------------------------------------------------------------*/
215 hdrl_imagelist * himlist,
216 const hdrl_image * himg)
217{
218 return hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_IMAGE,
219 (hdrl_func_ptr){.f_image = hdrl_image_sub_image}, himlist, NULL, himg, NULL);
220}
221
222/*----------------------------------------------------------------------------*/
236/*----------------------------------------------------------------------------*/
238 hdrl_imagelist * himlist,
239 const hdrl_image * himg)
240{
241 return hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_IMAGE,
242 (hdrl_func_ptr){.f_image = hdrl_image_mul_image}, himlist, NULL, himg, NULL);
243}
244
245/*----------------------------------------------------------------------------*/
259/*----------------------------------------------------------------------------*/
261 hdrl_imagelist * himlist,
262 const hdrl_image * himg)
263{
264 return hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_IMAGE,
265 (hdrl_func_ptr){.f_image = hdrl_image_div_image}, himlist, NULL, himg, NULL);
266}
267
268
269
270/*----------------------------------------------------------------------------*/
281/*----------------------------------------------------------------------------*/
283 hdrl_imagelist * himlist,
284 hdrl_value value)
285{
286 const cpl_error_code code =
287 hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_SCALAR,
288 (hdrl_func_ptr){.f_scalar = hdrl_image_add_scalar},
289 himlist, NULL, NULL, &value);
290 return code ? cpl_error_set_where(cpl_func) : CPL_ERROR_NONE;
291}
292
293/*----------------------------------------------------------------------------*/
305/*----------------------------------------------------------------------------*/
307 hdrl_imagelist * himlist,
308 hdrl_value value)
309{
310 const cpl_error_code code =
311 hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_SCALAR,
312 (hdrl_func_ptr){.f_scalar = hdrl_image_sub_scalar},
313 himlist, NULL, NULL, &value);
314 return code ? cpl_error_set_where(cpl_func) : CPL_ERROR_NONE;
315}
316
317/*----------------------------------------------------------------------------*/
329/*----------------------------------------------------------------------------*/
331 hdrl_imagelist * himlist,
332 hdrl_value value)
333{
334 const cpl_error_code code =
335 hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_SCALAR,
336 (hdrl_func_ptr){.f_scalar = hdrl_image_mul_scalar},
337 himlist, NULL, NULL, &value);
338 return code ? cpl_error_set_where(cpl_func) : CPL_ERROR_NONE;
339}
340
341/*----------------------------------------------------------------------------*/
353/*----------------------------------------------------------------------------*/
355 hdrl_imagelist * himlist,
356 hdrl_value value)
357{
358 return hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_SCALAR,
359 (hdrl_func_ptr){.f_scalar = hdrl_image_div_scalar}, himlist,
360 NULL, NULL, &value);
361}
362
363
364/*----------------------------------------------------------------------------*/
375/*----------------------------------------------------------------------------*/
377 hdrl_imagelist * himlist,
378 hdrl_value exponent)
379{
380 cpl_ensure_code(himlist != NULL, CPL_ERROR_NULL_INPUT);
381
382 cpl_size nima = hdrl_imagelist_get_size(himlist) ;
383 for (cpl_size i = 0 ; i<nima ; i++) {
384 cpl_ensure_code(!hdrl_image_pow_scalar(hdrl_imagelist_get(himlist, i),
385 exponent), cpl_error_get_code());
386 }
387 return CPL_ERROR_NONE;
388}
389
390/*----------------------------------------------------------------------------*/
412/* ---------------------------------------------------------------------------*/
414 const hdrl_imagelist * himlist,
415 const hdrl_parameter * param,
416 hdrl_image ** out,
417 cpl_image ** contrib)
418{
419 cpl_ensure_code(himlist, CPL_ERROR_NULL_INPUT);
420 cpl_ensure_code(param, CPL_ERROR_NULL_INPUT);
421 cpl_ensure_code(out, CPL_ERROR_NULL_INPUT);
422 cpl_ensure_code(contrib, CPL_ERROR_NULL_INPUT);
423
425 hdrl_imagelist_collapse_mean(himlist, out, contrib);
426 }
428 hdrl_imagelist_collapse_weighted_mean(himlist, out, contrib);
429 }
430 else if (hdrl_collapse_parameter_is_median(param)) {
431 hdrl_imagelist_collapse_median(himlist, out, contrib);
432 }
433 else if (hdrl_collapse_parameter_is_sigclip(param)) {
438 out, contrib, NULL, NULL);
439 }
440 else if (hdrl_collapse_parameter_is_minmax(param)) {
444 out, contrib, NULL, NULL);
445 }
446 else if (hdrl_collapse_parameter_is_mode(param)) {
453 out, contrib);
454 }
455 else {
456 return cpl_error_set_message(cpl_func, CPL_ERROR_UNSUPPORTED_MODE,
457 "Invalid parameter input for "
458 "hdrl_imagelist_collapse");
459 }
460
461 return cpl_error_get_code();
462}
463
464/*----------------------------------------------------------------------------*/
475/* ---------------------------------------------------------------------------*/
477 const hdrl_imagelist * himlist,
478 hdrl_image ** out,
479 cpl_image ** contrib)
480{
481 hdrl_collapse_imagelist_to_image_t * method =
482 hdrl_collapse_imagelist_to_image_mean();
483 hdrl_imagelist_collapse_interface(himlist, method, out, contrib, NULL) ;
484 hdrl_collapse_imagelist_to_image_delete(method) ;
485 return cpl_error_get_code();
486}
487
488/*----------------------------------------------------------------------------*/
499/* ---------------------------------------------------------------------------*/
501 const hdrl_imagelist * himlist,
502 hdrl_image ** out,
503 cpl_image ** contrib)
504{
505 hdrl_collapse_imagelist_to_image_t * method =
506 hdrl_collapse_imagelist_to_image_weighted_mean();
507 hdrl_imagelist_collapse_interface(himlist, method, out, contrib, NULL) ;
508 hdrl_collapse_imagelist_to_image_delete(method) ;
509 return cpl_error_get_code();
510}
511
512/*----------------------------------------------------------------------------*/
523/* ---------------------------------------------------------------------------*/
525 const hdrl_imagelist * himlist,
526 hdrl_image ** out,
527 cpl_image ** contrib)
528{
529 hdrl_collapse_imagelist_to_image_t * method =
530 hdrl_collapse_imagelist_to_image_median();
531 hdrl_imagelist_collapse_interface(himlist, method, out, contrib, NULL) ;
532 hdrl_collapse_imagelist_to_image_delete(method) ;
533 return cpl_error_get_code();
534}
535
536/*----------------------------------------------------------------------------*/
553/* ---------------------------------------------------------------------------*/
555 const hdrl_imagelist * himlist,
556 double kappa_low,
557 double kappa_high,
558 int niter,
559 hdrl_image ** out,
560 cpl_image ** contrib,
561 cpl_image ** reject_low,
562 cpl_image ** reject_high)
563{
564 hdrl_sigclip_image_output * sigclipout;
565 hdrl_collapse_imagelist_to_image_t * method =
566 hdrl_collapse_imagelist_to_image_sigclip(kappa_low, kappa_high, niter);
567 hdrl_imagelist_collapse_interface(himlist, method, out, contrib, (void**)&sigclipout);
568
569 if (cpl_error_get_code() != CPL_ERROR_NONE) {
570
571 hdrl_collapse_imagelist_to_image_delete(method);
572
573 if (reject_low) {
574 *reject_low = NULL;
575 }
576
577 if (reject_high) {
578 *reject_high = NULL;
579 }
580
581 return cpl_error_get_code();
582 }
583
584 if (reject_low) {
585 *reject_low = sigclipout->reject_low;
586 } else {
587 cpl_image_delete(sigclipout->reject_low);
588 }
589
590 if (reject_high) {
591 *reject_high = sigclipout->reject_high;
592 } else {
593 cpl_image_delete(sigclipout->reject_high);
594 }
595
596 hdrl_collapse_imagelist_to_image_unwrap_eout(method, sigclipout);
597 hdrl_collapse_imagelist_to_image_delete(method);
598
599 return cpl_error_get_code();
600}
601
602/*----------------------------------------------------------------------------*/
618/* ---------------------------------------------------------------------------*/
620 const hdrl_imagelist * himlist,
621 double nlow,
622 double nhigh,
623 hdrl_image ** out,
624 cpl_image ** contrib,
625 cpl_image ** reject_low,
626 cpl_image ** reject_high)
627{
628 hdrl_minmax_image_output * minmaxout;
629 hdrl_collapse_imagelist_to_image_t * method =
630 hdrl_collapse_imagelist_to_image_minmax(nlow, nhigh);
631 hdrl_imagelist_collapse_interface(himlist, method, out, contrib, (void**)&minmaxout);
632
633 if (cpl_error_get_code() != CPL_ERROR_NONE) {
634
635 hdrl_collapse_imagelist_to_image_delete(method);
636
637 if (reject_low) {
638 *reject_low = NULL;
639 }
640
641 if (reject_high) {
642 *reject_high = NULL;
643 }
644
645 return cpl_error_get_code();
646 }
647
648 if (reject_low) {
649 *reject_low = minmaxout->reject_low;
650 } else {
651 cpl_image_delete(minmaxout->reject_low);
652 }
653
654 if (reject_high) {
655 *reject_high = minmaxout->reject_high;
656 } else {
657 cpl_image_delete(minmaxout->reject_high);
658 }
659
660 hdrl_collapse_imagelist_to_image_unwrap_eout(method, minmaxout);
661 hdrl_collapse_imagelist_to_image_delete(method);
662
663 return cpl_error_get_code();
664}
665
666
667
668
669/*----------------------------------------------------------------------------*/
685/* ---------------------------------------------------------------------------*/
686cpl_error_code hdrl_imagelist_collapse_mode(const hdrl_imagelist * himlist,
687 double histo_min,
688 double histo_max,
689 double bin_size,
690 hdrl_mode_type mode_method,
691 cpl_size error_niter,
692 hdrl_image ** out,
693 cpl_image ** contrib)
694{
695 hdrl_collapse_imagelist_to_image_t * method =
696 hdrl_collapse_imagelist_to_image_mode(histo_min, histo_max, bin_size,
697 mode_method, error_niter );
698 hdrl_imagelist_collapse_interface(himlist, method, out, contrib, NULL) ;
699 hdrl_collapse_imagelist_to_image_delete(method) ;
700 return cpl_error_get_code();
701}
702
703
704
705
706
707
708
709
710
711
712/*----------------------------------------------------------------------------*/
725/* ---------------------------------------------------------------------------*/
726static cpl_error_code hdrl_imagelist_collapse_interface(
727 const hdrl_imagelist * himlist,
728 hdrl_collapse_imagelist_to_image_t * collapse_method,
729 hdrl_image ** out,
730 cpl_image ** contrib,
731 void ** eout)
732{
733 cpl_error_code fail = CPL_ERROR_NONE;
734
735 /* Check inputs */
736 cpl_ensure_code(himlist != NULL, CPL_ERROR_NULL_INPUT);
737 cpl_ensure_code(out != NULL, CPL_ERROR_NULL_INPUT);
738 cpl_ensure_code(contrib != NULL, CPL_ERROR_NULL_INPUT);
739
740 cpl_size nz = hdrl_imagelist_get_size(himlist);
741 cpl_size nx = hdrl_imagelist_get_size_x(himlist);
742 cpl_size ny = hdrl_imagelist_get_size_y(himlist);
743 if (cpl_error_get_code() != CPL_ERROR_NONE) {
744 return cpl_error_get_code();
745 }
746
747 *out = hdrl_image_new(nx, ny);
748 *contrib = cpl_image_new( nx, ny, CPL_TYPE_INT);
749
750 /* make sure we have masks else the copy into these is not threadsafe */
751 cpl_image_get_bpm(*contrib);
753
754 /* create full extra output */
755 if (eout) {
756 *eout = hdrl_collapse_imagelist_to_image_create_eout(
757 collapse_method, hdrl_image_get_image(hdrl_imagelist_get(himlist, 0)));
758 }
759
760 /* get blocks that can be processed in parallel
761 * small blocksize better for cache but currently excessive malloc/free
762 * prevents making it smaller */
763 cpl_size blocksize = 16ul * (1ul<<20ul) / (nz * nx * sizeof(double));
764 hdrl_iter *it = hdrl_imagelist_get_iter_row_slices(himlist, blocksize, 0, HDRL_ITER_CONST);
765
766 cpl_size nit = hdrl_iter_length(it);
767 hdrl_imagelist *vl[nit];
768 cpl_size yl[nit];
769
770 {
771 cpl_size i = 0;
772 cpl_size y = 1;
773 for (hdrl_imagelist * v = hdrl_iter_next(it);
774 v != NULL;
775 v = hdrl_iter_next(it)) {
776 vl[i] = v;
777 yl[i++] = y;
779 }
780 }
781
782 hdrl_iter_delete(it);
783
784 if (cpl_error_get_code() != CPL_ERROR_NONE) {
785 for (cpl_size i = 0; i < nit; i++) {
787 }
788 return cpl_error_get_code();
789 }
790
791 HDRL_OMP(omp parallel for)
792 for (cpl_size i = 0; i < nit; i++) {
793
794 cpl_image *out_data;
795 cpl_image *out_errors;
796 cpl_image *out_contrib;
797
798 cpl_imagelist *data;
799 cpl_imagelist *errors;
800
801 void *out_eout;
802
803 hdrl_imagelist *v = vl[i];
804 cpl_size y = yl[i];
805
806 /* Build the Inputs Interface */
807 hdrl_imagelist_to_cplwrap(v, &data, &errors);
808
809 /* Call the actual collapsing */
810 hdrl_collapse_imagelist_to_image_call(collapse_method, data, errors,
811 &out_data, &out_errors,
812 &out_contrib, &out_eout);
813
814 if (cpl_error_get_code() != CPL_ERROR_NONE) {
815
816 fail = cpl_error_get_code();
817 cpl_imagelist_unwrap(data) ;
818 cpl_imagelist_unwrap(errors) ;
820
821 } else {
822
823 cpl_msg_debug(cpl_func, "Collapsed block %lld to %lld", y,
824 y + cpl_image_get_size_y(out_data) - 1);
825
826 /* TODO make use of output image views to avoid copying */
827 assert(hdrl_image_get_mask_const(*out));
828 assert(cpl_image_get_bpm_const(*contrib));
829 hdrl_image_insert(*out, out_data, out_errors, 1, y);
830 cpl_image_copy(*contrib, out_contrib, 1, y);
831
832 /* copy and delete slice extra out */
833 if (out_eout) {
834 hdrl_collapse_imagelist_to_image_move_eout(collapse_method,
835 *eout, out_eout, y);
836 }
837
838 /* Destroy the Inputs Interface */
839 cpl_image_delete(out_data);
840 cpl_image_delete(out_errors);
841 cpl_image_delete(out_contrib);
842 cpl_imagelist_unwrap(data) ;
843 cpl_imagelist_unwrap(errors) ;
845 }
846 }
847
848 if (fail != CPL_ERROR_NONE) {
849
850 if (eout) {
851 hdrl_collapse_imagelist_to_image_delete_eout(collapse_method, *eout);
852 }
853
854 hdrl_image_delete(*out);
855 cpl_image_delete(*contrib);
856
857 return cpl_error_set_message(cpl_func, fail, "hdrl_imagelist_collapse failed");
858 }
859
860 return cpl_error_get_code();
861}
862
863/*----------------------------------------------------------------------------*/
877/*----------------------------------------------------------------------------*/
878static cpl_error_code hdrl_imagelist_basic_operation(
880 hdrl_func_ptr func,
881 hdrl_imagelist *himlist1,
882 const hdrl_imagelist *himlist2,
883 const hdrl_image *himg,
884 hdrl_value *value){
885
886 /* Check input */
887 cpl_ensure_code(himlist1, CPL_ERROR_NULL_INPUT);
888
889 switch (type) {
890 case HDRL_IMLIST_BASIC_IMLIST:
891 cpl_ensure_code(func.f_image, CPL_ERROR_NULL_INPUT);
892 cpl_ensure_code(himlist2, CPL_ERROR_NULL_INPUT);
893 cpl_ensure_code(himlist1->ni == himlist2->ni,
894 CPL_ERROR_INCOMPATIBLE_INPUT);
895 break;
896 case HDRL_IMLIST_BASIC_IMAGE:
897 cpl_ensure_code(func.f_image, CPL_ERROR_NULL_INPUT);
898 cpl_ensure_code(himg, CPL_ERROR_NULL_INPUT);
899 break;
900 case HDRL_IMLIST_BASIC_SCALAR:
901 cpl_ensure_code(func.f_scalar, CPL_ERROR_NULL_INPUT);
902 cpl_ensure_code(value, CPL_ERROR_NULL_INPUT);
903 break;
904 }
905
906 /* Loop and apply the operation */
907 for (cpl_size i = 0; i < himlist1->ni; i++) {
908 cpl_error_code err = CPL_ERROR_NONE;
909 switch (type) {
910 case HDRL_IMLIST_BASIC_IMLIST:
911 {
912 err = func.f_image(himlist1->images[i], himlist2->images[i]);
913 break;
914 }
915 case HDRL_IMLIST_BASIC_IMAGE:
916 {
917 err = func.f_image(himlist1->images[i], himg);
918 break;
919 }
920 case HDRL_IMLIST_BASIC_SCALAR:
921 err = func.f_scalar(himlist1->images[i], *value);
922 break;
923 }
924 cpl_ensure_code(err == CPL_ERROR_NONE, err);
925 }
926
927 return CPL_ERROR_NONE;
928}
929
double hdrl_collapse_mode_parameter_get_bin_size(const hdrl_parameter *p)
get size of the histogram bins
double hdrl_collapse_mode_parameter_get_histo_min(const hdrl_parameter *p)
get min value
cpl_boolean hdrl_collapse_parameter_is_weighted_mean(const hdrl_parameter *self)
check if parameter is a weighted mean parameter
double hdrl_collapse_sigclip_parameter_get_kappa_low(const hdrl_parameter *p)
get low kappa
cpl_boolean hdrl_collapse_parameter_is_mean(const hdrl_parameter *self)
check if parameter is a mean parameter
cpl_boolean hdrl_collapse_parameter_is_median(const hdrl_parameter *self)
check if parameter is a median parameter
double hdrl_collapse_mode_parameter_get_histo_max(const hdrl_parameter *p)
get high value
int hdrl_collapse_sigclip_parameter_get_niter(const hdrl_parameter *p)
get maximum number of clipping iterations
cpl_size hdrl_collapse_mode_parameter_get_error_niter(const hdrl_parameter *p)
get the error type of the mode
cpl_boolean hdrl_collapse_parameter_is_minmax(const hdrl_parameter *self)
check if parameter is a minmax mean parameter
cpl_boolean hdrl_collapse_parameter_is_mode(const hdrl_parameter *self)
check if parameter is a mode parameter
cpl_boolean hdrl_collapse_parameter_is_sigclip(const hdrl_parameter *self)
check if parameter is a sigclip mean parameter
double hdrl_collapse_sigclip_parameter_get_kappa_high(const hdrl_parameter *p)
get high kappa
double hdrl_collapse_minmax_parameter_get_nlow(const hdrl_parameter *p)
get low value
hdrl_mode_type hdrl_collapse_mode_parameter_get_method(const hdrl_parameter *p)
get the mode determination method
double hdrl_collapse_minmax_parameter_get_nhigh(const hdrl_parameter *p)
get high value
cpl_error_code hdrl_image_sub_image(hdrl_image *self, const hdrl_image *other)
Subtract two images, store the result in the first image.
cpl_error_code hdrl_image_div_scalar(hdrl_image *self, hdrl_value value)
Elementwise division of an image with a scalar.
cpl_error_code hdrl_image_pow_scalar(hdrl_image *self, const hdrl_value exponent)
computes the power of an image by a scalar
cpl_error_code hdrl_image_add_image(hdrl_image *self, const hdrl_image *other)
Add two images, store the result in the first image.
cpl_error_code hdrl_image_div_image(hdrl_image *self, const hdrl_image *other)
Divide two images, store the result in the first image.
cpl_error_code hdrl_image_mul_scalar(hdrl_image *self, hdrl_value value)
Elementwise multiplication of an image with a scalar.
cpl_mask * hdrl_image_get_mask(hdrl_image *himg)
get cpl bad pixel mask from image
Definition hdrl_image.c:157
cpl_error_code hdrl_image_add_scalar(hdrl_image *self, hdrl_value value)
Elementwise addition of a scalar to an image.
cpl_error_code hdrl_image_mul_image(hdrl_image *self, const hdrl_image *other)
Multiply two images, store the result in the first image.
const cpl_mask * hdrl_image_get_mask_const(const hdrl_image *himg)
get cpl bad pixel mask from image
Definition hdrl_image.c:175
cpl_error_code hdrl_image_insert(hdrl_image *self, const cpl_image *image, const cpl_image *error, cpl_size xpos, cpl_size ypos)
Copy cpl images into an hdrl image.
Definition hdrl_image.c:715
cpl_image * hdrl_image_get_image(hdrl_image *himg)
get data as cpl image
Definition hdrl_image.c:105
hdrl_image * hdrl_image_new(cpl_size nx, cpl_size ny)
create new zero filled hdrl image
Definition hdrl_image.c:311
void hdrl_image_delete(hdrl_image *himg)
delete hdrl_image
Definition hdrl_image.c:379
cpl_error_code hdrl_image_sub_scalar(hdrl_image *self, hdrl_value value)
Elementwise subtraction of a scalar from an image.
cpl_error_code hdrl_imagelist_collapse_sigclip(const hdrl_imagelist *himlist, double kappa_low, double kappa_high, int niter, hdrl_image **out, cpl_image **contrib, cpl_image **reject_low, cpl_image **reject_high)
Sigma-clipped collapsing of image list.
cpl_error_code hdrl_imagelist_div_imagelist(hdrl_imagelist *himlist1, const hdrl_imagelist *himlist2)
Divide two image lists, the first one is replaced by the result.
cpl_error_code hdrl_imagelist_add_scalar(hdrl_imagelist *himlist, hdrl_value value)
Elementwise addition of a scalar to each image in the himlist.
cpl_error_code hdrl_imagelist_collapse_mean(const hdrl_imagelist *himlist, hdrl_image **out, cpl_image **contrib)
Mean collapsing of image list.
cpl_size hdrl_imagelist_get_size_y(const hdrl_imagelist *himlist)
Get number of rows of images in the imagelist.
void hdrl_imagelist_delete(hdrl_imagelist *himlist)
Free all memory used by a hdrl_imagelist object including the images.
cpl_error_code hdrl_imagelist_add_image(hdrl_imagelist *himlist, const hdrl_image *himg)
Add an image to an image list.
cpl_error_code hdrl_imagelist_pow_scalar(hdrl_imagelist *himlist, hdrl_value exponent)
Compute the elementwise power of each image in the himlist.
hdrl_imagelist_basic_type
Define the kind of operation to apply.
cpl_size hdrl_imagelist_get_size(const hdrl_imagelist *himlist)
Get the number of images in the imagelist.
cpl_error_code hdrl_imagelist_div_scalar(hdrl_imagelist *himlist, hdrl_value value)
Elementwise division by a scalar to each image in the himlist.
cpl_error_code hdrl_imagelist_sub_image(hdrl_imagelist *himlist, const hdrl_image *himg)
Subtract an image from an image list.
cpl_error_code hdrl_imagelist_sub_scalar(hdrl_imagelist *himlist, hdrl_value value)
Elementwise subtraction of a scalar to each image in the himlist.
cpl_error_code hdrl_imagelist_collapse(const hdrl_imagelist *himlist, const hdrl_parameter *param, hdrl_image **out, cpl_image **contrib)
collapsing of image list
cpl_error_code hdrl_imagelist_mul_scalar(hdrl_imagelist *himlist, hdrl_value value)
Elementwise multiplication of a scalar to each image in the himlist.
cpl_error_code hdrl_imagelist_collapse_median(const hdrl_imagelist *himlist, hdrl_image **out, cpl_image **contrib)
Median collapsing of image list.
cpl_error_code hdrl_imagelist_mul_imagelist(hdrl_imagelist *himlist1, const hdrl_imagelist *himlist2)
Multiply two image lists, the first one is replaced by the result.
cpl_error_code hdrl_imagelist_add_imagelist(hdrl_imagelist *himlist1, const hdrl_imagelist *himlist2)
Add two image lists, the first one is replaced by the result.
cpl_error_code hdrl_imagelist_collapse_mode(const hdrl_imagelist *himlist, double histo_min, double histo_max, double bin_size, hdrl_mode_type mode_method, cpl_size error_niter, hdrl_image **out, cpl_image **contrib)
Mode collapsing of image list.
cpl_error_code hdrl_imagelist_sub_imagelist(hdrl_imagelist *himlist1, const hdrl_imagelist *himlist2)
Subtract two image lists, the first one is replaced by the result.
cpl_size hdrl_imagelist_get_size_x(const hdrl_imagelist *himlist)
Get number of colums of images in the imagelist.
cpl_error_code hdrl_imagelist_collapse_minmax(const hdrl_imagelist *himlist, double nlow, double nhigh, hdrl_image **out, cpl_image **contrib, cpl_image **reject_low, cpl_image **reject_high)
Minmax-clipped collapsing of image list.
cpl_error_code hdrl_imagelist_collapse_weighted_mean(const hdrl_imagelist *himlist, hdrl_image **out, cpl_image **contrib)
Weighted Mean collapsing of image list.
cpl_error_code hdrl_imagelist_mul_image(hdrl_imagelist *himlist, const hdrl_image *himg)
Multiply an image by an image list.
hdrl_image * hdrl_imagelist_get(const hdrl_imagelist *himlist, cpl_size inum)
Get an image from a list of images.
cpl_error_code hdrl_imagelist_div_image(hdrl_imagelist *himlist, const hdrl_image *himg)
Divide an image from an image list.