irplib_detmon-test.c

00001 /*                                                                              *
00002  *   This file is part of the ESO IRPLIB package                                *
00003  *   Copyright (C) 2004,2005 European Southern Observatory                      *
00004  *                                                                              *
00005  *   This library is free software; you can redistribute it and/or modify       *
00006  *   it under the terms of the GNU General Public License as published by       *
00007  *   the Free Software Foundation; either version 2 of the License, or          *
00008  *   (at your option) any later version.                                        *
00009  *                                                                              *
00010  *   This program is distributed in the hope that it will be useful,            *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of             *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
00013  *   GNU General Public License for more details.                               *
00014  *                                                                              *
00015  *   You should have received a copy of the GNU General Public License          *
00016  *   along with this program; if not, write to the Free Software                *
00017  *   Foundation, 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA       *
00018  *                                                                              */
00019  
00020 #ifdef HAVE_CONFIG_H
00021 #include <config.h>
00022 #endif
00023 
00024 /*----------------------------------------------------------------------------
00025                                 Includes
00026  ----------------------------------------------------------------------------*/
00027 
00028 
00029 #include <irplib_detmon.h>
00030 
00031 
00032 #include <math.h>
00033 /*---------------------------------------------------------------------------*/
00034 /*
00035  * @defgroup irplib_detmon_test   Testing of the IRPLIB utilities
00036  */
00037 /*---------------------------------------------------------------------------*/
00038 
00039 #define PI 3.141592653
00040 /*----------------------------------------------------------------------------
00041                                 Defines
00042  ----------------------------------------------------------------------------*/
00043 
00044 #ifndef IMAGESIZE
00045 #define IMAGESIZE       128
00046 #endif
00047 
00048 #define IMAGELISTSIZE   10
00049 
00050 #define NBADPIXS        10
00051 
00052 #undef REGEXP
00053 #define REGEXP                            "^(ARCFILE|MJD-OBS|ESO TPL ID|" \
00054                                           "DATE-OBS|ESO DET DIT|ESO DET NDIT|"\
00055                                           "ESO DET NCORRS|"\
00056                                           "ESO DET MODE NAME)$"
00057 
00058 /*----------------------------------------------------------------------------
00059                             Private Function prototypes
00060  ----------------------------------------------------------------------------*/
00061 
00062 static void irplib_detmon_tests(void);
00063 
00064 
00065 cpl_frameset * irplib_detmon_pernoise_tests_fill_frameset(cpl_boolean,
00066                                                           int);
00067 
00068 cpl_frameset * irplib_detmon_tests_fill_frameset(const char     * tag_on,
00069                                                  const char     * tag_off,
00070                                                  int              non,
00071                                                  cpl_boolean      opt_nir,
00072                                                  cpl_boolean      with_exts,
00073                                                  int              nexts);
00074 
00075 /*---------------------------------------------------------------------------*/
00076 /*
00077  * @brief   Unit tests of fit module
00078  */
00079 /*---------------------------------------------------------------------------*/
00080 
00081 int main(void)
00082 {
00083     /* Initialize CPL + IRPLIB */
00084     cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
00085 
00086     irplib_detmon_tests();
00087 
00088     return cpl_test_end(0);
00089 }
00090 
00091 static void irplib_detmon_tests(void)
00092 {
00093 
00094     cpl_parameterlist   * parlist;
00095     cpl_frameset        * frameset;
00096     cpl_frameset        * set;
00097 
00098     const char * tag = "RAW";
00099     cpl_error_code error;
00100 
00101     cpl_propertylist * prolist;
00102     /* HIGH LEVEL FUNCTION FOR RON/BIAS RECIPE */
00103 
00104     frameset = irplib_detmon_tests_fill_frameset(tag, tag, 3, TRUE, FALSE, 0);
00105 
00106     set = cpl_frameset_duplicate(frameset);
00107     parlist = cpl_parameterlist_new();
00108 
00109     prolist = irplib_detmon_fill_prolist("PROCATG", "TYPE", "TECH", CPL_TRUE);
00110 
00111     irplib_detmon_ronbias_fill_parlist_default(parlist, "detmon_ronbias", "detmon");
00112 
00113 
00114     irplib_detmon_ronbias(set, parlist, tag, "detmon_ronbias", "detmon",
00115               REGEXP, prolist, NULL, NULL, prolist, prolist,
00116               prolist, prolist,  "DETMON / 1.0", NULL, OPT);
00117 
00118     cpl_test_error(CPL_ERROR_NONE);
00119     cpl_error_reset();
00120 
00121     cpl_parameterlist_delete(parlist);
00122     cpl_frameset_delete(set);
00123 
00124     /* 2. test with extensions */
00125     set = irplib_detmon_tests_fill_frameset(tag, tag, 3, TRUE, TRUE, 4);
00126     parlist = cpl_parameterlist_new();
00127     irplib_detmon_ronbias_fill_parlist(parlist, "detmon_ronbias", "detmon",
00128                        "ALL", /* --method */
00129                        "NORM",/* --pmethod */
00130                        1,     /* --preoverscan_degree */
00131                        -1,    /* --random_nsamples */
00132                        -1,    /* --random_sizex */
00133                        -1,    /* --random_sizey */
00134                        0,     /* --criteria     */
00135                        -1,    /* --ref_llx     */
00136                        -1,    /* --ref_lly */
00137                        -1,    /* --ref_urx */
00138                        -1,    /* --ref_ury */
00139                        "MEAN",/* --stacking_method */
00140                        3,     /* --stacking_ks_low */
00141                        10000, /* --stacking_ks_high */
00142                        25,    /* --stacking_ks_iter */ 
00143                        0,     /* --master_shift_x */
00144                        0,     /* --master_shift_y */
00145                        -1,    /* --ron_llx */
00146                        -1,    /* --ron_lly */
00147                        -1,    /* --ron_urx */
00148                        -1,    /* --ron_ury */
00149                        -1,    /* --exts */
00150                        OPT);
00151 
00152     error =irplib_detmon_ronbias(set, parlist, tag, "detmon_ronbias", "detmon",
00153                  REGEXP, prolist, NULL, NULL, prolist, prolist,
00154                  prolist, prolist,  "DETMON / 1.0", NULL, OPT);
00155 
00156     /* Move the NULLs away when X and Y structure built */
00157 
00158     cpl_test_eq(error, CPL_ERROR_NONE);
00159     cpl_test_error(CPL_ERROR_NONE);
00160 
00161     cpl_parameterlist_delete(parlist);
00162     cpl_frameset_delete(set);
00163 
00164     cpl_frameset_delete(frameset);
00165     cpl_propertylist_delete(prolist);
00166 
00167     
00168 #ifdef HAVE_FFTW
00169     /* Tests for Periodic Noise Characterisation */
00170 
00171     frameset = irplib_detmon_pernoise_tests_fill_frameset(0,0);
00172 
00173     parlist = cpl_parameterlist_new();
00174     irplib_detmon_fill_pernoise_params_default(parlist,
00175                                                "detmon_pernoise", "detmon");
00176 
00177     irplib_detmon_pernoise(frameset, parlist, "RAW", "detmon_pernoise", "detmon", "PRO-1.15", "DETMON / 1.0", NULL);
00178 
00179     cpl_parameterlist_delete(parlist);
00180     cpl_frameset_delete(frameset);
00181 
00182 #endif
00183 
00184     /* Test for DARK recipe */
00185 
00186     frameset = irplib_detmon_tests_fill_frameset("DARK", "DARK", 20,FALSE, FALSE, 0);
00187     parlist = cpl_parameterlist_new();
00188     error = irplib_detmon_fill_dark_params_default(parlist,
00189                                                "detmon_dark", "detmon");
00190     cpl_test_zero(error);
00191 
00192     irplib_detmon_dark(frameset, parlist, "DARK", "detmon_dark", "detmon",
00193                        "MASTER", "DSNU", "DSNU_TABLE", "DETMON / 1.0", NULL);
00194 
00195     cpl_parameterlist_delete(parlist);
00196     cpl_frameset_delete(frameset);
00197 
00198     /* New test for irplib_imagelist_collapse_stdev_create() */
00199     {
00200     cpl_imagelist * mylist = cpl_imagelist_new();
00201     cpl_image     * image  = cpl_image_new(IMAGESIZE, IMAGESIZE,
00202                            CPL_TYPE_FLOAT);
00203     cpl_image     * collapsed;
00204     double          mean, stdev;
00205 
00206     int i;
00207     for (i = 1; i <= 5; i++) {
00208         cpl_image * to_list = 
00209         cpl_image_add_scalar_create(image, 10.0 * i);
00210         cpl_imagelist_set(mylist, to_list, i - 1);
00211     }
00212 
00213     collapsed = irplib_imagelist_collapse_stdev_create(mylist);
00214     mean  = cpl_image_get_mean(collapsed);
00215     stdev = cpl_image_get_stdev(collapsed);
00216 
00217     cpl_test_rel(mean, 15.81138, 1e-4);
00218     cpl_test_zero(stdev);
00219 
00220     cpl_imagelist_delete(mylist);
00221     cpl_image_delete(image);
00222     cpl_image_delete(collapsed);
00223     }
00224 
00225     /* Tests for ksigma_clip() */
00226     {
00227     cpl_image     * image  = cpl_image_new(IMAGESIZE, IMAGESIZE,    
00228                            CPL_TYPE_FLOAT);
00229     double mean, stdev;
00230 
00231     cpl_image_fill_noise_uniform(image, 300, 350);
00232 
00233     cpl_image_set(image, 50, 50, 0.0); 
00234     cpl_image_set(image, 15, 1, 0.0); 
00235     cpl_image_set(image, 76, 32, 0.0); 
00236     cpl_image_set(image, 10, 19, 0.0); 
00237     
00238     cpl_image_set(image, 30, 10, 6000.0); 
00239     cpl_image_set(image, 31, 11, 6020.0); 
00240     cpl_image_set(image, 30, 20, 6030.0); 
00241     cpl_image_set(image, 30, 40, 6040.0); 
00242 
00243     error = irplib_ksigma_clip(image, 1, 1, IMAGESIZE, IMAGESIZE,
00244                    3.0, 10, 1e-5, &mean, &stdev);
00245     cpl_test(error == CPL_ERROR_NONE);
00246     cpl_test(mean  > 320.0 && mean  < 330.0);
00247     cpl_test(stdev > 12.0  && stdev < 18.0 );
00248     
00249     cpl_image_delete(image);
00250     }
00251 
00252     cpl_test_zero(system("rm *.paf *.fits"));
00253 }
00254 
00255 
00256 cpl_frameset * irplib_detmon_pernoise_tests_fill_frameset(cpl_boolean with_exts,
00257                                                           int nexts)
00258 {
00259 
00260     cpl_frameset                * frameset = cpl_frameset_new();
00261     cpl_frame                   * frame;
00262     cpl_propertylist            * plist;
00263 
00264     /* Create dummy image(s) */
00265 
00266     cpl_image * raw1 = cpl_image_new(512, 512, CPL_TYPE_FLOAT);
00267     cpl_image * raw2 = cpl_image_new(512, 512, CPL_TYPE_FLOAT);
00268     int i, j, k = 0;
00269 
00270     cpl_image_fill_noise_uniform(raw1, -2, 2);
00271 
00272     cpl_image_add_scalar(raw1, 100);
00273 
00274 
00275     for(i = 1; i <= 512; i++){
00276         for(j = 1; j <= 512; j++){
00277             int rejected;
00278             double value = cpl_image_get(raw1, j, i, &rejected);
00279             cpl_image_set(raw1, j, i, 4*sin((double)i/16*CPL_MATH_2PI) + value); 
00280             if(rejected < 0) {
00281                cpl_msg_error(cpl_func, "Error adding test noise");
00282                k++;
00283             } 
00284         }
00285     }
00286 
00287     cpl_image_fill_noise_uniform(raw2, -3, 3);
00288 
00289     frame = cpl_frame_new();
00290     cpl_frame_set_filename(frame, "pertest1.fits");
00291     cpl_frame_set_tag(frame, "RAW");
00292     cpl_frame_set_type(frame, CPL_FRAME_TYPE_IMAGE);
00293     cpl_frame_set_group(frame, CPL_FRAME_GROUP_RAW);
00294 
00295     cpl_frameset_insert(frameset, frame);
00296 
00297     plist = cpl_propertylist_new();
00298 
00299     cpl_propertylist_append_double(plist, "ESO DET DIT", (double)(3));
00300     cpl_propertylist_append_double(plist, "EXPTIME", (double)(3));
00301     cpl_propertylist_append_double(plist, "MJD-OBS", 0);
00302 
00303 
00304     if(with_exts == TRUE) {
00305         cpl_image_save(NULL, "pertest1.fits", CPL_BPP_IEEE_FLOAT, plist, CPL_IO_DEFAULT);
00306         for(j = 0; j < nexts; j++) {
00307             cpl_image_save(raw1, "pertest1.fits", CPL_BPP_IEEE_FLOAT, plist, CPL_IO_EXTEND);
00308         }
00309     } else {
00310         cpl_image_save(raw1, "pertest1.fits", CPL_BPP_IEEE_FLOAT, plist, CPL_IO_DEFAULT);
00311     }
00312 
00313 
00314     frame = cpl_frame_new();
00315     cpl_frame_set_filename(frame, "pertest2.fits");
00316     cpl_frame_set_tag(frame, "RAW");
00317     cpl_frame_set_type(frame, CPL_FRAME_TYPE_IMAGE);
00318     cpl_frame_set_group(frame, CPL_FRAME_GROUP_RAW);
00319 
00320     cpl_frameset_insert(frameset, frame);
00321 
00322     if(with_exts == TRUE) {
00323         cpl_image_save(NULL, "pertest2.fits", CPL_BPP_IEEE_FLOAT, plist, CPL_IO_DEFAULT);
00324         for(j = 0; j < nexts; j++) {
00325             cpl_image_save(raw2, "pertest2.fits", CPL_BPP_IEEE_FLOAT, plist, CPL_IO_EXTEND);
00326         }
00327     } else {
00328         cpl_image_save(raw2, "pertest2.fits", CPL_BPP_IEEE_FLOAT, plist, CPL_IO_DEFAULT);
00329     }
00330     cpl_propertylist_delete(plist);
00331     cpl_image_delete(raw2);
00332     cpl_image_delete(raw1);
00333             
00334     return frameset;
00335 }
00336 
00337 /*---------------------------------------------------------------------------*/
00338 /*
00339  * @brief  Detect bad pixels of a selected type
00340  * @param  in           Input image
00341  * @param  mean         Mean level of the image - used to compute threshold
00342  * @param  sigma        Stdev level of the image - used to compute threshold
00343  * @param  flag         Flag - represents selected type of bad pixels (see enum)
00344  * @return The detected bad pixels in a cpl_mask.
00345  */
00346 /*---------------------------------------------------------------------------*/
00347 
00348 cpl_frameset * irplib_detmon_tests_fill_frameset(const char     * tag_on,
00349                                                  const char     * tag_off,
00350                                                  int              non,
00351                                                  cpl_boolean      opt_nir,
00352                                                  cpl_boolean      with_exts,
00353                                                  int              nexts)
00354 {
00355     cpl_frameset                * frameset;
00356     cpl_frame                   * frame;
00357     int i;
00358     char                        frame_name[20];
00359     cpl_propertylist            * plist;
00360     cpl_image                   * image;
00361     frameset = cpl_frameset_new();
00362 
00363     for (i=0; i<non; i++) {
00364         frame = cpl_frame_new();
00365         sprintf(frame_name, "dummyon%d.fits",i);
00366         cpl_frame_set_filename(frame, frame_name);
00367         cpl_frame_set_tag(frame, tag_on);
00368         cpl_frame_set_type(frame, CPL_FRAME_TYPE_IMAGE);
00369         cpl_frame_set_group(frame, CPL_FRAME_GROUP_RAW);
00370 
00371         cpl_frameset_insert(frameset, frame);
00372 
00373         plist = cpl_propertylist_new();
00374         if(opt_nir == TRUE) {
00375             cpl_propertylist_append_double(plist, "ESO DET DIT", (double)(i/2+1));
00376             cpl_propertylist_append_double(plist, "EXPTIME", (double)(i/2+1));
00377             cpl_propertylist_append_double(plist, "MJD-OBS", 100);
00378 
00379         cpl_propertylist_append_int(plist, "NAXIS1", IMAGESIZE);
00380         cpl_propertylist_append_int(plist, "NAXIS2", IMAGESIZE);
00381         cpl_propertylist_append_int(plist, "ESO DET OUT1 NX", IMAGESIZE + 10 );
00382         cpl_propertylist_append_int(plist, "ESO DET OUT1 NY", IMAGESIZE);
00383         cpl_propertylist_append_int(plist, "ESO DET OUT1 PRSCX", 5);
00384         cpl_propertylist_append_int(plist, "ESO DET OUT1 OVSCX", 5);
00385         } else {
00386             cpl_propertylist_append_double(plist, "ESO DET DIT", (double)((i+1)/2));
00387             cpl_propertylist_append_double(plist, "EXPTIME", (double)((i+1)/2));
00388             cpl_propertylist_append_double(plist, "MJD-OBS",100);
00389 
00390         cpl_propertylist_append_int(plist, "NAXIS1", IMAGESIZE);
00391         cpl_propertylist_append_int(plist, "NAXIS2", IMAGESIZE);
00392         cpl_propertylist_append_int(plist, "ESO DET OUT1 NX", IMAGESIZE + 10 );
00393         cpl_propertylist_append_int(plist, "ESO DET OUT1 NY", IMAGESIZE);
00394         cpl_propertylist_append_int(plist, "ESO DET OUT1 PRSCX", 5);
00395         cpl_propertylist_append_int(plist, "ESO DET OUT1 OVSCX", 5);
00396 
00397         }
00398 
00399         if(with_exts == TRUE) {
00400           int j;
00401           cpl_image_save(NULL, frame_name, CPL_BPP_IEEE_FLOAT, plist, CPL_IO_DEFAULT);
00402           for(j = 0; j < nexts; j++) {
00403             image = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
00404             cpl_image_fill_noise_uniform(image, 25, 50);
00405             cpl_ensure(cpl_error_get_code()== CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, NULL);
00406         cpl_image_add_scalar(image, 300);
00407 
00408         cpl_image_set(image, 10, 10, 0.0); 
00409         cpl_image_set(image, 11, 11, 0.0); 
00410         cpl_image_set(image, 20, 20, 0.0); 
00411         cpl_image_set(image, 10, 40, 0.0); 
00412         cpl_image_set(image, 40, 10, 0.0); 
00413         cpl_image_set(image, 12, 32, 0.0); 
00414         cpl_image_set(image, 50, 50, 0.0); 
00415         cpl_image_set(image, 15, 1, 0.0); 
00416         cpl_image_set(image, 76, 32, 0.0); 
00417         cpl_image_set(image, 10, 19, 0.0); 
00418 
00419         cpl_image_set(image, 30, 10, 6000.0); 
00420         cpl_image_set(image, 31, 11, 6020.0); 
00421         cpl_image_set(image, 30, 20, 6030.0); 
00422         cpl_image_set(image, 30, 40, 6040.0); 
00423         cpl_image_set(image, 30, 10, 6070.0); 
00424         cpl_image_set(image, 52, 32, 6300.0); 
00425         cpl_image_set(image, 60, 50, 6500.0); 
00426         cpl_image_set(image, 85, 1, 6100.0); 
00427         cpl_image_set(image, 86, 32, 6040.0); 
00428         cpl_image_set(image, 90, 19, 6020.0); 
00429 
00430             cpl_image_save(image, frame_name, CPL_BPP_IEEE_FLOAT, plist, CPL_IO_EXTEND);
00431             cpl_image_delete(image);
00432           }
00433         } else {
00434             image = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
00435             cpl_image_fill_noise_uniform(image, 25, 50);
00436             cpl_ensure(cpl_error_get_code()== CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, NULL);
00437         cpl_image_add_scalar(image, 300);
00438         cpl_image_set(image, 10, 10, 0.0); 
00439         cpl_image_set(image, 11, 11, 0.0); 
00440         cpl_image_set(image, 20, 20, 0.0); 
00441         cpl_image_set(image, 10, 40, 0.0); 
00442         cpl_image_set(image, 40, 10, 0.0); 
00443         cpl_image_set(image, 12, 32, 0.0); 
00444         cpl_image_set(image, 50, 50, 0.0); 
00445         cpl_image_set(image, 15, 1, 0.0); 
00446         cpl_image_set(image, 76, 32, 0.0); 
00447         cpl_image_set(image, 10, 19, 0.0); 
00448 
00449         cpl_image_set(image, 30, 10, 6000.0); 
00450         cpl_image_set(image, 31, 11, 6020.0); 
00451         cpl_image_set(image, 30, 20, 6030.0); 
00452         cpl_image_set(image, 30, 40, 6040.0); 
00453         cpl_image_set(image, 30, 10, 6070.0); 
00454         cpl_image_set(image, 52, 32, 6300.0); 
00455         cpl_image_set(image, 60, 50, 6500.0); 
00456         cpl_image_set(image, 85, 1, 6100.0); 
00457         cpl_image_set(image, 86, 32, 6040.0); 
00458         cpl_image_set(image, 90, 19, 6020.0); 
00459 
00460             cpl_image_save(image, frame_name, CPL_BPP_IEEE_FLOAT, plist, CPL_IO_DEFAULT);
00461 
00462 
00463             cpl_image_delete(image);
00464         }
00465         cpl_propertylist_delete(plist);
00466 
00467 
00468         frame = cpl_frame_new();
00469         sprintf(frame_name, "dummyoff%d.fits",i);
00470         cpl_frame_set_filename(frame, frame_name);
00471         cpl_frame_set_tag(frame, tag_off);
00472         cpl_frame_set_type(frame, CPL_FRAME_TYPE_IMAGE);
00473         cpl_frame_set_group(frame, CPL_FRAME_GROUP_RAW);
00474 
00475         cpl_frameset_insert(frameset, frame);
00476 
00477         plist = cpl_propertylist_new();
00478         if(opt_nir == TRUE) {
00479             cpl_propertylist_append_double(plist, "ESO DET DIT", (double)(i/2+1));
00480             cpl_propertylist_append_double(plist, "EXPTIME", (double)(i/2+1));
00481             cpl_propertylist_append_double(plist, "MJD-OBS", 100);
00482 
00483         cpl_propertylist_append_int(plist, "NAXIS1", IMAGESIZE);
00484         cpl_propertylist_append_int(plist, "NAXIS2", IMAGESIZE);
00485         cpl_propertylist_append_int(plist, "ESO DET OUT1 NX", IMAGESIZE + 10 );
00486         cpl_propertylist_append_int(plist, "ESO DET OUT1 NY", IMAGESIZE);
00487         cpl_propertylist_append_int(plist, "ESO DET OUT1 PRSCX", 5);
00488         cpl_propertylist_append_int(plist, "ESO DET OUT1 OVSCX", 5);
00489         } else {
00490             cpl_propertylist_append_double(plist, "ESO DET DIT", (double)((i+1)/2));
00491             cpl_propertylist_append_double(plist, "EXPTIME", (double)((i+1)/2));
00492             cpl_propertylist_append_double(plist, "MJD-OBS", 100);
00493 
00494         cpl_propertylist_append_int(plist, "NAXIS1", IMAGESIZE);
00495         cpl_propertylist_append_int(plist, "NAXIS2", IMAGESIZE);
00496         cpl_propertylist_append_int(plist, "ESO DET OUT1 NX", IMAGESIZE + 10 );
00497         cpl_propertylist_append_int(plist, "ESO DET OUT1 NY", IMAGESIZE);
00498         cpl_propertylist_append_int(plist, "ESO DET OUT1 PRSCX", 5);
00499         cpl_propertylist_append_int(plist, "ESO DET OUT1 OVSCX", 5);
00500         }
00501 
00502         if(with_exts == TRUE) {
00503           int j;
00504           cpl_image_save(NULL, frame_name, CPL_BPP_IEEE_FLOAT, plist, CPL_IO_DEFAULT);
00505           for(j = 0; j < nexts; j++) {
00506             image = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
00507             cpl_image_fill_noise_uniform(image, 25, 50);
00508             cpl_ensure(cpl_error_get_code()== CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, NULL);
00509         cpl_image_add_scalar(image, 300);
00510         cpl_image_set(image, 10, 10, 0.0); 
00511         cpl_image_set(image, 11, 11, 0.0); 
00512         cpl_image_set(image, 20, 20, 0.0); 
00513         cpl_image_set(image, 10, 40, 0.0); 
00514         cpl_image_set(image, 40, 10, 0.0); 
00515         cpl_image_set(image, 12, 32, 0.0); 
00516         cpl_image_set(image, 50, 50, 0.0); 
00517         cpl_image_set(image, 15, 1, 0.0); 
00518         cpl_image_set(image, 76, 32, 0.0); 
00519         cpl_image_set(image, 10, 19, 0.0); 
00520 
00521         cpl_image_set(image, 30, 10, 6000.0); 
00522         cpl_image_set(image, 31, 11, 6020.0); 
00523         cpl_image_set(image, 30, 20, 6030.0); 
00524         cpl_image_set(image, 30, 40, 6040.0); 
00525         cpl_image_set(image, 30, 10, 6070.0); 
00526         cpl_image_set(image, 52, 32, 6300.0); 
00527         cpl_image_set(image, 60, 50, 6500.0); 
00528         cpl_image_set(image, 85, 1, 6100.0); 
00529         cpl_image_set(image, 86, 32, 6040.0); 
00530         cpl_image_set(image, 90, 19, 6020.0); 
00531 
00532             cpl_image_save(image, frame_name, CPL_BPP_IEEE_FLOAT, plist, CPL_IO_EXTEND);
00533             cpl_image_delete(image);
00534           }
00535         } else {
00536             image = cpl_image_new(IMAGESIZE, IMAGESIZE, CPL_TYPE_FLOAT);
00537             cpl_image_fill_noise_uniform(image, 25, 50);
00538             cpl_ensure(cpl_error_get_code()== CPL_ERROR_NONE, CPL_ERROR_NULL_INPUT, NULL);
00539         cpl_image_add_scalar(image, 300);
00540         cpl_image_set(image, 10, 10, 0.0); 
00541         cpl_image_set(image, 11, 11, 0.0); 
00542         cpl_image_set(image, 20, 20, 0.0); 
00543         cpl_image_set(image, 10, 40, 0.0); 
00544         cpl_image_set(image, 40, 10, 0.0); 
00545         cpl_image_set(image, 12, 32, 0.0); 
00546         cpl_image_set(image, 50, 50, 0.0); 
00547         cpl_image_set(image, 15, 1, 0.0); 
00548         cpl_image_set(image, 76, 32, 0.0); 
00549         cpl_image_set(image, 10, 19, 0.0); 
00550 
00551         cpl_image_set(image, 30, 10, 6000.0); 
00552         cpl_image_set(image, 31, 11, 6020.0); 
00553         cpl_image_set(image, 30, 20, 6030.0); 
00554         cpl_image_set(image, 30, 40, 6040.0); 
00555         cpl_image_set(image, 30, 10, 6070.0); 
00556         cpl_image_set(image, 52, 32, 6300.0); 
00557         cpl_image_set(image, 60, 50, 6500.0); 
00558         cpl_image_set(image, 85, 1, 6100.0); 
00559         cpl_image_set(image, 86, 32, 6040.0); 
00560         cpl_image_set(image, 90, 19, 6020.0); 
00561 
00562             cpl_image_save(image, frame_name, CPL_BPP_IEEE_FLOAT, plist, CPL_IO_DEFAULT);
00563 
00564 
00565             cpl_image_delete(image);
00566         }
00567         cpl_propertylist_delete(plist);
00568     }
00569 
00570     return frameset;
00571 }

Generated on Fri Jul 3 11:15:22 2009 for VISIR Pipeline Reference Manual by  doxygen 1.5.8