CR2RE Pipeline Reference Manual 1.6.7
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
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/*-----------------------------------------------------------------------------
70 Static Prototypes
71 -----------------------------------------------------------------------------*/
72
73static cpl_error_code hdrl_imagelist_basic_operation(
75 void *func,
76 hdrl_imagelist *himlist1,
77 const hdrl_imagelist *himlist2,
78 const hdrl_image *himg,
79 hdrl_value *value);
80
81static cpl_error_code hdrl_imagelist_collapse_interface(
82 const hdrl_imagelist *himlist,
83 hdrl_collapse_imagelist_to_image_t *collapse_method,
84 hdrl_image **out,
85 cpl_image **contrib,
86 void **eout);
87
88/*-----------------------------------------------------------------------------
89 Function codes
90 -----------------------------------------------------------------------------*/
91
92/*----------------------------------------------------------------------------*/
107/*----------------------------------------------------------------------------*/
109 hdrl_imagelist * himlist1,
110 const hdrl_imagelist * himlist2)
111{
112 return hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_IMLIST,
113 &hdrl_image_add_image, himlist1, himlist2, NULL, NULL);
114}
115
116/*----------------------------------------------------------------------------*/
125/*----------------------------------------------------------------------------*/
127 hdrl_imagelist * himlist1,
128 const hdrl_imagelist * himlist2)
129{
130 return hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_IMLIST,
131 &hdrl_image_sub_image, himlist1, himlist2, NULL, NULL);
132}
133
134/*----------------------------------------------------------------------------*/
143/*----------------------------------------------------------------------------*/
145 hdrl_imagelist * himlist1,
146 const hdrl_imagelist * himlist2)
147{
148 return hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_IMLIST,
149 &hdrl_image_mul_image, himlist1, himlist2, NULL, NULL);
150}
151
152/*----------------------------------------------------------------------------*/
161/*----------------------------------------------------------------------------*/
163 hdrl_imagelist * himlist1,
164 const hdrl_imagelist * himlist2)
165{
166 return hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_IMLIST,
167 &hdrl_image_div_image, himlist1, himlist2, NULL, NULL);
168}
169
170
171/*----------------------------------------------------------------------------*/
184/*----------------------------------------------------------------------------*/
186 hdrl_imagelist * himlist,
187 const hdrl_image * himg)
188{
189 return hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_IMAGE,
190 &hdrl_image_add_image, himlist, NULL, himg, NULL);
191}
192
193/*----------------------------------------------------------------------------*/
207/*----------------------------------------------------------------------------*/
209 hdrl_imagelist * himlist,
210 const hdrl_image * himg)
211{
212 return hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_IMAGE,
213 &hdrl_image_sub_image, himlist, NULL, himg, NULL);
214}
215
216/*----------------------------------------------------------------------------*/
230/*----------------------------------------------------------------------------*/
232 hdrl_imagelist * himlist,
233 const hdrl_image * himg)
234{
235 return hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_IMAGE,
236 &hdrl_image_mul_image, himlist, NULL, himg, NULL);
237}
238
239/*----------------------------------------------------------------------------*/
253/*----------------------------------------------------------------------------*/
255 hdrl_imagelist * himlist,
256 const hdrl_image * himg)
257{
258 return hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_IMAGE,
259 &hdrl_image_div_image, himlist, NULL, himg, NULL);
260}
261
262
263
264/*----------------------------------------------------------------------------*/
275/*----------------------------------------------------------------------------*/
277 hdrl_imagelist * himlist,
278 hdrl_value value)
279{
280 const cpl_error_code code =
281 hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_SCALAR,
283 himlist, NULL, NULL, &value);
284 return code ? cpl_error_set_where(cpl_func) : CPL_ERROR_NONE;
285}
286
287/*----------------------------------------------------------------------------*/
299/*----------------------------------------------------------------------------*/
301 hdrl_imagelist * himlist,
302 hdrl_value value)
303{
304 const cpl_error_code code =
305 hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_SCALAR,
307 himlist, NULL, NULL, &value);
308 return code ? cpl_error_set_where(cpl_func) : CPL_ERROR_NONE;
309}
310
311/*----------------------------------------------------------------------------*/
323/*----------------------------------------------------------------------------*/
325 hdrl_imagelist * himlist,
326 hdrl_value value)
327{
328 const cpl_error_code code =
329 hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_SCALAR,
331 himlist, NULL, NULL, &value);
332 return code ? cpl_error_set_where(cpl_func) : CPL_ERROR_NONE;
333}
334
335/*----------------------------------------------------------------------------*/
347/*----------------------------------------------------------------------------*/
349 hdrl_imagelist * himlist,
350 hdrl_value value)
351{
352 return hdrl_imagelist_basic_operation(HDRL_IMLIST_BASIC_SCALAR,
353 &hdrl_image_div_scalar, himlist,
354 NULL, NULL, &value);
355}
356
357
358/*----------------------------------------------------------------------------*/
369/*----------------------------------------------------------------------------*/
371 hdrl_imagelist * himlist,
372 hdrl_value exponent)
373{
374 cpl_ensure_code(himlist != NULL, CPL_ERROR_NULL_INPUT);
375
376 cpl_size nima = hdrl_imagelist_get_size(himlist) ;
377 for (cpl_size i = 0 ; i<nima ; i++) {
378 cpl_ensure_code(!hdrl_image_pow_scalar(hdrl_imagelist_get(himlist, i),
379 exponent), cpl_error_get_code());
380 }
381 return CPL_ERROR_NONE;
382}
383
384/*----------------------------------------------------------------------------*/
406/* ---------------------------------------------------------------------------*/
408 const hdrl_imagelist * himlist,
409 const hdrl_parameter * param,
410 hdrl_image ** out,
411 cpl_image ** contrib)
412{
413 cpl_ensure_code(himlist, CPL_ERROR_NULL_INPUT);
414 cpl_ensure_code(param, CPL_ERROR_NULL_INPUT);
415 cpl_ensure_code(out, CPL_ERROR_NULL_INPUT);
416 cpl_ensure_code(contrib, CPL_ERROR_NULL_INPUT);
417
419 hdrl_imagelist_collapse_mean(himlist, out, contrib);
420 }
422 hdrl_imagelist_collapse_weighted_mean(himlist, out, contrib);
423 }
424 else if (hdrl_collapse_parameter_is_median(param)) {
425 hdrl_imagelist_collapse_median(himlist, out, contrib);
426 }
427 else if (hdrl_collapse_parameter_is_sigclip(param)) {
432 out, contrib, NULL, NULL);
433 }
434 else if (hdrl_collapse_parameter_is_minmax(param)) {
438 out, contrib, NULL, NULL);
439 }
440 else if (hdrl_collapse_parameter_is_mode(param)) {
447 out, contrib);
448 }
449 else {
450 return cpl_error_set_message(cpl_func, CPL_ERROR_UNSUPPORTED_MODE,
451 "Invalid parameter input for "
452 "hdrl_imagelist_collapse");
453 }
454
455 return cpl_error_get_code();
456}
457
458/*----------------------------------------------------------------------------*/
469/* ---------------------------------------------------------------------------*/
471 const hdrl_imagelist * himlist,
472 hdrl_image ** out,
473 cpl_image ** contrib)
474{
475 hdrl_collapse_imagelist_to_image_t * method =
476 hdrl_collapse_imagelist_to_image_mean();
477 hdrl_imagelist_collapse_interface(himlist, method, out, contrib, NULL) ;
478 hdrl_collapse_imagelist_to_image_delete(method) ;
479 return cpl_error_get_code();
480}
481
482/*----------------------------------------------------------------------------*/
493/* ---------------------------------------------------------------------------*/
495 const hdrl_imagelist * himlist,
496 hdrl_image ** out,
497 cpl_image ** contrib)
498{
499 hdrl_collapse_imagelist_to_image_t * method =
500 hdrl_collapse_imagelist_to_image_weighted_mean();
501 hdrl_imagelist_collapse_interface(himlist, method, out, contrib, NULL) ;
502 hdrl_collapse_imagelist_to_image_delete(method) ;
503 return cpl_error_get_code();
504}
505
506/*----------------------------------------------------------------------------*/
517/* ---------------------------------------------------------------------------*/
519 const hdrl_imagelist * himlist,
520 hdrl_image ** out,
521 cpl_image ** contrib)
522{
523 hdrl_collapse_imagelist_to_image_t * method =
524 hdrl_collapse_imagelist_to_image_median();
525 hdrl_imagelist_collapse_interface(himlist, method, out, contrib, NULL) ;
526 hdrl_collapse_imagelist_to_image_delete(method) ;
527 return cpl_error_get_code();
528}
529
530/*----------------------------------------------------------------------------*/
547/* ---------------------------------------------------------------------------*/
549 const hdrl_imagelist * himlist,
550 double kappa_low,
551 double kappa_high,
552 int niter,
553 hdrl_image ** out,
554 cpl_image ** contrib,
555 cpl_image ** reject_low,
556 cpl_image ** reject_high)
557{
558 hdrl_sigclip_image_output * sigclipout;
559 hdrl_collapse_imagelist_to_image_t * method =
560 hdrl_collapse_imagelist_to_image_sigclip(kappa_low, kappa_high, niter);
561 hdrl_imagelist_collapse_interface(himlist, method, out, contrib, (void**)&sigclipout);
562
563 if (cpl_error_get_code() != CPL_ERROR_NONE) {
564
565 hdrl_collapse_imagelist_to_image_delete(method);
566
567 if (reject_low) {
568 *reject_low = NULL;
569 }
570
571 if (reject_high) {
572 *reject_high = NULL;
573 }
574
575 return cpl_error_get_code();
576 }
577
578 if (reject_low) {
579 *reject_low = sigclipout->reject_low;
580 } else {
581 cpl_image_delete(sigclipout->reject_low);
582 }
583
584 if (reject_high) {
585 *reject_high = sigclipout->reject_high;
586 } else {
587 cpl_image_delete(sigclipout->reject_high);
588 }
589
590 hdrl_collapse_imagelist_to_image_unwrap_eout(method, sigclipout);
591 hdrl_collapse_imagelist_to_image_delete(method);
592
593 return cpl_error_get_code();
594}
595
596/*----------------------------------------------------------------------------*/
612/* ---------------------------------------------------------------------------*/
614 const hdrl_imagelist * himlist,
615 double nlow,
616 double nhigh,
617 hdrl_image ** out,
618 cpl_image ** contrib,
619 cpl_image ** reject_low,
620 cpl_image ** reject_high)
621{
622 hdrl_minmax_image_output * minmaxout;
623 hdrl_collapse_imagelist_to_image_t * method =
624 hdrl_collapse_imagelist_to_image_minmax(nlow, nhigh);
625 hdrl_imagelist_collapse_interface(himlist, method, out, contrib, (void**)&minmaxout);
626
627 if (cpl_error_get_code() != CPL_ERROR_NONE) {
628
629 hdrl_collapse_imagelist_to_image_delete(method);
630
631 if (reject_low) {
632 *reject_low = NULL;
633 }
634
635 if (reject_high) {
636 *reject_high = NULL;
637 }
638
639 return cpl_error_get_code();
640 }
641
642 if (reject_low) {
643 *reject_low = minmaxout->reject_low;
644 } else {
645 cpl_image_delete(minmaxout->reject_low);
646 }
647
648 if (reject_high) {
649 *reject_high = minmaxout->reject_high;
650 } else {
651 cpl_image_delete(minmaxout->reject_high);
652 }
653
654 hdrl_collapse_imagelist_to_image_unwrap_eout(method, minmaxout);
655 hdrl_collapse_imagelist_to_image_delete(method);
656
657 return cpl_error_get_code();
658}
659
660
661
662
663/*----------------------------------------------------------------------------*/
679/* ---------------------------------------------------------------------------*/
680cpl_error_code hdrl_imagelist_collapse_mode(const hdrl_imagelist * himlist,
681 double histo_min,
682 double histo_max,
683 double bin_size,
684 hdrl_mode_type mode_method,
685 cpl_size error_niter,
686 hdrl_image ** out,
687 cpl_image ** contrib)
688{
689 hdrl_collapse_imagelist_to_image_t * method =
690 hdrl_collapse_imagelist_to_image_mode(histo_min, histo_max, bin_size,
691 mode_method, error_niter );
692 hdrl_imagelist_collapse_interface(himlist, method, out, contrib, NULL) ;
693 hdrl_collapse_imagelist_to_image_delete(method) ;
694 return cpl_error_get_code();
695}
696
697
698
699
700
701
702
703
704
705
706/*----------------------------------------------------------------------------*/
719/* ---------------------------------------------------------------------------*/
720static cpl_error_code hdrl_imagelist_collapse_interface(
721 const hdrl_imagelist * himlist,
722 hdrl_collapse_imagelist_to_image_t * collapse_method,
723 hdrl_image ** out,
724 cpl_image ** contrib,
725 void ** eout)
726{
727 cpl_error_code fail = CPL_ERROR_NONE;
728
729 /* Check inputs */
730 cpl_ensure_code(himlist != NULL, CPL_ERROR_NULL_INPUT);
731 cpl_ensure_code(out != NULL, CPL_ERROR_NULL_INPUT);
732 cpl_ensure_code(contrib != NULL, CPL_ERROR_NULL_INPUT);
733
734 cpl_size nz = hdrl_imagelist_get_size(himlist);
735 cpl_size nx = hdrl_imagelist_get_size_x(himlist);
736 cpl_size ny = hdrl_imagelist_get_size_y(himlist);
737 if (cpl_error_get_code() != CPL_ERROR_NONE) {
738 return cpl_error_get_code();
739 }
740
741 *out = hdrl_image_new(nx, ny);
742 *contrib = cpl_image_new( nx, ny, CPL_TYPE_INT);
743
744 /* make sure we have masks else the copy into these is not threadsafe */
745 cpl_image_get_bpm(*contrib);
747
748 /* create full extra output */
749 if (eout) {
750 *eout = hdrl_collapse_imagelist_to_image_create_eout(
751 collapse_method, hdrl_image_get_image(hdrl_imagelist_get(himlist, 0)));
752 }
753
754 /* get blocks that can be processed in parallel
755 * small blocksize better for cache but currently excessive malloc/free
756 * prevents making it smaller */
757 cpl_size blocksize = 16ul * (1ul<<20ul) / (nz * nx * sizeof(double));
758 hdrl_iter *it = hdrl_imagelist_get_iter_row_slices(himlist, blocksize, 0, HDRL_ITER_CONST);
759
760 cpl_size nit = hdrl_iter_length(it);
761 hdrl_imagelist *vl[nit];
762 cpl_size yl[nit];
763
764 {
765 cpl_size i = 0;
766 cpl_size y = 1;
767 for (hdrl_imagelist * v = hdrl_iter_next(it);
768 v != NULL;
769 v = hdrl_iter_next(it)) {
770 vl[i] = v;
771 yl[i++] = y;
773 }
774 }
775
776 hdrl_iter_delete(it);
777
778 if (cpl_error_get_code() != CPL_ERROR_NONE) {
779 for (cpl_size i = 0; i < nit; i++) {
781 }
782 return cpl_error_get_code();
783 }
784
785 HDRL_OMP(omp parallel for)
786 for (cpl_size i = 0; i < nit; i++) {
787
788 cpl_image *out_data;
789 cpl_image *out_errors;
790 cpl_image *out_contrib;
791
792 cpl_imagelist *data;
793 cpl_imagelist *errors;
794
795 void *out_eout;
796
797 hdrl_imagelist *v = vl[i];
798 cpl_size y = yl[i];
799
800 /* Build the Inputs Interface */
801 hdrl_imagelist_to_cplwrap(v, &data, &errors);
802
803 /* Call the actual collapsing */
804 hdrl_collapse_imagelist_to_image_call(collapse_method, data, errors,
805 &out_data, &out_errors,
806 &out_contrib, &out_eout);
807
808 if (cpl_error_get_code() != CPL_ERROR_NONE) {
809
810 fail = cpl_error_get_code();
811 cpl_imagelist_unwrap(data) ;
812 cpl_imagelist_unwrap(errors) ;
814
815 } else {
816
817 cpl_msg_debug(cpl_func, "Collapsed block %lld to %lld", y,
818 y + cpl_image_get_size_y(out_data) - 1);
819
820 /* TODO make use of output image views to avoid copying */
821 assert(hdrl_image_get_mask_const(*out));
822 assert(cpl_image_get_bpm_const(*contrib));
823 hdrl_image_insert(*out, out_data, out_errors, 1, y);
824 cpl_image_copy(*contrib, out_contrib, 1, y);
825
826 /* copy and delete slice extra out */
827 if (out_eout) {
828 hdrl_collapse_imagelist_to_image_move_eout(collapse_method,
829 *eout, out_eout, y);
830 }
831
832 /* Destroy the Inputs Interface */
833 cpl_image_delete(out_data);
834 cpl_image_delete(out_errors);
835 cpl_image_delete(out_contrib);
836 cpl_imagelist_unwrap(data) ;
837 cpl_imagelist_unwrap(errors) ;
839 }
840 }
841
842 if (fail != CPL_ERROR_NONE) {
843
844 if (eout) {
845 hdrl_collapse_imagelist_to_image_delete_eout(collapse_method, *eout);
846 }
847
848 hdrl_image_delete(*out);
849 cpl_image_delete(*contrib);
850
851 return cpl_error_set_message(cpl_func, fail, "hdrl_imagelist_collapse failed");
852 }
853
854 return cpl_error_get_code();
855}
856
857/*----------------------------------------------------------------------------*/
871/*----------------------------------------------------------------------------*/
872static cpl_error_code hdrl_imagelist_basic_operation(
874 void *func,
875 hdrl_imagelist *himlist1,
876 const hdrl_imagelist *himlist2,
877 const hdrl_image *himg,
878 hdrl_value *value){
879
880 /* Check input */
881 cpl_ensure_code(func, CPL_ERROR_NULL_INPUT);
882 cpl_ensure_code(himlist1, CPL_ERROR_NULL_INPUT);
883
884 switch (type) {
885 case HDRL_IMLIST_BASIC_IMLIST:
886 cpl_ensure_code(himlist2, CPL_ERROR_NULL_INPUT);
887 cpl_ensure_code(himlist1->ni == himlist2->ni,
888 CPL_ERROR_INCOMPATIBLE_INPUT);
889 break;
890 case HDRL_IMLIST_BASIC_IMAGE:
891 cpl_ensure_code(himg, CPL_ERROR_NULL_INPUT);
892 break;
893 case HDRL_IMLIST_BASIC_SCALAR:
894 cpl_ensure_code(value, CPL_ERROR_NULL_INPUT);
895 break;
896 }
897
898 /* Loop and apply the operation */
899 for (cpl_size i = 0; i < himlist1->ni; i++) {
900 cpl_error_code err = CPL_ERROR_NONE;
901 switch (type) {
902 case HDRL_IMLIST_BASIC_IMLIST:
903 {
904 err = ((hdrl_f_image)func)(himlist1->images[i], himlist2->images[i]);
905 break;
906 }
907 case HDRL_IMLIST_BASIC_IMAGE:
908 {
909 err = ((hdrl_f_image)func)(himlist1->images[i], himg);
910 break;
911 }
912 case HDRL_IMLIST_BASIC_SCALAR:
913 err = ((hdrl_f_scalar)func)(himlist1->images[i], *value);
914 break;
915 }
916 cpl_ensure_code(err == CPL_ERROR_NONE, err);
917 }
918
919 return CPL_ERROR_NONE;
920}
921
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.