00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef OC_UTILS_H
00029 #define OC_UTILS_H
00030
00031
00032
00033
00034
00035 #include <cpl.h>
00036 #include "omega_dfs.h"
00037 #include "omega_fits.h"
00038
00039 #define VIR_OK 0
00040 #define VIR_WARN 1
00041 #define VIR_FATAL 2
00042
00043 #if defined CPL_VERSION_CODE && CPL_VERSION_CODE <= CPL_VERSION(5, 5, 0)
00044 typedef int cpl_size;
00045 #define CPL_SIZE_FORMAT "d"
00046 #endif
00047
00048
00049
00050 #define freespace(_p) if (_p != NULL) {cpl_free(_p); _p = NULL;}
00051 #define freeframe(_p) if (_p != NULL) {cpl_frame_delete(_p); _p = NULL;}
00052 #define freeimage(_p) if (_p != NULL) {cpl_image_delete(_p); _p = NULL;}
00053 #define freeilist(_p) if (_p != NULL) {cpl_imagelist_delete(_p); _p = NULL;}
00054 #define freeframeset(_p) if (_p != NULL) {cpl_frameset_delete(_p); _p = NULL;}
00055 #define freetable(_p) if (_p != NULL) {cpl_table_delete(_p); _p = NULL;}
00056 #define freeplist(_p) if (_p != NULL) {cpl_propertylist_delete(_p); _p = NULL;}
00057 #define freestats(_p) if (_p != NULL) {cpl_stats_delete(_p); _p = NULL;}
00058 #define freefits(_p) if (_p != NULL) {omega_fits_delete(_p); _p = NULL;}
00059 #define freelfits(_p,_n) if (_p != NULL) {omega_fits_delete_list(_p,_n); _p = NULL;}
00060 #define freetfits(_p) if (_p != NULL) {omega_tfits_delete(_p); _p = NULL;}
00061 #define freemask(_p) if (_p != NULL) {cpl_mask_delete(_p); _p = NULL;}
00062 #define freematrix(_p) if (_p != NULL) {cpl_matrix_delete(_p); _p = NULL;}
00063 #define freevector(_p) if (_p != NULL) {cpl_vector_delete(_p); _p = NULL;}
00064 #define freebivector(_p) if (_p != NULL) {cpl_bivector_delete(_p); _p = NULL;}
00065 #define freematrix(_p) if (_p != NULL) {cpl_matrix_delete(_p); _p = NULL;}
00066 #define freewcs(_p) if (_p != NULL) {cpl_wcs_delete(_p); _p = NULL;}
00067 #define freearray(_p) if (_p != NULL) {cpl_array_delete(_p); _p = NULL;}
00068
00069
00070 const char * omega_get_license(void) ;
00071 FILE * oc_paf_print_header(
00072 char *,
00073 char *,
00074 char *);
00075
00076 char * omega_get_root_name(const char * filename);
00077 extern int omega_compare_tags(const cpl_frame *frame1, const cpl_frame *frame2);
00078 extern void omega_exten_range(int inexten, int *out1, int *out2);
00079 extern void omega_extensions(const cpl_frame *frame, int inexten, int *out1, int *out2);
00080 extern cpl_frameset *omega_frameset_subgroup(cpl_frameset *frameset,
00081 cpl_size *labels, cpl_size nlab,
00082 const char *tag);
00083 int omega_compare_reference(const cpl_image *master, const cpl_frame *refframe,
00084 int ext, cpl_stats **diffstats);
00085
00086 char * omega_get_pathname(const char * filename);
00087 cpl_frame *omega_product_frame(const char *filename, const char *tag, cpl_frame_type type);
00088
00089 int omega_save_dummy(cpl_frameset *set, cpl_parameterlist *parlist,cpl_frame_type type,
00090 cpl_type_bpp bitpix, const char *outfile, const cpl_propertylist *plist,
00091 const char *recipe, cpl_frame *product_frame);
00092
00093 int omega_save_primary(cpl_frameset *set, const cpl_parameterlist *parlist,
00094 const char *outfile, const char *recipe, const cpl_propertylist *plist,
00095 cpl_frame *product_frame, const cpl_frame *inherit);
00096
00097 cpl_image *omega_smooth_image(cpl_image *in, int size);
00098 char *omega_create_name(const char *instrument, const char *name, const char *suffix);
00099 int omega_biascor(cpl_image *image, const cpl_image *bias);
00100 const char * omega_get_extension_chipid(int ext);
00101 int omega_get_chip_orientation(int ext);
00102 int omega_save_image(const cpl_image *img,cpl_frameset *set,const cpl_parameterlist *pars,
00103 cpl_propertylist *alist, const cpl_propertylist *qclist,cpl_type_bpp bpp,
00104 const char *name, const char *recipe, cpl_frame *frame,
00105 const cpl_frame *inherit, int isfirst);
00106
00107 int omega_save_table(const cpl_table *tbl,cpl_frameset *set,const cpl_parameterlist *pars,
00108 cpl_propertylist *alist, const cpl_propertylist *qclist,const char *name,
00109 const char *recipe, cpl_frame *frame,const cpl_frame *inherit, int isfirst);
00110
00111 int omega_save_fits(omega_fits *scifits,cpl_frameset *set, const cpl_parameterlist *pars,
00112 const cpl_propertylist *qclist, cpl_type_bpp bpp,const char *name,
00113 const char *recipe,cpl_frame *product_frame, const cpl_frame *inherit,
00114 const int isfirst);
00115 cpl_error_code omega_get_pixelscale(cpl_propertylist *plist,
00116 double * pixscale_x, double * pixscale_y);
00117
00118 cpl_error_code omega_get_wcsshift(cpl_propertylist * wcslist1,
00119 cpl_propertylist * wcslist2, double * xshift, double * yshift);
00120
00121 #endif