CR2RE Pipeline Reference Manual 1.6.2
hdrl_combine.c
1/* $Id: hdrl_combine.c,v 1.15 2013-09-24 14:58:54 jtaylor Exp $
2 *
3 * This file is part of the HDRL
4 * Copyright (C) 2013 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 02110-1301 USA
19 */
20
21/*
22 * $Author: jtaylor $
23 * $Date: 2013-09-24 14:58:54 $
24 * $Revision: 1.15 $
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 "hdrl_combine.h"
37#include "hdrl_iter.h"
38#include "hdrl_utils.h"
39#include "hdrl_sigclip.h"
40#include <cpl.h>
41#include <math.h>
42#include <string.h>
43#include <assert.h>
44
45/*-----------------------------------------------------------------------------
46 Static
47 -----------------------------------------------------------------------------*/
48
51/*----------------------------------------------------------------------------*/
59/*----------------------------------------------------------------------------*/
60
63/* ---------------------------------------------------------------------------*/
77/* ---------------------------------------------------------------------------*/
78cpl_error_code
79hdrl_imagelist_combine(const cpl_imagelist * data,
80 const cpl_imagelist * errors,
81 hdrl_collapse_imagelist_to_image_t * method,
82 cpl_image ** out,
83 cpl_image ** err,
84 cpl_image ** contrib)
85{
86 cpl_ensure_code(data && errors, CPL_ERROR_NULL_INPUT);
87 cpl_ensure_code(out && err && contrib, CPL_ERROR_NULL_INPUT);
88 cpl_ensure_code(cpl_imagelist_get_size(data) > 0, CPL_ERROR_ILLEGAL_INPUT);
89 cpl_ensure_code(cpl_imagelist_get_size(data) ==
90 cpl_imagelist_get_size(errors), CPL_ERROR_ILLEGAL_INPUT);
91
92 hdrl_collapse_imagelist_to_image_call(method, data, errors,
93 out, err, contrib, NULL);
94
95 return cpl_error_get_code();
96}
97