IIINSTRUMENT Pipeline Reference Manual 4.4.3
visir_inputs.h
1/* $Id: visir_inputs.h,v 1.55 2013-02-21 16:39:11 jtaylor Exp $
2 *
3 * This file is part of the VISIR Pipeline
4 * Copyright (C) 2002,2003 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 02111-1307 USA
19 */
20
21/*
22 * $Author: jtaylor $
23 * $Date: 2013-02-21 16:39:11 $
24 * $Revision: 1.55 $
25 * $Name: not supported by cvs2svn $
26 */
27
28#ifndef VISIR_INPUTS_H
29#define VISIR_INPUTS_H
30
31/*-----------------------------------------------------------------------------
32 Includes
33 -----------------------------------------------------------------------------*/
34
35#include "sbrm.h"
36#include <cpl.h>
37#include <cxlist.h> /* for cx_list */
38
39#include "irplib_framelist.h"
40
41#include "visir_spc_optmod.h"
42
43/*-----------------------------------------------------------------------------
44 Define
45 -----------------------------------------------------------------------------*/
46
47/* The values range from 0 (or 1) to 2**16-1 (or 2**16) */
48#define VISIR_HCYCLE_BPM_THRESHOLD 65000.0
49
50/* Due to a inconsistency in the chosen VISIR FITS-format the pixels in
51 the half-cycle image are offset, such that the lowest pixel value is
52 -32768 (or perhaps -32767?). This is fixed by adding 32768 to each
53 pixel value */
54#define VISIR_HCYCLE_OFFSET 32768.0
55
56typedef enum {
57 /* VISIR nod/chopping mode detection */
58
59 /* Mode can be assumed to be: PERPENDICULAR */
60 VISIR_CHOPNOD_PERPENDICULAR,
61
62 /* Mode can be assumed to be: PARALLEL */
63 VISIR_CHOPNOD_PARALLEL,
64
65 /* Mode is determined from FITS header */
66 VISIR_CHOPNOD_AUTO
67
68} visir_chopnod_mode;
69
70typedef enum {
71 VISIR_ERROR,
72 VISIR_VARIANCE,
73 VISIR_WEIGHT
74} visir_error_type;
75
76typedef enum {
77 VISIR_DATA_CUBE1,
78 VISIR_DATA_CUBE2,
79 VISIR_DATA_BURST,
80 VISIR_DATA_AQU_HCYCLE,
81 VISIR_DATA_AQU_BURST,
82 VISIR_DATA_AQU_BURST_EXT,
83 /* only INT frame, no half cycles, format of an 2015 commissioning, can
84 * probably be removed in future */
85 VISIR_DATA_AQU_INT,
86} visir_data_type;
87
88typedef enum {
89 VISIR_EXTRACT_METHOD_UNKNOWN = 0,
90 VISIR_EXTRACT_METHOD_APERTURE = 'A',
91 VISIR_EXTRACT_METHOD_OPTIMAL = 'O',
92} visir_extract_t;
93
94typedef enum {
95 VISIR_SKY_METHOD_UNKNOWN = 0,
96 VISIR_SKY_METHOD_AVERAGE = 'A',
97 VISIR_SKY_METHOD_LINFIT = 'F',
98 VISIR_SKY_METHOD_MEDIAN = 'M',
99} visir_sky_t;
100
101typedef struct { int l, r; } visir_aplimits;
102typedef struct {
103 const size_t nlimits;
104 int ident;
105 visir_extract_t extract_method;
106 visir_sky_t sky_method;
107 visir_aplimits limits[]; // c99's "flexible array member"
108} visir_apdefs;
109#define visir_apdefs_delete cpl_free
110#define visir_apdefs_new(...) \
111 SBRM_VALLOC(visir_apdefs, visir_aplimits, __VA_ARGS__)
112
113typedef cx_list visir_aplist; // a list of visir_apdefs
114void visir_aplist_destroy(visir_aplist * list);
115#define visir_aplist_delete cx_list_delete
116#define visir_aplist_new cx_list_new
117#define visir_aplist_push_back cx_list_push_back
118#define visir_aplist_size cx_list_size
119
120static inline cpl_boolean
121visir_data_is_aqu(const visir_data_type dtype)
122{
123 return dtype == VISIR_DATA_AQU_HCYCLE || dtype == VISIR_DATA_AQU_BURST ||
124 dtype == VISIR_DATA_AQU_BURST_EXT || dtype == VISIR_DATA_AQU_INT;
125}
126
127static inline cpl_boolean
128visir_data_is_drs(const visir_data_type dtype)
129{
130 return !visir_data_is_aqu(dtype);
131}
132
133static inline cpl_boolean
134visir_data_is_burst(const visir_data_type dtype)
135{
136 return dtype == VISIR_DATA_BURST || dtype == VISIR_DATA_AQU_BURST ||
137 dtype == VISIR_DATA_AQU_BURST_EXT;
138}
139
140
141/*-----------------------------------------------------------------------------
142 Functions prototypes
143 -----------------------------------------------------------------------------*/
144
145cpl_imagelist * visir_inputs_combine(const char *, const cpl_parameterlist *,
146 const irplib_framelist *, const char *,
147 const char *, int *, cpl_boolean,
148 double, visir_spc_resol);
149cpl_image ** visir_img_recombine_list(const char *,
150 const cpl_parameterlist *,
151 cpl_imagelist *,
152 const cpl_propertylist **,
153 cpl_geom_combine, cpl_boolean *);
154cpl_image ** visir_img_recombine(const char *, const cpl_parameterlist *,
155 const irplib_framelist *, const char *,
156 const char *, cpl_geom_combine, cpl_boolean *,
157 cpl_boolean, double, visir_spc_resol);
158cpl_imagelist * visir_load_imagelist(const irplib_framelist *, int,
159 cpl_boolean);
160cpl_imagelist * visir_load_hcycle(const irplib_framelist *, int);
161
162visir_aplist * visir_aplist_new_from_file(const char *);
163visir_apdefs * visir_apdefs_new_from_line(char *, int);
164char * visir_apdefs_dump(const visir_apdefs *);
165
166cpl_error_code visir_image_reject_hot(cpl_image *, const char *);
167
168cpl_imagelist * visir_imagelist_load_last(const irplib_framelist *);
169
170cpl_image ** visir_img_collapse_beam(cpl_propertylist *,
171 const cpl_image *,
172 const cpl_parameterlist *,
173 const char *,
174 visir_chopnod_mode,
175 const cpl_propertylist *);
176
177double visir_img_check_box(const cpl_apertures *, int, int,
178 const cpl_apertures *, int, int,
179 double, double, cpl_boolean *, cpl_boolean *);
180
181double visir_img_check_align(const cpl_apertures *, int,
182 const cpl_apertures *, int, int,
183 double, double,
184 cpl_boolean *);
185
186double visir_img_check_line(const cpl_apertures *, int,
187 const cpl_apertures *, int,
188 double, double);
189
190cpl_error_code visir_get_data_type(const cpl_frame * frame,
191 const cpl_propertylist * plist,
192 visir_data_type * ptype, cpl_size * pnext);
193
194cpl_bivector * visir_load_lintable(cpl_frame * linframe, cpl_boolean is_spec);
195
196cpl_image *
197visir_load_bpm(cpl_frame * frm, visir_data_type dtype, cpl_boolean is_spec);
198
199cpl_error_code visir_load_cube2_split(cpl_imagelist *, cpl_imagelist *,
200 const irplib_framelist *, const int,
201 const int, const int);
202
203cpl_error_code visir_load_burst(cpl_imagelist *, cpl_imagelist *,
204 const cpl_frame *, const cpl_propertylist *,
205 const int, const int, const int, const int,
206 const int, const int);
207cpl_error_code visir_load_burst_aqu(cpl_imagelist *, cpl_imagelist *,
208 const cpl_frame *, const cpl_propertylist *,
209 const int, const int, const int);
210
211cpl_error_code visir_img_burst_find_delta_chop(const cpl_propertylist *,
212 int *, int *);
213
214
215visir_chopnod_mode visir_img_find_beam(cpl_propertylist *,
216 const cpl_image *,
217 const cpl_image *,
218 const cpl_propertylist *,
219 const cpl_parameterlist *,
220 const char *,
221 double [],
222 double []);
223
224cpl_error_code visir_img_find_beam_two(cpl_propertylist *, const cpl_image *,
225 const cpl_image *, double, double, double,
226 double [], double []);
227
228#endif
cpl_image ** visir_img_recombine_list(const char *, const cpl_parameterlist *, cpl_imagelist *, const cpl_propertylist **, cpl_geom_combine, cpl_boolean *)
The VISIR imaging combination using cross correlation.
cpl_imagelist * visir_load_hcycle(const irplib_framelist *, int)
Load the HCYCLE images from a VISIR file.
cpl_image ** visir_img_collapse_beam(cpl_propertylist *, const cpl_image *, const cpl_parameterlist *, const char *, visir_chopnod_mode, const cpl_propertylist *)
Collapse the 3/4 beams of a combined image.
Definition: visir_inputs.c:626
cpl_imagelist * visir_imagelist_load_last(const irplib_framelist *)
Load the last frame of the input files to an image list.
cpl_error_code visir_load_cube2_split(cpl_imagelist *, cpl_imagelist *, const irplib_framelist *, const int, const int, const int)
Load and split the data in a CUBE2 file.
Definition: visir_inputs.c:255
cpl_imagelist * visir_inputs_combine(const char *, const cpl_parameterlist *, const irplib_framelist *, const char *, const char *, int *, cpl_boolean, double, visir_spc_resol)
The VISIR input data re-combination is performed here.
Definition: visir_inputs.c:808
cpl_imagelist * visir_load_imagelist(const irplib_framelist *, int, cpl_boolean)
Load either a INTERM or Half-Cycle cube from a VISIR file.
visir_apdefs * visir_apdefs_new_from_line(char *, int)
Parse a line from the user-supplied apertures definition file, creating a new visir_apdefs object.
char * visir_apdefs_dump(const visir_apdefs *)
Convert an aperture definition into its string representation.
cpl_image ** visir_img_recombine(const char *, const cpl_parameterlist *, const irplib_framelist *, const char *, const char *, cpl_geom_combine, cpl_boolean *, cpl_boolean, double, visir_spc_resol)
The VISIR imaging combination using cross correlation.
visir_aplist * visir_aplist_new_from_file(const char *)
Load the user-supplied apertures definition file.
cpl_bivector * visir_load_lintable(cpl_frame *linframe, cpl_boolean is_spec)
load and normalize linearity table into a bivector
Definition: visir_inputs.c:549
cpl_error_code visir_image_reject_hot(cpl_image *, const char *)
Reject the hot pixels in an image.