35#include "hdrl_parameter.h"
36#include "hdrl_image.h"
37#include "hdrl_imagelist.h"
72 HDRL_AIRMASS_APPROX_HARDIE = 1,
73 HDRL_AIRMASS_APPROX_YOUNG_IRVINE,
74 HDRL_AIRMASS_APPROX_YOUNG
78 HDRL_IMAGE_EXTEND_NEAREST = 0,
79 HDRL_IMAGE_EXTEND_MIRROR = 1,
80} hdrl_image_extend_method ;
96 cpl_size, cpl_size, cpl_size) ;
103 const cpl_size,
const cpl_size) ;
105 const char *,
const char *,
const hdrl_parameter *) ;
107 const cpl_parameterlist *,
const char *,
const char *) ;
110 const cpl_size sample_len,
const cpl_boolean sort_decreasing);
115#if defined HDRL_USE_EXPERIMENTAL || defined HDRL_USE_PRIVATE
118 HDRL_SCALE_MULTIPLICATIVE
122hdrl_normalize_imagelist_by_vector(
const cpl_vector * scale,
123 const cpl_vector * scale_e,
124 const hdrl_scale_type scale_type,
125 cpl_imagelist * data,
126 cpl_imagelist * errors);
129hdrl_normalize_imagelist_by_imagelist(
const cpl_imagelist * scale,
130 const cpl_imagelist * scale_e,
131 const hdrl_scale_type scale_type,
132 cpl_imagelist * data,
133 cpl_imagelist * errors);
135int hdrl_get_tempfile(
const char * dir, cpl_boolean unlink);
136char * hdrl_get_cwd(
void);
141hdrl_wcs_convert(
const cpl_wcs *wcs,
const cpl_matrix *from,
142 cpl_matrix **to, cpl_array **status,
143 cpl_wcs_trans_mode transform);
150 hdrl_value aRA, hdrl_value aDEC, hdrl_value aLST,
151 hdrl_value aExptime, hdrl_value aLatitude,
152 hdrl_airmass_approx type);
157#if defined (_OPENMP) && !defined( __APPLE__)
158 #define HDRL_OMP(x) _Pragma (#x)
166#ifdef HDRL_USE_PRIVATE
168hdrl_maglim_kernel_create(
const cpl_size kernel_sx,
const cpl_size kernel_sy,
171hdrl_extend_image(
const cpl_image* image,
const cpl_size border_nx,
172 const cpl_size border_ny,
173 const hdrl_image_extend_method image_extend_method);
176hdrl_image_convolve(
const cpl_image * input_image,
const cpl_matrix * kernel,
177 const hdrl_image_extend_method image_extend_method);
180hdrl_value hdrl_get_zenith_distance(
181 hdrl_value aHourAngle, hdrl_value aDelta, hdrl_value aLatitude);
183hdrl_value hdrl_get_airmass_hardie( hdrl_value hvaSecZ);
184hdrl_value hdrl_get_airmass_youngirvine( hdrl_value hvaSecZ);
185hdrl_value hdrl_get_airmass_young( hdrl_value hvaCosZt);
190hdrl_medianfilter_image_grid(
const cpl_image * ima, cpl_matrix * x, cpl_matrix * y,
191 cpl_size filtersize_x, cpl_size filtersize_y);
193cpl_matrix * hdrl_matrix_linspace(cpl_size start, cpl_size stop, cpl_size step);
195cpl_matrix * hdrl_fit_legendre(cpl_image * img,
int order_x,
int order_y,
196 cpl_matrix * grid_x, cpl_matrix * grid_y,
197 cpl_size orig_nx, cpl_size orig_ny);
199cpl_image * hdrl_legendre_to_image(cpl_matrix * coeffs,
int order_x,
200 int order_y, cpl_size nx, cpl_size ny);
202int hdrl_check_maskequality(
const cpl_mask * mask1,
const cpl_mask * mask2);
204typedef struct hdrl_vector_cache_ hdrl_vector_cache;
206hdrl_vector_cache * hdrl_vector_cache_new(cpl_size max_cached_size,
207 cpl_size ncached_entries);
208void hdrl_vector_cache_delete(hdrl_vector_cache * cache);
209cpl_vector * hdrl_cplvector_new_from_cache(hdrl_vector_cache * cache, cpl_size sz);
210void hdrl_cplvector_delete_to_cache(hdrl_vector_cache * cache, cpl_vector * v);
213#define hdrl_setup_vparameter(parlist, \
223 char * fname = cpl_sprintf("%s%s", name_prefix, pname); \
224 char * setup_name = hdrl_join_string(sep, 3, context, prefix, fname); \
225 cpl_parameter * setup_p = cpl_parameter_new_value(setup_name, type, \
226 descr, context, pdefault) ; \
227 cpl_free(setup_name); \
228 setup_name = hdrl_join_string(sep, 2, prefix, fname); \
229 cpl_parameter_set_alias(setup_p, CPL_PARAMETER_MODE_CLI, setup_name); \
230 cpl_parameter_disable(setup_p, CPL_PARAMETER_MODE_ENV); \
231 cpl_free(setup_name); \
233 cpl_parameterlist_append(parlist, setup_p); \
236cpl_vector * hdrl_image_to_vector(
const cpl_image * source,
const
238cpl_vector * hdrl_imagelist_to_vector(
const cpl_imagelist * list,
239 const cpl_size x,
const cpl_size y);
240cpl_error_code hdrl_imagelist_to_vector_row(
const cpl_imagelist * list,
243 hdrl_vector_cache * cache);
246hdrl_imagelist_to_cplwrap(
const hdrl_imagelist * list,
247 cpl_imagelist ** data,
248 cpl_imagelist ** errs);
251hdrl_parallel_filter_image(
const cpl_image * img,
252 const cpl_matrix * kernel,
253 const cpl_mask * mask,
254 const cpl_filter_mode mode);
256cpl_mask * hcpl_image_set_bpm(cpl_image * self, cpl_mask * bpm) ;
257double hcpl_vector_get_mad_window(cpl_vector * vec,
261double hcpl_gaussian_eval_2d(
const cpl_array * self,
double x,
double y);
263static inline int hdrl_int_is_power_of_two(
unsigned long long x)
265 return (x & (x - 1)) == 0;
268static inline size_t hdrl_get_image_npix(
const cpl_image * img)
270 return cpl_image_get_size_x(img) * cpl_image_get_size_y(img);
273static inline size_t hdrl_get_image_good_npix(
const cpl_image * img)
275 return (cpl_image_get_size_x(img) * cpl_image_get_size_y(img)) -
276 cpl_image_count_rejected(img);
279static inline cpl_mask * hdrl_copy_image_mask(
const cpl_image * img)
282 const cpl_mask * bpm = cpl_image_get_bpm_const(img);
285 return cpl_mask_duplicate(bpm);
288 return cpl_mask_new(cpl_image_get_size_x(img),
289 cpl_image_get_size_y(img));
295static inline hdrl_data_t * hdrl_get_image_data(cpl_image * image)
297#if HDRL_SIZEOF_DATA == 8
298 return cpl_image_get_data_double(image);
300 return cpl_image_get_data_float(image);
304static inline cpl_error_code
305hdrl_wrap_table(cpl_table * tb, hdrl_data_t * data,
const char * name)
307#if HDRL_SIZEOF_DATA == 8
308 return cpl_table_wrap_double(tb, data, name);
310 return cpl_table_wrap_float(tb, data, name);
314static inline hdrl_error_t * hdrl_get_image_error(cpl_image * image)
316#if HDRL_SIZEOF_ERROR == 8
317 return cpl_image_get_data_double(image);
319 return cpl_image_get_data_float(image);
325hdrl_data_t * hdrl_get_image_data_const(
const cpl_image * image)
327#if HDRL_SIZEOF_DATA == 8
328 return cpl_image_get_data_double_const(image);
330 return cpl_image_get_data_float_const(image);
335hdrl_error_t * hdrl_get_image_error_const(
const cpl_image * image)
337#if HDRL_SIZEOF_ERROR == 8
338 return cpl_image_get_data_double_const(image);
340 return cpl_image_get_data_float_const(image);
344#ifndef HDRL_ATTR_UNUSED
345 #if defined(__GNUC__) || defined(__ICC) || defined(__clang__)
346 #define HDRL_ATTR_UNUSED __attribute__ ((__unused__))
348 #define HDRL_ATTR_UNUSED
354#define HDRL_UNUSED(x) (__HDRL_UNUSED_TAGGED ## x) HDRL_ATTR_UNUSED
const char * hdrl_get_license(void)
Get the pipeline copyright and license.
void hdrl_sort_on_x(double *x, double *y1, double *y2, const cpl_size sample_len, const cpl_boolean sort_decreasing)
sort in increasing or decreasing order x. Keep aligned with y1 and y2.
hdrl_value hdrl_utils_airmass(hdrl_value aRA, hdrl_value aDEC, hdrl_value aLST, hdrl_value aExptime, hdrl_value aLatitude, hdrl_airmass_approx type)
Compute the effective airmass of an observation. Takes in count the error propagation if you enter th...
cpl_boolean hdrl_is_strictly_monotonic_increasing(const double *x, cpl_size l)
returns CPL_TRUE if x is strictly monotonic increasing
cpl_error_code hdrl_rect_region_parameter_verify(const hdrl_parameter *, const cpl_size, const cpl_size)
Verify basic correctness of the parameters.
cpl_table * hdrl_eop_data_totable(const char *eop_data, cpl_size data_length)
Export a raw string buffer containing EOP data to a CPL table.
cpl_error_code hdrl_rect_region_parameter_update(hdrl_parameter *, cpl_size, cpl_size, cpl_size, cpl_size)
Update Rect Region Parameters object.
cpl_parameterlist * hdrl_rect_region_parameter_create_parlist(const char *, const char *, const char *, const hdrl_parameter *)
Create parameter list for hdrl_rect_region.
cpl_error_code hdrl_rect_region_fix_negatives(hdrl_parameter *rect_region, const cpl_size nx, const cpl_size ny)
wrap negative or zero coordinates around full image size
hdrl_parameter * hdrl_rect_region_parameter_create(cpl_size, cpl_size, cpl_size, cpl_size)
Creates Rect Region Parameters object.
cpl_size hdrl_rect_region_get_llx(const hdrl_parameter *)
get lower left x coordinate of rectangual region
cpl_size hdrl_rect_region_get_urx(const hdrl_parameter *)
get upper right x coordinate of rectangular region
cpl_size hdrl_rect_region_get_lly(const hdrl_parameter *)
get lower left y coordinate of rectangual region
char * hdrl_join_string(const char *sep_, int n,...)
join strings together
cpl_size hdrl_rect_region_get_ury(const hdrl_parameter *)
get upper right y coordinate of rectangual region
hdrl_parameter * hdrl_rect_region_parameter_parse_parlist(const cpl_parameterlist *, const char *, const char *)
parse parameterlist for rectangle parameters
cpl_boolean hdrl_rect_region_parameter_check(const hdrl_parameter *)
Check that the parameter is hdrl_rect_region parameter.