37#include "irplib_utils.h"
61 const char * xsh_detmon_license =
62 "This file is part of the DETMON Instrument Pipeline\n"
63 "Copyright (C) 2002,2003 European Southern Observatory\n"
65 "This program is free software; you can redistribute it and/or modify\n"
66 "it under the terms of the GNU General Public License as published by\n"
67 "the Free Software Foundation; either version 2 of the License, or\n"
68 "(at your option) any later version.\n"
70 "This program is distributed in the hope that it will be useful,\n"
71 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
72 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
73 "GNU General Public License for more details.\n"
75 "You should have received a copy of the GNU General Public License\n"
76 "along with this program; if not, write to the Free Software\n"
77 "Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, \n"
79 return xsh_detmon_license ;
106 *
urx = cpl_image_get_size_x(
ref);
108 *
ury = cpl_image_get_size_y(
ref);
135 cpl_size pnum, cpl_size xtnum,
136 cpl_size
llx, cpl_size
lly,
137 cpl_size
urx, cpl_size
ury,
138 cpl_size
nx, cpl_size
ny)
140 cpl_imagelist * list = cpl_imagelist_new();
141 const cpl_size
n = cpl_frameset_get_size(fset);
143 if (
nx >= 0 &&
ny >= 0) {
145 CPL_ERROR_ILLEGAL_INPUT,
146 "window size [%d:%d,%d:%d] larger than output size [%d, %d]",
150 for (cpl_size i = 0; i <
n; i++) {
151 const cpl_frame * frm = cpl_frameset_get_position_const(fset, i);
152 const char * fn = cpl_frame_get_filename(frm);
154 const cpl_size next = cpl_frame_get_nextensions(frm);
155 for (cpl_size e = 0; e < next; e++) {
156 cpl_image * image = cpl_image_load_window(fn, type, pnum, e,
158 skip_if(image == NULL);
159 if(
nx < 0 ||
ny < 0 ) {
160 cpl_imagelist_set(list, image, cpl_imagelist_get_size(list));
162 cpl_image * full = cpl_image_new(
nx,
ny, type);
163 cpl_image_copy(full, image,
llx,
lly);
164 cpl_image_delete(image);
165 cpl_imagelist_set(list, full, cpl_imagelist_get_size(list));
171 cpl_image * image = cpl_image_load_window(fn, type, pnum, xtnum,
173 skip_if(image == NULL);
174 if(
nx < 0 ||
ny < 0 ) {
175 cpl_imagelist_set(list, image, cpl_imagelist_get_size(list));
177 cpl_image * full = cpl_image_new(
nx,
ny, type);
178 cpl_image_copy(full, image,
llx,
lly);
179 cpl_image_delete(image);
180 cpl_imagelist_set(list, full, cpl_imagelist_get_size(list));
187 if (cpl_error_get_code()) {
188 cpl_imagelist_delete(list);
217 cpl_image * na = cpl_image_extract(a,
llx,
lly,
urx,
ury);
218 cpl_image * nb = cpl_image_extract(b,
llx,
lly,
urx,
ury);
219 cpl_image_subtract(na, nb);
220 cpl_image_delete(nb);
244 const cpl_image * off1,
245 const cpl_image * on2,
246 const cpl_image * off2,
247 cpl_size
llx, cpl_size
lly,
248 cpl_size
urx, cpl_size
ury)
251 cpl_image * dif1 = cpl_image_extract(on1,
llx,
lly,
urx,
ury);
252 cpl_image * dif2 = cpl_image_extract(on2,
llx,
lly,
urx,
ury);
253 cpl_image * b = cpl_image_extract(off1,
llx,
lly,
urx,
ury);
256 cpl_image_subtract(dif1, b);
260 cpl_image_subtract(dif1, b);
263 cpl_image_subtract(dif2, b);
267 dif_avg = cpl_image_average_create(dif1, dif2);
268 cpl_image_abs(dif_avg);
270 cpl_image_delete(dif1);
271 cpl_image_delete(dif2);
const char * xsh_detmon_get_license(void)
Get the pipeline copyright and license.
cpl_image * xsh_detmon_subtracted_avg(const cpl_image *on1, const cpl_image *off1, const cpl_image *on2, const cpl_image *off2, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
return absolute average of subtracted images
cpl_image * xsh_detmon_subtract_create_window(const cpl_image *a, const cpl_image *b, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury)
subtract window two images creating new image of window size
static void expand_region(const cpl_image *ref, cpl_size *llx, cpl_size *lly, cpl_size *urx, cpl_size *ury)
utility to convert negative region to full image
cpl_imagelist * xsh_detmon_load_frameset_window(const cpl_frameset *fset, cpl_type type, cpl_size pnum, cpl_size xtnum, cpl_size llx, cpl_size lly, cpl_size urx, cpl_size ury, cpl_size nx, cpl_size ny)
load data in frameset into an imagelist