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 #ifndef UTILITIES_H
00028 #define UTILITIES_H
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 #define skip_if(CONDITION) \
00080 do if (CONDITION) { \
00081 if (cpl_error_get_code()) { \
00082 cpl_msg_debug("", "Skip in %s line %d due to '%s' with error '%s' " \
00083 "at %s", __FILE__, __LINE__, #CONDITION, \
00084 cpl_error_get_message(), cpl_error_get_where()); \
00085 if (strstr(cpl_error_get_where(), "visir") == NULL) \
00086 cpl_error_set_where(""); \
00087 } else { \
00088 cpl_msg_debug("", "Skip in %s line %d due to '%s'", \
00089 __FILE__, __LINE__, #CONDITION); \
00090 cpl_error_set("", CPL_ERROR_UNSPECIFIED); \
00091 } \
00092 goto cleanup; \
00093 } else { \
00094 if (cpl_error_get_code()) \
00095 cpl_msg_debug("", "No skip in %s line %d due to '%s' with error '%s' " \
00096 "at %s", __FILE__, __LINE__, #CONDITION, \
00097 cpl_error_get_message(), cpl_error_get_where()); \
00098 else \
00099 cpl_msg_debug("", "No skip in %s line %d due to '%s'", \
00100 __FILE__, __LINE__, #CONDITION); \
00101 } while (0)
00102
00103
00104 #define end_skip \
00105 do { \
00106 cleanup: \
00107 if (cpl_error_get_code()) \
00108 cpl_msg_debug("", "Cleanup in %s line %d with error '%s' at %s", \
00109 __FILE__, __LINE__, \
00110 cpl_error_get_message(), cpl_error_get_where()); \
00111 else \
00112 cpl_msg_debug("", "Cleanup in %s line %d", \
00113 __FILE__, __LINE__); \
00114 } while (0)
00115
00116
00117 #include <cxstrutils.h>
00118 #include <cxstring.h>
00119 #include <cpl.h>
00120 #include <image_ops.h>
00121 #include <cxstring.h>
00122 #include "sinfoni_globals.h"
00123 CPL_BEGIN_DECLS
00124
00125 void insert_cube( OneCube ** list, OneCube * cube, int i );
00126 void destroy_cube_list ( OneCube ** list );
00127 OneCube ** new_cube_list( int n_cubes );
00128 void array_set_value( float * array, float value, int i );
00129 float array_get_value( float * array, int i );
00130 void insert_image( OneImage ** list, OneImage * im, int i );
00131 void destroy_list ( OneImage ** list );
00132 void destroy_array(float * array);
00133 void destroy_stringarray(char ** array, int size_x);
00134 void intarray_set_value( int * array, int value, int i );
00135 void array2D_set_value( float ** array, float value, int x, int y );
00136 void destroy_2Darray(float ** array, int size_x);
00137 void destroy_2Dintarray(int ** array, int size_x);
00138 void destroy_intarray(int * array);
00139 void destroy_doublearray(double * array);
00140 void doublearray_set_value( double * array, double value, int i );
00141 int intarray_get_value( int * array, int i );
00142 int * new_int_array( int size);
00143 int ** new_2Dint_array( int size_x, int size_y);
00144 char * get_rootname(char * filename);
00145 char * get_basename(const char *filename);
00146 float Stats_get_cleanstdev(Stats * stats);
00147 float Stats_get_cleanmean(Stats * stats);
00148 float array2D_get_value( float ** array, int x, int y );
00149 float * new_float_array( int size);
00150 float ** new_2Dfloat_array( int size_x, int size_y);
00151 double doublearray_get_value( double * array, int i );
00152 double * new_double_array( int size);
00153 OneImage * promoteImageToMask ( OneImage * im, int * n_badpixels );
00154 OneImage ** new_image_list( int n_images );
00155 FitParams ** newFitParams( int n_params ) ;
00156
00157 cpl_imagelist * sinfoni_frameset_to_iset(cpl_frameset *) ;
00158 cpl_imagelist * sinfoni_imagelist_load_frameset(const cpl_frameset * frameset,cpl_type type,
00159 int pnum,int extnum);
00160
00161 char ** my_frameset_to_filenames(cpl_frameset *set, int *nfiles);
00162 char ** my_frameset_to_tags(cpl_frameset *set, int *ntags);
00163 char ** my_frameset_to_filenames(cpl_frameset *set, int *nfiles);
00164 char ** my_frameset_to_tags(cpl_frameset *set, int *ntags);
00165
00166 CPL_END_DECLS
00167
00168 #endif