00001 /* includes */
00002 #include <errno.h>
00003 #include "my_cnct_comp.h"
00004 #include "my_pi.h"
00005 #include "my_list.h"
00006 #include "my_reg_alloc.h"
00007 #include "my_local_types.h"
00008 #include "my_endian_affairs.h"
00009
00010
00011
00012 /* defines */
00013 #define PIXELMAP_0 ((binpix)0)
00014 #define PIXELMAP_1 ((binpix)1)
00015 #define ONE_MEG (size_t)1048576
00016
00017 #define FITS_MAGIC "SIMPLE"
00018 #define FITS_MAGIC_SZ 6
00019 #define FITS_BLOCK_SIZE (2880)
00020
00021 #define TABSPERPIX (1000)
00022 #define KERNEL_WIDTH (2.0)
00023 #define KERNEL_SAMPLES (1+(int)(TABSPERPIX * KERNEL_WIDTH))
00024
00025 #define TANH_STEEPNESS (5.0)
00026
00027 #define FIRST_LABEL 2 /* Assumed different from WHITE (see cnct_comp.c) */
00028 #define MAX_LABEL (65535)
00029 #define MAX_CLASSNUM (MAX_LABEL -2)
00030 #define CNCTCMP_BLACK (PIXELMAP_0)
00031 #define CNCTCMP_WHITE (PIXELMAP_1)
00032 /* Arc detection */
00033
00034 #define ARC_PARAM_MEDIAN_SIZE 64
00035 #define ARC_PARAM_PTYPE BPP_DEFAULT
00036 #define ARC_PARAM_THRESHFACT (1.0/1)
00037 #define ARC_PARAM_WINDOWSIZE 32
00038 #define ARC_PARAM_MINNBARCS 32
00039 #define ARC_PARAM_MINGOODPIX 100
00040 #define ARC_PARAM_NBSAMPLES 200
00041 #define ARC_PARAM_ORIENTATION 0
00042 #define ARC_PARAM_MINARCLENFACT 1.07
00043 #define ARC_PARAM_MAXARCWIDTH 33
00044
00045 #define ARC_DEBUG_LEVEL 8
00046
00047
00048
00049 #define strdup2(s) ext_strdup_x(s,__FILE__,__LINE__)
00050
00051
00052 /* the following is generated at compile time to have proper endian-ess */
00053 /* check eclipse conversions.h */
00054 #define BPP_8_UNSIGNED (8)
00055 #define BPP_16_SIGNED (16)
00056 #define BPP_32_SIGNED (32)
00057 #define BPP_IEEE_FLOAT (-32)
00058 #define BPP_IEEE_DOUBLE (-64)
00059
00060 #define BPP_DEFAULT BPP_IEEE_FLOAT
00061
00062 #define BYTESPERPIXEL(x) ( ((x) == BPP_8_UNSIGNED) ? 1 : \
00063 ((x) == BPP_16_SIGNED) ? 2 : \
00064 ((x) == BPP_32_SIGNED) ? 4 : \
00065 ((x) == BPP_IEEE_FLOAT) ? 4 : \
00066 ((x) == BPP_IEEE_DOUBLE) ? 8 : 0 )
00067
00068 /* end part generated at compile time */
00069
00070
00071 /* new types */
00072
00073 /*---------------------------------------------------------------------------*/
00082 /*---------------------------------------------------------------------------*/
00083
00084 typedef enum {
00085 /* The 1-d collapsed maximum of the arc defines its reference position */
00086 ARC_GRID_REF_1DMAX = 0,
00087 /* The gravity center of the arc defines its reference position */
00088 ARC_GRID_REF_GRAV_CENT = 1,
00089 ARC_FIND_MAX_CENT = 2
00090 } grid_refpoint_t;
00091
00092
00093 /*---------------------------------------------------------------------------*/
00100 /*---------------------------------------------------------------------------*/
00101
00102 typedef struct _ARC_PARAM_T_ {
00103 /* first line from top to include in arc detection */
00104 int badtop;
00105 /* first line at bottom to avoid in arc detection */
00106 int badbot;
00107 /* first column from left to include in arc detection */
00108 int badleft;
00109 /* first column at right to avoid in arc detection */
00110 int badright;
00111 /* nb of samples i.e. horizontal cuts */
00112 int n_calib ;
00113 /* size of median filter for detection */
00114 int median_size;
00115 /* factor on moving median for detection */
00116 double thresh_fact;
00117 /* size of window for moving theshold */
00118 int window_size;
00119 /*
00120 * Min nb of detected arcs in order to be able to estimate a 2-d dist
00121 * poly
00122 */
00123 int min_nb_arcs;
00124 /* Minimum arclen for detection */
00125 int min_arclen;
00126 /* Maximum arcwidth for detection */
00127 int max_arcwidth;
00128 /* minimum white pixels to try and detect arcs with */
00129 int min_good_pixels;
00130 /* detect horizontal or vertical lines */
00131 orientation_t arc_orientation;
00132 /* which reference point on grid to use for arcs deformation*/
00133 grid_refpoint_t grid_ref_point;
00134 } arc_param_t ;
00135
00136
00137 /*-------------------------------------------------------------------------*/
00179 /*--------------------------------------------------------------------------*/
00180
00181
00182 struct _2D_POLY_ {
00183 int nc ; /* number of coefficients in px, py, c */
00184 int * px ; /* powers of x */
00185 int * py ; /* powers of y */
00186 double * c ; /* polynomial coefficients */
00187 } ;
00188
00189 typedef struct _2D_POLY_ poly2d ;
00190
00191 /* functions */
00192
00193
00194 /*-------------------------------------------------------------------------*/
00208 /*--------------------------------------------------------------------------*/
00209
00210 OneImage *
00211 new_image(
00212 int size_x,
00213 int size_y
00214 ) ;
00215
00216
00217 /*-------------------------------------------------------------------------*/
00227 /*--------------------------------------------------------------------------*/
00228
00229 OneImage *
00230 load_image(const char * filename);
00231
00232
00233 /*-------------------------------------------------------------------------*/
00245 /*--------------------------------------------------------------------------*/
00246
00247 cube_info * get_cube_info(char *filename);
00248
00249
00250 /*-------------------------------------------------------------------------*/
00261 /*--------------------------------------------------------------------------*/
00262
00263 int file_exists(char * filename);
00264
00265 /*-------------------------------------------------------------------------*/
00276 /*--------------------------------------------------------------------------*/
00277
00278 size_t fits_get_header_size(char * name);
00279
00280 /*-------------------------------------------------------------------------*/
00305 /*--------------------------------------------------------------------------*/
00306
00307 /* <python> */
00308 char *
00309 query_fits_header(char * filename, char * keyword) ;
00310 /* </python> */
00311
00312
00313 /*-------------------------------------------------------------------------*/
00335 /*--------------------------------------------------------------------------*/
00336
00337 mmap_file * mmap_open(char * filename);
00338
00339 /*-------------------------------------------------------------------------*/
00352 /*--------------------------------------------------------------------------*/
00353
00354
00355 char * fits_getvalue(char * line);
00356 /*-------------------------------------------------------------------------*/
00366 /*--------------------------------------------------------------------------*/
00367
00368 void mmap_close(mmap_file * mm);
00369
00370 /*-------------------------------------------------------------------------*/
00385 /*--------------------------------------------------------------------------*/
00386
00387 OneImage *
00388 load_plane_from_fits(
00389 char * filename,
00390 cube_info * fileinfo,
00391 int n_plane
00392 ) ;
00393
00394 /*-------------------------------------------------------------------------*/
00418 /*--------------------------------------------------------------------------*/
00419
00420
00421 void
00422 convert_fits_to_local(
00423 pixelvalue * p_dest,
00424 BYTE * p_source,
00425 ulong32 nbpix,
00426 int pixel_type,
00427 double b_scale,
00428 double b_zero
00429 ) ;
00430 /*-------------------------------------------------------------------------*/
00451 /*--------------------------------------------------------------------------*/
00452
00453
00454 /* <python> */
00455 OneCube * list_make_cube(OneImage ** list, int np);
00456 /* </python> */
00457
00458 /*-------------------------------------------------------------------------*/
00473 /*--------------------------------------------------------------------------*/
00474
00475 /* <python> */
00476 OneCube *
00477 new_cube(
00478 int lx,
00479 int ly,
00480 int n_im
00481 ) ;
00482 /* </python> */
00483
00484 /*-------------------------------------------------------------------------*/
00496 /*--------------------------------------------------------------------------*/
00497
00498 void pixel_qsort(pixelvalue *pix_arr, int npix) ;
00499
00500 /*-------------------------------------------------------------------------*/
00510 /*--------------------------------------------------------------------------*/
00511
00512 void
00513 destroy_image(OneImage * to_destroy) ;
00514
00515 /*-------------------------------------------------------------------------*/
00529 /*--------------------------------------------------------------------------*/
00530
00531 /* <python> */
00532 void
00533 destroy_cube(
00534 OneCube * to_destroy
00535 ) ;
00536 /* </python> */
00537
00538 /*-------------------------------------------------------------------------*/
00558 /*--------------------------------------------------------------------------*/
00559
00560 OneImage *
00561 average_with_rejection(
00562 OneCube * incube,
00563 double lo_reject,
00564 double hi_reject
00565 ) ;
00566 /*-------------------------------------------------------------------------*/
00612 /*--------------------------------------------------------------------------*/
00613
00614 void
00615 compute_status(char *Msg, int done, int total, int level);
00616 /*-------------------------------------------------------------------------*/
00631 /*--------------------------------------------------------------------------*/
00632
00633 void
00634 e_warning(const char *fmt, ...) ;
00635 /*-------------------------------------------------------------------------*/
00651 /*--------------------------------------------------------------------------*/
00652
00653
00654 void
00655 e_error(const char *fmt, ...);
00656
00657
00658
00659 /*-------------------------------------------------------------------------*/
00677 /*--------------------------------------------------------------------------*/
00678
00679 void
00680 e_comment(int level, const char * fmt, ...);
00681
00682 /*-------------------------------------------------------------------------*/
00704 /*--------------------------------------------------------------------------*/
00705
00706 /* <python> */
00707 char * fits_pretty_string(char * s);
00708 /* </python> */
00709
00710 /*-------------------------------------------------------------------------*/
00726 /*--------------------------------------------------------------------------*/
00727
00728 void swap_bytes(void * p, size_t s);
00729
00730
00731 /*-------------------------------------------------------------------------*/
00742 /*--------------------------------------------------------------------------*/
00743
00744 OneImage *
00745 average_cube_to_image(
00746 OneCube * incube
00747 ) ;
00748
00749
00750 /*-------------------------------------------------------------------------*/
00771 /*--------------------------------------------------------------------------*/
00772
00773 pixelvalue
00774 average_reject_on_time_line(
00775 OneCube * in_cube,
00776 ulong32 pos,
00777 double lo_rej,
00778 double hi_rej) ;
00779
00780 /*-------------------------------------------------------------------------*/
00797 /*--------------------------------------------------------------------------*/
00798
00799 void e_logfile(char * type, char * msg);
00800
00801 /*-------------------------------------------------------------------------*/
00817 /*--------------------------------------------------------------------------*/
00818
00819 void e_logfile_start(void);
00820
00821
00822
00823 /*-------------------------------------------------------------------------*/
00838 /*--------------------------------------------------------------------------*/
00839
00840 void e_logfile_stop(void);
00841 /*-------------------------------------------------------------------------*/
00853 /*--------------------------------------------------------------------------*/
00854
00855 int
00856 add_img_local(
00857 OneImage * im1,
00858 OneImage * im2
00859 ) ;
00860 /*-------------------------------------------------------------------------*/
00877 /*--------------------------------------------------------------------------*/
00878
00879 /* <python> */
00880 void memory_status(void) ;
00881 /* </python> */
00882
00883 /*-------------------------------------------------------------------------*/
00895 /*--------------------------------------------------------------------------*/
00896
00897
00898 OneImage *
00899 sub_image(
00900 OneImage *image1,
00901 OneImage *image2) ;
00902
00903 /*-------------------------------------------------------------------------*/
00914 /*--------------------------------------------------------------------------*/
00915
00916 OneImage * copy_image(OneImage * src_img) ;
00917
00918 /*-------------------------------------------------------------------------*/
00919 /*
00920 @name ext_malloc_x
00921 @memo Allocate a block of memory.
00922 @param size Size in bytes of the block to allocate.
00923 @param filename Name of the file making the request.
00924 @param lineno Line number in the requesting file.
00925 @return Pointer to newly allocated block
00926 @doc
00927
00928 Warning: NEVER CALL THIS FUNCTION DIRECTLY IN YOUR SOURCE CODE.
00929
00930 This is a replacement for malloc. This function should never be
00931 called directly but only through a macro, using the __FILE__ and
00932 __LINE__ preprocessor macros for filename and linenumber arguments.
00933
00934 If the requested block size fits within the maximum allocatable
00935 amount of memory, this function will try to allocate it using the
00936 system's malloc call, otherwise the block is allocated in virtual
00937 memory.
00938
00939 */
00940 /*--------------------------------------------------------------------------*/
00941
00942 void *
00943 ext_malloc_x(
00944 size_t size,
00945 char * filename,
00946 int lineno
00947 ) ;
00948
00949 /*-------------------------------------------------------------------------*/
00964 /*--------------------------------------------------------------------------*/
00965
00966 char * get_login_name(void);
00967
00968
00969
00970
00971 /*-------------------------------------------------------------------------*/
00972 /*
00973 @name ext_calloc_x
00974 @memo Allocate a block of memory.
00975 @param n_elem Number of elements to allocate.
00976 @param size Size in bytes of each element.
00977 @param filename Name of the file making the request.
00978 @param lineno Line number in the requesting file.
00979 @return Pointer to newly allocated block
00980 @doc
00981
00982 Warning: NEVER CALL THIS FUNCTION DIRECTLY IN YOUR SOURCE CODE.
00983
00984 This is a replacement for calloc. This function should never be
00985 called directly but only through a macro, using the __FILE__ and
00986 __LINE__ preprocessor macros for filename and linenumber arguments.
00987
00988 If the requested block size fits within the maximum allocatable
00989 amount of memory, this function will try to allocate it using the
00990 system's calloc call, otherwise the block is allocated in virtual
00991 memory.
00992
00993 */
00994 /*--------------------------------------------------------------------------*/
00995
00996 void *
00997 ext_calloc_x(
00998 size_t n_elem,
00999 size_t size,
01000 char * filename,
01001 int lineno
01002 ) ;
01003
01004 void
01005 fill_new_image(
01006 int size_x,
01007 int size_y,
01008 OneImage * new_image,
01009 pixelvalue * data
01010 ) ;
01011
01012
01013 /*-------------------------------------------------------------------------*/
01035 /*--------------------------------------------------------------------------*/
01036
01037 double *
01038 fit_1d_poly(
01039 int poly_deg,
01040 dpoint * list,
01041 int np,
01042 double * mean_squared_error
01043 ) ;
01044
01045
01046
01047
01048 /*-------------------------------------------------------------------------*/
01056 /*--------------------------------------------------------------------------*/
01057
01058 int debug_active(void);
01059
01060 /*-------------------------------------------------------------------------*/
01074 /*--------------------------------------------------------------------------*/
01075
01076 double ipow(double x, int p);
01077
01078
01079 /*-------------------------------------------------------------------------*/
01080 /*
01081 @name ext_free_x
01082 @memo Frees allocated pointer.
01083 @param pointer Block to deallocate.
01084 @param filename Name of the source file doing the request.
01085 @param lineno Line number in the source file.
01086 @return void
01087 @doc
01088
01089 Warning: NEVER CALL THIS FUNCTION DIRECTLY IN YOUR SOURCE CODE.
01090
01091 If the block was allocated using the system's malloc or calloc,
01092 calls the system's free to deallocate it. If the block was allocated
01093 using virtual memory, unmaps the associated file and deletes it from
01094 the temporary swap space.
01095
01096 This function removes the entry related to the requested block in
01097 the global allocation table.
01098 */
01099 /*--------------------------------------------------------------------------*/
01100
01101 void
01102 ext_free_x(
01103 void * pointer,
01104 char * filename,
01105 int lineno
01106 ) ;
01107
01108 /*-------------------------------------------------------------------------*/
01139 /*--------------------------------------------------------------------------*/
01140
01141 fits_header * fits_read_header(char * filename);
01142
01143 /*-------------------------------------------------------------------------*/
01153 /*--------------------------------------------------------------------------*/
01154
01155 fits_header * fits_header_new(void);
01156
01157 /*-------------------------------------------------------------------------*/
01172 /*--------------------------------------------------------------------------*/
01173
01174 void fits_header_append(
01175 fits_header * hdr,
01176 char * key,
01177 char * val,
01178 char * com,
01179 char * lin);
01180
01181 /*-------------------------------------------------------------------------*/
01182 /*
01183 @name ext_strdup_x
01184 @memo Copy a string into a newly allocated string.
01185 @param s String to copy.
01186 @param file Name of the source file making the request.
01187 @param lineno Line number in the source file.
01188 @return Pointer to newly allocated character string.
01189 @doc
01190
01191 Warning: NEVER CALL THIS FUNCTION DIRECTLY IN YOUR SOURCE CODE.
01192
01193 This function allows strdup() calls to be logged as malloc and
01194 calloc calls are. Direct use of this function is forbidden, use the
01195 strdup2() macro instead.
01196
01197 For Linux compatibility reasons, the top-level macro is not an
01198 overloading of strdup, because strdup is already a macro on Linux
01199 (it should not be according to POSIX, but it is). This obliges users
01200 of this module to replace all their calls to strdup by calls to
01201 strdup2, otherwise false memory leak warnings will result upon
01202 program termination.
01203
01204 The returned string must be freed using the overloaded free()
01205 function defined in this module.
01206 */
01207 /*--------------------------------------------------------------------------*/
01208
01209 char * ext_strdup_x(char * s, char * file, int lineno) ;
01210 /*-------------------------------------------------------------------------*/
01226 /*--------------------------------------------------------------------------*/
01227
01228 /* <python> */
01229 void destroy_cube_shallow(OneCube * d);
01230 /* </python> */
01231
01232 /*-------------------------------------------------------------------------*/
01265 /*--------------------------------------------------------------------------*/
01266
01267 poly2d * poly2d_build_from_string(char * s);
01268
01269 /*-------------------------------------------------------------------------*/
01283 /*--------------------------------------------------------------------------*/
01284
01285 poly2d * poly2d_allocate(int nc);
01286 /*-------------------------------------------------------------------------*/
01296 /*--------------------------------------------------------------------------*/
01297
01298 void poly2d_free(poly2d * p);
01299
01300 /*-------------------------------------------------------------------------*/
01336 /*--------------------------------------------------------------------------*/
01337
01338
01339 OneImage *
01340 warp_image_generic(
01341 OneImage * image_in,
01342 char * kernel_type,
01343 poly2d * poly_u,
01344 poly2d * poly_v
01345 ) ;
01346
01347 /*-------------------------------------------------------------------------*/
01371 /*--------------------------------------------------------------------------*/
01372
01373
01374 double *
01375 generate_interpolation_kernel(char * kernel_type) ;
01376 /*-------------------------------------------------------------------------*/
01397 /*--------------------------------------------------------------------------*/
01398
01399 double * generate_tanh_kernel(double steep) ;
01400
01401
01402 /*-------------------------------------------------------------------------*/
01415 /*--------------------------------------------------------------------------*/
01416
01417 void show_interpolation_kernel(char * kernel_name) ;
01418
01419 /*-------------------------------------------------------------------------*/
01432 /*--------------------------------------------------------------------------*/
01433
01434 double
01435 poly2d_compute(
01436 poly2d * p,
01437 double x,
01438 double y
01439 );
01440 /*-------------------------------------------------------------------------*/
01450 /*--------------------------------------------------------------------------*/
01451 void fits_header_destroy(fits_header * hdr);
01452 /*-------------------------------------------------------------------------*/
01467 /*--------------------------------------------------------------------------*/
01468 char * fits_header_getstr(fits_header * hdr, const char * key);
01469
01470 /*-------------------------------------------------------------------------*/
01480 /*--------------------------------------------------------------------------*/
01481 /* <python> */
01482 OneCube *
01483 copy_cube(
01484 OneCube *src_cube
01485 ) ;
01486 /* </python> */
01487 /*-------------------------------------------------------------------------*/
01502 /*--------------------------------------------------------------------------*/
01503 /* <python> */
01504 OneCube * load_cube(const char * filename);
01505 /* </python> */
01506
01507 /*-------------------------------------------------------------------------*/
01518 /*--------------------------------------------------------------------------*/
01519
01520 /* <python> */
01521 int eclipse_is_fits_file(char *filename);
01522 /* </python> */
01523 /*-------------------------------------------------------------------------*/
01532 /*--------------------------------------------------------------------------*/
01533 /* <python> */
01534 OneCube * load_cube_FITS(char * filename);
01535 /* </python> */
01536
01537 /*-------------------------------------------------------------------------*/
01550 /*--------------------------------------------------------------------------*/
01551
01552 boolean data_format_compatible(int ptype) ;
01553
01554 /*-------------------------------------------------------------------------*/
01577 /*--------------------------------------------------------------------------*/
01578
01579 int
01580 cst_op_image_local(
01581 OneImage * image,
01582 double constant,
01583 int operation
01584 ) ;
01585
01586 /*-------------------------------------------------------------------------*/
01609 /*--------------------------------------------------------------------------*/
01610
01611 OneImage *
01612 shift_image(
01613 OneImage * image_in,
01614 double shift_x,
01615 double shift_y,
01616 double * interp_kernel) ;
01617
01618
01619 /*-------------------------------------------------------------------------*/
01631 /*--------------------------------------------------------------------------*/
01632
01633 int
01634 mul_img_local(
01635 OneImage * im1,
01636 OneImage * im2
01637 ) ;
01638
01639
01640 /*---------------------------------------------------------------------------*/
01659 /*---------------------------------------------------------------------------*/
01660 poly2d * compute_distortion(
01661 OneImage * in,
01662 int badleft,
01663 int badright,
01664 int badtop,
01665 int badbot,
01666 int orientation,
01667 float offset);
01668
01669 /*-------------------------------------------------------------------------*/
01680 /*--------------------------------------------------------------------------*/
01681
01682
01683 /* <python> */
01684 int is_ascii_list(char * name);
01685 /* </python> */
01686
01687 /*-------------------------------------------------------------------------*/
01701 /*--------------------------------------------------------------------------*/
01702
01703 /* <python> */
01704 OneCube * load_cube_ASCII_list(char * listname);
01705 /* </python> */
01706
01707 /*-------------------------------------------------------------------------*/
01719 /*--------------------------------------------------------------------------*/
01720
01721 /* <python> */
01722 char * get_tempfile_name(void);
01723 /* </python> */
01724
01725 /*-------------------------------------------------------------------------*/
01736 /*--------------------------------------------------------------------------*/
01737
01738 double
01739 sinc(double x) ;
01740
01741 /*---------------------------------------------------------------------------*/
01756 /*---------------------------------------------------------------------------*/
01757 arc_param_t *setup_default_arc_param(
01758 int window_size,
01759 int median_size,
01760 double thresh_fact,
01761 grid_refpoint_t grid_ref_point) ;
01762
01763 /*---------------------------------------------------------------------------*/
01773 /*---------------------------------------------------------------------------*/
01774 double *dist_engine(arc_param_t *arc_param, OneImage *in, float offset);
01775 /*-------------------------------------------------------------------------*/
01792 /*--------------------------------------------------------------------------*/
01793
01794 /* <python> */
01795 double image_median_stat(OneImage *in, double *sigma);
01796 /* </python> */
01797 /*-------------------------------------------------------------------------*/
01815 /*--------------------------------------------------------------------------*/
01816
01817 int fillrect_in_image(
01818 OneImage * in,
01819 pixelvalue val,
01820 int mini,
01821 int maxi,
01822 int minj,
01823 int maxj);
01824
01825 /*-------------------------------------------------------------------------*/
01836 /*--------------------------------------------------------------------------*/
01837
01838 OneImage *
01839 image_filter_vertical_median(
01840 OneImage * in,
01841 int filtsize
01842 ) ;
01843 /*-------------------------------------------------------------------------*/
01859 /*--------------------------------------------------------------------------*/
01860
01861 /* <python> */
01862 pixel_map *
01863 thresh_image_to_pixelmap(
01864 OneImage * in,
01865 double lo_cut,
01866 double hi_cut
01867 ) ;
01868 /* </python> */
01869 /*-------------------------------------------------------------------------*/
01879 /*--------------------------------------------------------------------------*/
01880
01881 /* <python> */
01882 pixelvalue
01883 get_median_pixelvalue_image(OneImage * in) ;
01884 /* </python> */
01885
01886 /*-------------------------------------------------------------------------*/
01901 /*--------------------------------------------------------------------------*/
01902
01903 pixelvalue median_pixelvalue(pixelvalue * a, int n);
01904 /*-------------------------------------------------------------------------*/
01934 /*--------------------------------------------------------------------------*/
01935
01936 void
01937 save_image_to_fits(
01938 OneImage * to_save,
01939 char * filename,
01940 int pixel_type
01941 ) ;
01942 /*-------------------------------------------------------------------------*/
01956 /*--------------------------------------------------------------------------*/
01957
01958 /* <python> */
01959 pixel_map *
01960 new_pixelmap(
01961 int lx,
01962 int ly
01963 ) ;
01964 /* </python> */
01965 /*-------------------------------------------------------------------------*/
01976 /*--------------------------------------------------------------------------*/
01977
01978 OneImage *
01979 image_filter_horizontal_median(
01980 OneImage * in,
01981 int filtsize ) ;
01982
01983 /*-------------------------------------------------------------------------*/
01997 /*--------------------------------------------------------------------------*/
01998
01999 pixelvalue
02000 opt_med3(
02001 pixelvalue * p
02002 ) ;
02003
02004 /*-------------------------------------------------------------------------*/
02018 /*--------------------------------------------------------------------------*/
02019
02020 pixelvalue
02021 opt_med5(
02022 pixelvalue * p
02023 );
02024
02025
02026 /*-------------------------------------------------------------------------*/
02040 /*--------------------------------------------------------------------------*/
02041
02042 pixelvalue
02043 opt_med7(
02044 pixelvalue * p
02045 ) ;
02046 /*-------------------------------------------------------------------------*/
02064 /*--------------------------------------------------------------------------*/
02065
02066 pixelvalue
02067 opt_med9(
02068 pixelvalue * p
02069 ) ;
02070
02071
02072
02073 /*-------------------------------------------------------------------------*/
02091 /*--------------------------------------------------------------------------*/
02092
02093 pixelvalue
02094 opt_med25(
02095 pixelvalue * p
02096 ) ;
02097
02098 /*-------------------------------------------------------------------------*/
02126 /*--------------------------------------------------------------------------*/
02127
02128 pixelvalue kth_smallest(pixelvalue a[], int n, int k);
02129
02130 /*-------------------------------------------------------------------------*/
02152 /*--------------------------------------------------------------------------*/
02153
02154 /* <python> */
02155 OneCube *
02156 promote_image_to_cube(
02157 OneImage * candidate
02158 ) ;
02159 /* </python> */
02160 /*-------------------------------------------------------------------------*/
02171 /*--------------------------------------------------------------------------*/
02172
02173 fits_header * fits_header_default(void);
02174
02175 /*-------------------------------------------------------------------------*/
02192 /*--------------------------------------------------------------------------*/
02193
02194 void fits_header_add(
02195 fits_header * hdr,
02196 char * key,
02197 char * val,
02198 char * com,
02199 char * lin);
02200 /*-------------------------------------------------------------------------*/
02211 /*--------------------------------------------------------------------------*/
02212
02213 int fits_dump_header(
02214 fits_header * hdr,
02215 FILE * out
02216 );
02217 /*-------------------------------------------------------------------------*/
02234 /*--------------------------------------------------------------------------*/
02235 int append_image_data_to_fits_file(
02236 char * filename,
02237 OneImage * appended,
02238 int pixtype
02239 );
02240 /*-------------------------------------------------------------------------*/
02255 /*--------------------------------------------------------------------------*/
02256 void
02257 stuff_with_zeros(
02258 char * filename,
02259 size_t size_before
02260 );
02261 /*-------------------------------------------------------------------------*/
02276 /*--------------------------------------------------------------------------*/
02277
02278 int fits_header_makeline(
02279 char * line,
02280 llnode_t * node,
02281 int conservative);
02282 /*-------------------------------------------------------------------------*/
02305 /*--------------------------------------------------------------------------*/
02306
02307
02308 void
02309 convert_local_to_fits(
02310 BYTE *p_dest,
02311 pixelvalue *p_source,
02312 ulong32 nbpix,
02313 int pixel_type
02314 ) ;
02315 /*-------------------------------------------------------------------------*/
02330 /*--------------------------------------------------------------------------*/
02331
02332 void eclipse_keytuple2str(
02333 char * line,
02334 char * key,
02335 char * val,
02336 char * com
02337 );
02338 /*-------------------------------------------------------------------------*/
02356 /*--------------------------------------------------------------------------*/
02357 OneImage *
02358 collapse_image_median(
02359 OneImage * in,
02360 int direction,
02361 int discard_lo,
02362 int discard_hi
02363 );
02364 /*-------------------------------------------------------------------------*/
02374 /*--------------------------------------------------------------------------*/
02375
02376 /* <python> */
02377 void destroy_pixelmap(pixel_map * p) ;
02378 /* </python> */
02379
02380 /*--------------------------------------------------------------------------*/
02392 /*--------------------------------------------------------------------------*/
02393 label_image_t * pixelmap_2_label_image(pixel_map *pm);
02394 /*--------------------------------------------------------------------------*/
02421 /*--------------------------------------------------------------------------*/
02422 cc_stats_t *labelize_binary(label_image_t *label_image);
02423 /*--------------------------------------------------------------------------*/
02433 /*--------------------------------------------------------------------------*/
02434 void free_label_image( label_image_t *to_destroy);
02435 /*--------------------------------------------------------------------------*/
02446 /*--------------------------------------------------------------------------*/
02447 int dump_labelimage( label_image_t *to_dump, char *filename);
02448 /*--------------------------------------------------------------------------*/
02461 /*--------------------------------------------------------------------------*/
02462 int print_ccfeaturestable(
02463 cc_stats_t * cs,
02464 unsigned long numentries,
02465 FILE * f,
02466 char * fin_name);
02467 /*--------------------------------------------------------------------------*/
02477 /*--------------------------------------------------------------------------*/
02478 int select_objs(label_image_t* l, int *objlist, int nobjs);
02479 /*-------------------------------------------------------------------------*/
02489 /*--------------------------------------------------------------------------*/
02490 /* <python> */
02491 int fits_is_boolean(char * s);
02492 /* </python> */
02493 /*-------------------------------------------------------------------------*/
02503 /*--------------------------------------------------------------------------*/
02504 /* <python> */
02505 int fits_is_int(char * s);
02506 /* </python> */
02507
02508
02509 /*-------------------------------------------------------------------------*/
02519 /*--------------------------------------------------------------------------*/
02520 /* <python> */
02521 int fits_is_float(char * s);
02522 /* </python> */
02523
02524
02525 /*-------------------------------------------------------------------------*/
02535 /*--------------------------------------------------------------------------*/
02536 /* <python> */
02537 int fits_is_complex(char * s);
02538 /* </python> */
02539
02540 /*--------------------------------------------------------------------------*/
02549 /*--------------------------------------------------------------------------*/
02550 label_image_t *new_label_image(size_t lx, size_t ly);
02551
02552
02553
02554
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001