new_stack_ini_by_cpl.c

00001 /*----------------------------------------------------------------------------
00002    
00003    File name    :   stack_ini_by_cpl.c
00004    Author       :   Andrea Modigliani
00005    Created on   :   May 23, 2004
00006    Description  :   prepare stacked frames cpl input handling for SPIFFI
00007 
00008  ---------------------------------------------------------------------------*/
00009 
00010 
00011 
00012 /*---------------------------------------------------------------------------
00013                                 Includes
00014  ---------------------------------------------------------------------------*/
00015 
00016 #include "new_stack_ini_by_cpl.h"
00017 
00018 
00019 /*---------------------------------------------------------------------------
00020                     Functions private to this module
00021  ---------------------------------------------------------------------------*/
00022 void stack_free_alloc(stack_config_n * cfg);  
00023 
00024 
00025 static void     parse_section_frames(stack_config_n *, 
00026                                      cpl_frameset* sof, cpl_frameset** raw,int* status,
00027                                      fake* fk);
00028 
00029 static void     parse_section_cleanmean(stack_config_n *, cpl_parameterlist* cpl_cfg);
00030 static void     parse_section_flatfield(stack_config_n *, cpl_parameterlist* cpl_cfg);
00031 static void     parse_section_badpixel(stack_config_n *, cpl_parameterlist* cpl_cfg);
00032 static void     parse_section_interleaving(stack_config_n *);
00033 static void     parse_section_gaussconvolution(stack_config_n *, cpl_parameterlist* cpl_cfg);
00034 static void     parse_section_shiftframes(stack_config_n *);
00035 static void     parse_section_warpfix(stack_config_n *,  cpl_parameterlist* cpl_cfg);
00036 static void     parse_section_qclog(stack_config_n *,  cpl_parameterlist* cpl_cfg);
00037 
00038 /* generateStack_ini_file */
00039 /*-------------------------------------------------------------------------*/
00050 /*--------------------------------------------------------------------------*/
00051 
00052 stack_config_n * parse_cpl_input_stack(cpl_parameterlist* cpl_cfg, 
00053                                        cpl_frameset* sof, 
00054                                        cpl_frameset** raw,
00055                                        fake* fk)
00056 {
00057  const cxchar * _id = "parse_cpl_input_stack";
00058     stack_config_n   *       cfg =stack_cfg_create_n();
00059     int status=0;
00060    
00061 
00062 
00063     /*
00064      * Perform sanity checks, fill up the structure with what was
00065      * found in the ini file
00066      */
00067 
00068     parse_section_cleanmean        (cfg, cpl_cfg);
00069     parse_section_flatfield        (cfg, cpl_cfg);
00070     parse_section_badpixel         (cfg, cpl_cfg); 
00071     parse_section_interleaving     (cfg); 
00072     parse_section_gaussconvolution (cfg, cpl_cfg); 
00073     parse_section_shiftframes      (cfg); 
00074     parse_section_warpfix          (cfg, cpl_cfg);
00075     parse_section_qclog            (cfg, cpl_cfg);
00076     parse_section_frames           (cfg, sof, raw, &status, fk);
00077           if (status > 0) {
00078                 cpl_msg_error(_id,"parsing cpl input");
00079                 stack_cfg_destroy_n(cfg);
00080                 cfg = NULL ;
00081                 return NULL ;
00082         }
00083     return cfg ;
00084 }
00085 
00086 static void     
00087 parse_section_frames(stack_config_n * cfg, 
00088                      cpl_frameset* sof, cpl_frameset** raw_set,int* status, 
00089                      fake* fk)
00090 {
00091  const cxchar * _id = "parse_section_frames";
00092 
00093    int                     i;
00094    const char            *       name;
00095    char                        file[FILE_NAME_SZ];
00096    int                     nobj, noff, ndark ;
00097    int                     nditherobj, nditheroff ;
00098    int                     found_sky ;
00099    int                     found_ref ;
00100    int                     found_dither ;
00101    int                     found_dark   ;
00102     int nraw=0;
00103     int nsof=0;
00104 
00105    cpl_frame* frame   = NULL;
00106 
00107     char spat_res[FILE_NAME_SZ];
00108    char lamp_status[FILE_NAME_SZ];
00109    char band[FILE_NAME_SZ];
00110    int ins_set=0;
00111    char* tag=NULL;
00112    char* do_class=NULL;
00113    nsof    = cpl_frameset_get_size(sof);
00114    cpl_msg_info(_id,"cfg->warpfixInd=%d",cfg->warpfixInd);
00115 
00116    
00117    do_class=fk->pro_class;
00118    /* printf("do_class=%s\n",do_class); */
00119    if(strcmp(do_class,"DEFAULT") == 0) {
00120       sinfoni_extract_raw_stack_frames(sof,raw_set);
00121    } else if (strcmp(do_class,PRO_FIBRE_NS_STACKED_DIST) == 0) {
00122       sinfoni_is_fibres_on_off(sof,*raw_set);
00123    } else if (strcmp(do_class,PRO_FIBRE_NS_STACKED) == 0) {
00124       sinfoni_contains_frames_kind(sof,*raw_set,(char*)PRO_STACKED);
00125    } else if (strcmp(do_class,RAW_STACKED_SLITPOS) == 0) {
00126       sinfoni_extract_raw_stack_frames(sof,raw_set);
00127    } else {
00128       sinfoni_extract_raw_frames_type(sof,raw_set,do_class);
00129    }
00130    nraw    = cpl_frameset_get_size(*raw_set);
00131    if (nraw < 1) {
00132       cpl_msg_error(_id,"Too few raw frames present in frameset!");
00133       (*status)++;
00134       return;
00135    }
00136 
00137  
00138    /* Allocate structures to go into the blackboard */
00139    cfg->framelist     = cpl_malloc(nraw * sizeof(char*));
00140    cfg->frametype     = cpl_malloc(nraw * sizeof(int));
00141    cfg->frameposition = cpl_malloc(nraw * sizeof(int));
00142 
00143    for (i=0;i<nraw;i++) {
00144      cfg->framelist[i]=NULL;
00145      cfg->frametype[i]=-1;
00146      cfg->frameposition[i]=-1;
00147    }
00148 
00149    found_sky     = 0 ;
00150    found_ref     = 0 ;
00151    found_dither  = 0 ;
00152    found_dark    = 0 ;
00153    nobj          = 0 ;
00154    noff          = 0 ;
00155    ndark         = 0 ;
00156    nditherobj    = 0 ;
00157    nditheroff    = 0 ;
00158 
00159 
00160 
00161    /* Browse through the charmatrix to get names and file types */
00162    /*   for (i=0 ; i<nraw ; i++) { */
00163    for (i=0 ; i<nraw ; i++) {
00164       frame = cpl_frameset_get_frame(*raw_set,i);
00165       name=cpl_frame_get_filename(frame);
00166        if(file_exists((char*)name)==1) {
00167     /* to go on the file must exist */
00168     if(cpl_frame_get_tag(frame) != NULL) {
00169       /* If the frame has a tag we process it. Else it is an object */ 
00170       tag= (char*) cpl_frame_get_tag(frame);
00171           /* printf("frame name= %s tag =%s \n",name,tag); */
00172           if((sinfoni_frame_is_on(frame)  == 0) || 
00173              (sinfoni_frame_is_sky(frame)  == 1)) 
00174       {
00175              cfg->framelist[i]=cpl_strdup(cpl_frame_get_filename(frame));
00176              cfg->frametype[i] = FRAME_OFF ;
00177              found_sky = 1;
00178              if (sinfoni_frame_is_dither(frame)) 
00179            {
00180                 cfg->frameposition[i] = FRAME_POS2 ;
00181                 nditheroff++ ;
00182                 /* printf("Frame is dither off\n"); */
00183            }
00184              else 
00185            {
00186                 cfg->frameposition[i] = FRAME_POS1 ;
00187                 noff++ ;
00188                 /* printf("Frame is not dither off\n"); */
00189            }
00190       }
00191           else if(strstr(tag,RAW_REF)  != NULL) 
00192       {
00193           cfg->framelist[i]=cpl_strdup(cpl_frame_get_filename(frame));
00194           cfg->frametype[i] = FRAME_REF ;
00195               found_ref=1;
00196           if (sinfoni_frame_is_dither(frame))
00197         {
00198           cfg->frameposition[i] = FRAME_POS2 ;
00199           /* printf("Frame is dither on\n"); */
00200         }
00201               else 
00202         {
00203           cfg->frameposition[i] = FRAME_POS1 ;
00204           /* printf("Frame is not dither on\n"); */
00205         }
00206       }
00207           else if(sinfoni_is_dark(tag)) 
00208         {
00209           cfg->framelist[i]=cpl_strdup(cpl_frame_get_filename(frame));
00210           cfg->frametype[i] = FRAME_DRK ;
00211           cfg->frameposition[i] = FRAME_POS1 ;
00212               found_dark=1;
00213               ndark++;
00214           cpl_msg_info(_id,"Frame is dark on\n");
00215         }
00216           else 
00217         {
00218 
00219           cfg->framelist[i]=cpl_strdup(cpl_frame_get_filename(frame));
00220           cfg->frametype[i] = FRAME_ON ;
00221               found_ref=1;
00222           if (sinfoni_frame_is_dither(frame))
00223         {
00224           cfg->frameposition[i] = FRAME_POS2 ;
00225                   found_dither=1;
00226                   nditherobj++;
00227           /* printf("Frame is dither on\n"); */
00228         }
00229               else 
00230         {
00231           cfg->frameposition[i] = FRAME_POS1 ;
00232                   nobj++;
00233           /* printf("Frame is not dither on\n"); */
00234         }
00235         }
00236     }
00237         else 
00238       {
00239             /* No type means an object */
00240         cfg->frametype[i] = FRAME_ON ;
00241             /* No type means position 1 */
00242         cfg->frameposition[i] = FRAME_POS1 ;
00243             
00244         nobj ++ ;
00245             /* printf("frame=%s no tag \n",cfg->framelist[i]); */
00246       }
00247       }
00248       
00249       /* Store file name into framelist */
00250       /* printf("frame=%s\n",cfg->framelist[i]); */
00251    }
00252    
00253    cpl_msg_info(_id,"Noff= %d Nobj= %d Nditheroff= %d Nditherobj= %d",
00254            noff,nobj,nditheroff,nditherobj);
00255    
00256 
00257 
00258    /* Copy relevant information into the blackboard */
00259    cfg->nframes         = nraw ;
00260    cfg->nobj            = nobj ;
00261    cfg->noff            = noff ;
00262    cfg->ndark           = ndark ;
00263    cfg->nditherobj      = nditherobj ;
00264    cfg->nditheroff      = nditheroff ;
00265    cfg->contains_sky    = found_sky ;
00266    cfg->contains_ref    = found_ref ;
00267    cfg->contains_dither = found_dither ;
00268    cfg->contains_dark   = found_dark ;
00269 
00270 
00271    frame = cpl_frameset_get_frame(*raw_set,0);
00272 
00273    sinfoni_get_spatial_res(frame,spat_res);
00274 
00275 
00276 
00277    if(sinfoni_frame_is_on(frame) == 1) {
00278      strcpy(lamp_status,"on");
00279    } else {
00280      strcpy(lamp_status,"off");
00281    }
00282    switch(sinfoni_frame_is_on(frame)) 
00283      {
00284    case 0: 
00285       strcpy(lamp_status,"on");
00286       break;
00287     case 1: 
00288       strcpy(lamp_status,"off");
00289       break;
00290     case -1:
00291       strcpy(lamp_status,"undefined");
00292       break;
00293     default: 
00294       strcpy(lamp_status,"undefined");
00295       break;
00296 
00297 
00298      }
00299    sinfoni_get_band(frame,band);
00300 
00301 
00302    cpl_msg_info(_id,"spatial resolution: %s lamp status: %s band: %s",
00303                      spat_res,              lamp_status,    band);
00304 
00305    sinfoni_get_ins_set(band,&ins_set);
00306    frame = cpl_frameset_get_frame(*raw_set,0);
00307    tag=(char*)cpl_frame_get_tag(frame);
00308 
00309 
00310    /*
00311    p = cpl_parameterlist_find(cpl_cfg, "sinfoni.general.overwrite_parameters");
00312    op = cpl_parameter_get_bool(p);
00313 
00314    if(op){
00315           if(strcmp(tag,RAW_WAVE_LAMP) == 0) {
00316       rec_stack_wcal_set(cfg,cpl_cfg,ins_set);
00317    } else if (strcmp(tag,RAW_WAVE_LAMP_DITHER) == 0) {
00318       rec_stack_wcal_set(cfg,cpl_cfg,ins_set);
00319    } else if (strcmp(tag,RAW_WAVE_NS) == 0) {
00320       rec_stack_wcal_set(cfg,cpl_cfg,ins_set);
00321    } else if (strcmp(tag,RAW_WAVE_NS_DITHER) == 0) {
00322       rec_stack_wcal_set(cfg,cpl_cfg,ins_set);
00323    } else if (strcmp(tag,RAW_FIBRE_NS) == 0) {
00324       rec_stack_find_distortion_set(cfg,cpl_cfg,ins_set);
00325    } else if (strcmp(tag,PRO_FIBRE_NS_STACKED_ON) == 0) {
00326       rec_stack_find_distortion_set(cfg,cpl_cfg,ins_set);
00327    } else if (strcmp(tag,PRO_FIBRE_NS_STACKED_OFF) == 0) {
00328       rec_stack_find_distortion_set(cfg,cpl_cfg,ins_set);
00329    } else if (strcmp(tag,PRO_FIBRE_NS_STACKED) == 0) {
00330       rec_stack_find_distortion_set(cfg,cpl_cfg,ins_set);
00331    } else if (strcmp(tag,RAW_FIBRE_EW) == 0) {
00332       rec_stack_find_distortion_set(cfg,cpl_cfg,ins_set);
00333    } else if (strcmp(tag,RAW_FLUX_LAMP) == 0) {
00334       rec_stack_lampspec_set(cfg,cpl_cfg,ins_set);
00335    } else if (strcmp(tag,RAW_FOCUS) == 0) {
00336       rec_stack_focus_set(cfg,cpl_cfg,ins_set);
00337    } else if (strcmp(tag,RAW_PSF_CALIBRATOR) == 0) {
00338       rec_stack_psf_set(cfg,cpl_cfg,ins_set);
00339    } else if (
00340                 (strcmp(tag,RAW_STD_STAR) == 0) ||
00341                 (strcmp(tag,RAW_OBJECT_SKYSPIDER) == 0) ||
00342                 (strcmp(tag,RAW_OBJECT_NODDING) == 0) ||
00343                 (strcmp(tag,RAW_STD) == 0) ||
00344                 (strcmp(tag,RAW_SKY_STD) == 0) ||
00345                 (strcmp(tag,RAW_SKY_OH) == 0) ||
00346                 (strcmp(tag,RAW_SKY_PSF_CALIBRATOR) == 0) ||
00347                 (strcmp(tag,RAW_STD_STAR) == 0) ||
00348                 (strcmp(tag,RAW_SKY_NODDING) == 0) ||
00349                 (strcmp(tag,RAW_SKY) == 0) 
00350 
00351           ) {
00352       rec_stack_sci_set(cfg,cpl_cfg,ins_set);
00353    } else if (
00354                 (strcmp(tag,RAW_STD_STAR_DITHER) == 0) ||
00355                 (strcmp(tag,RAW_OBJECT_SKYSPIDER_DITHER) == 0) ||
00356                 (strcmp(tag,RAW_OBJECT_NODDING_DITHER) == 0) ||
00357                 (strcmp(tag,RAW_STD_STAR_DITHER) == 0) || 
00358                 (strcmp(tag,RAW_SKY_NODDING_DITHER) == 0) 
00359           ) {
00360       rec_stack_sci_set(cfg,cpl_cfg,ins_set);
00361 
00362 
00363    } else {
00364       cpl_msg_error(_id,"Unknown frame tag %s",tag);
00365       (*status)++;
00366       return;
00367    }
00368   
00369 
00370    }
00371    */
00372 
00373    /* Update flatInd setting if we had changed the mflat switch */
00374     /* take care of NS test special case */
00375     if(fk->frm_switch==1) {
00376      /* 
00377         In this case we force certain values indipendently from the setting occurring
00378         during CPL parameters parsing 
00379       */
00380 
00381     cfg->maskInd = fk->mask_index;
00382     cfg->indind = fk->ind_index;
00383     cfg->flatInd = fk->flat_index;
00384         cfg -> loReject = fk->low_rej;
00385         cfg -> hiReject = fk->hig_rej;
00386         cfg -> warpfixInd =  fk->wfix_index;
00387     /*
00388         cpl_msg_info(_id,"Fake frame: reset parameter values: ");
00389         cpl_msg_info(_id,"maskInd:  %d", cfg->maskInd);
00390         cpl_msg_info(_id,"indind:   %d", cfg->indind);
00391         cpl_msg_info(_id,"flatInd:  %d", cfg->flatInd);
00392         cpl_msg_info(_id,"loReject: %f", cfg->loReject);
00393         cpl_msg_info(_id,"hiReject: %f", cfg->hiReject);
00394     */
00395    }
00396   
00397   
00398 
00399 
00400  
00401    if(cfg -> flatInd) { 
00402       if(NULL != cpl_frameset_find(sof,PRO_MASTER_FLAT_LAMP)) {
00403          frame = cpl_frameset_find(sof,PRO_MASTER_FLAT_LAMP);
00404          strcpy(file,cpl_frame_get_filename(frame));
00405          strcpy(cfg -> flatfield1, file);
00406       } else if(NULL != cpl_frameset_find(sof,PRO_MASTER_FLAT_LAMP1)) {
00407          frame = cpl_frameset_find(sof,PRO_MASTER_FLAT_LAMP1);
00408          strcpy(file,cpl_frame_get_filename(frame));
00409          strcpy(cfg -> flatfield1, file);
00410       } else {
00411          cpl_msg_error(_id,"Frame %s not found!", PRO_MASTER_FLAT_LAMP);
00412          cpl_msg_error(_id,"Frame %s not found!", PRO_MASTER_FLAT_LAMP1);
00413          stack_free_alloc(cfg);  
00414          (*status)++;
00415          return;
00416       }
00417 
00418       if(found_dither) {
00419          if(NULL != cpl_frameset_find(sof,PRO_MASTER_FLAT_LAMP2)) {
00420             frame = cpl_frameset_find(sof,PRO_MASTER_FLAT_LAMP2);
00421             strcpy(file,cpl_frame_get_filename(frame));
00422             strcpy(cfg -> flatfield2, file);
00423          } else {
00424             cpl_msg_info(_id,"Frame %s not found!", PRO_MASTER_FLAT_LAMP2);
00425          }
00426       }
00427    }
00428 
00429    /* bad pixel section */
00430    if(cfg->maskInd != 0) {
00431      if(strstr(do_class,"FIBRE_NS") != NULL) {
00432         if(NULL != cpl_frameset_find(sof,PRO_BP_MAP_DI)) {
00433            frame = cpl_frameset_find(sof,PRO_BP_MAP_DI);
00434            strcpy(file,cpl_frame_get_filename(frame));
00435            strcpy(cfg -> mask, file);
00436         } else {
00437            cpl_msg_error(_id,"Frame %s not found!", PRO_BP_MAP_DI);
00438            stack_free_alloc(cfg);  
00439            (*status)++;
00440            return;
00441         }
00442 
00443      } else {
00444 
00445         if(NULL != cpl_frameset_find(sof,PRO_MASTER_BP_MAP)) {
00446            frame = cpl_frameset_find(sof,PRO_MASTER_BP_MAP);
00447            strcpy(file,cpl_frame_get_filename(frame));
00448            strcpy(cfg -> mask, file);
00449         } else {
00450            cpl_msg_error(_id,"Frame %s not found!", PRO_MASTER_BP_MAP);
00451            stack_free_alloc(cfg);  
00452            (*status)++;
00453            return;
00454         }
00455 
00456      }
00457 
00458      if (strcmp(do_class,RAW_STACKED_SLITPOS) == 0) {
00459        cfg -> indind = 1;
00460      }
00461 
00462       if(cfg -> indind == 0) { 
00463           if(NULL != cpl_frameset_find(sof,PRO_SLIT_POS)) {
00464             frame = cpl_frameset_find(sof,PRO_SLIT_POS);
00465             strcpy(file,cpl_frame_get_filename(frame));
00466             strcpy(cfg -> slitposList, file);
00467             cpl_msg_info(_id,"Using %s to interpolated bad pixels",
00468                              PRO_SLIT_POS);
00469             cpl_error_reset();
00470           } else if(NULL != cpl_frameset_find(sof,PRO_SLIT_POS_GUESS)) {
00471             frame = cpl_frameset_find(sof,PRO_SLIT_POS_GUESS);
00472             strcpy(file,cpl_frame_get_filename(frame));
00473             strcpy(cfg -> slitposList, file);
00474             cpl_msg_info(_id,"Using %s to interpolated bad pixels",
00475                              PRO_SLIT_POS_GUESS);
00476             cpl_error_reset();
00477           } else {
00478             cpl_msg_error(_id,"Frame %s nor %s found!", 
00479                               PRO_SLIT_POS,PRO_SLIT_POS_GUESS);
00480             stack_free_alloc(cfg);  
00481             (*status)++;
00482             return;
00483           }
00484 
00485      
00486       }
00487       if(cfg -> maskInd == 2) {
00488          if(NULL != cpl_frameset_find(sof,PRO_INDEX_LIST)) {
00489             frame = cpl_frameset_find(sof,PRO_INDEX_LIST);
00490             strcpy(file,cpl_frame_get_filename(frame));
00491             strcpy(cfg ->indexlist, file);
00492          } else {
00493             cpl_msg_error(_id,"Frame %s not found!", PRO_INDEX_LIST);
00494             stack_free_alloc(cfg);  
00495             (*status)++;
00496             return;
00497          }
00498 
00499       }
00500    }
00501 
00502    cfg -> warpfixInd =  fk->wfix_index;
00503    if(cfg->warpfixInd != 0) {
00504         if(NULL != cpl_frameset_find(sof,PRO_DISTORTION)) {
00505             frame = cpl_frameset_find(sof,PRO_DISTORTION);
00506             strcpy(file,cpl_frame_get_filename(frame));
00507             strcpy(cfg -> polyFile, file);
00508          } else {
00509             cpl_msg_error(_id,"Frame %s not found!", PRO_DISTORTION);
00510             stack_free_alloc(cfg);  
00511             (*status)++;
00512             return;
00513          }
00514    }
00515 
00516 
00517    return ;
00518 }
00519 
00520 static void     
00521 parse_section_cleanmean(stack_config_n * cfg,cpl_parameterlist* cpl_cfg)
00522 {
00523 
00524    cpl_parameter* p;
00525    p = cpl_parameterlist_find(cpl_cfg,"sinfoni.stacked.low_rejection");
00526    cfg -> loReject = cpl_parameter_get_double(p);
00527 
00528    p = cpl_parameterlist_find(cpl_cfg,"sinfoni.stacked.high_rejection");
00529    cfg -> hiReject = cpl_parameter_get_double(p);
00530 
00531         return ;
00532 }
00533 
00534 static void     
00535 parse_section_flatfield(stack_config_n * cfg,cpl_parameterlist* cpl_cfg)
00536 {
00537 
00538    cpl_parameter* p;
00539    p = cpl_parameterlist_find(cpl_cfg,"sinfoni.stacked.flat_index");
00540    cfg -> flatInd = cpl_parameter_get_bool(p);
00541 
00542 }
00543 
00544 static void     
00545 parse_section_badpixel(stack_config_n * cfg,cpl_parameterlist* cpl_cfg)
00546 {
00547   cpl_parameter* p;
00548 
00549 
00550    p = cpl_parameterlist_find(cpl_cfg,"sinfoni.stacked.ind_index");
00551    cfg -> indind = cpl_parameter_get_bool(p);
00552 
00553    p = cpl_parameterlist_find(cpl_cfg,"sinfoni.stacked.mask_index");
00554    cfg -> maskInd = cpl_parameter_get_int(p);
00555 
00556    p = cpl_parameterlist_find(cpl_cfg,"sinfoni.stacked.mask_rad");
00557    cfg -> maxRad = cpl_parameter_get_int(p);
00558    /*
00559    p = cpl_parameterlist_find(cpl_cfg,"sinfoni.stacked.sigma_factor");
00560    */
00561    cfg -> sigmaFactor = 3.;
00562 
00563 }
00564 
00565 static void     
00566 parse_section_interleaving(stack_config_n * cfg)
00567 {
00568    cfg -> interInd = 0;
00569    cfg -> noRows = 400;
00570 
00571 }
00572 static void     
00573 parse_section_gaussconvolution(stack_config_n * cfg,cpl_parameterlist* cpl_cfg)
00574 {
00575 
00576    cpl_parameter* p;
00577    p = cpl_parameterlist_find(cpl_cfg,"sinfoni.stacked.gauss_index");
00578    cfg -> gaussInd = cpl_parameter_get_bool(p);
00579 
00580    p = cpl_parameterlist_find(cpl_cfg,"sinfoni.stacked.kernel_half_width");
00581    cfg -> hw = cpl_parameter_get_int(p);
00582 
00583 }
00584 static void     
00585 parse_section_shiftframes(stack_config_n * cfg)
00586 {
00587   /*
00588    cpl_parameter* p;
00589    p = cpl_parameterlist_find(cpl_cfg,"sinfoni.stacked.shift_frame_index");
00590    cfg -> sfInd  = cpl_parameter_get_bool(p);
00591 
00592    p = cpl_parameterlist_find(cpl_cfg,"sinfoni.stacked.shift_frame_type");
00593    cfg -> sfType = cpl_parameter_get_int(p);
00594 
00595    p = cpl_parameterlist_find(cpl_cfg,"sinfoni.stacked.shift_frame_order");
00596    cfg -> sfOrder = cpl_parameter_get_int(p);
00597   */
00598 
00599    cfg -> sfInd  = 0;
00600    cfg -> sfType = 1;
00601    cfg -> sfOrder = 2;
00602 
00603 }
00604 
00605 static void     
00606 parse_section_warpfix(stack_config_n * cfg,cpl_parameterlist * cpl_cfg)
00607 {
00608        
00609    cpl_parameter* p;
00610 
00611    p = cpl_parameterlist_find(cpl_cfg, "sinfoni.stacked.warpfix_ind");
00612    cfg -> warpfixInd =  cpl_parameter_get_bool(p);
00613 
00614 
00615    p = cpl_parameterlist_find(cpl_cfg, "sinfoni.stacked.warpfix_kernel");
00616    strcpy(cfg -> kernel, cpl_parameter_get_string(p));
00617 
00618    return ;
00619 }
00620 
00621 
00622 static void     
00623 parse_section_qclog(stack_config_n * cfg,cpl_parameterlist * cpl_cfg)
00624 {
00625        
00626    cpl_parameter* p;
00627 
00628    p = cpl_parameterlist_find(cpl_cfg, "sinfoni.stacked.qc_thresh_min");
00629    cfg -> qc_thresh_min =  cpl_parameter_get_int(p);
00630 
00631    p = cpl_parameterlist_find(cpl_cfg, "sinfoni.stacked.qc_thresh_max");
00632    cfg -> qc_thresh_max =  cpl_parameter_get_int(p);
00633 
00634    return ;
00635 }
00636 
00637 void
00638 stack_free(stack_config_n * cfg)
00639 {  
00640   stack_free_alloc(cfg);
00641   stack_cfg_destroy_n(cfg);
00642   return;
00643 
00644 }
00645 
00646 
00647 void
00648 stack_free_alloc(stack_config_n * cfg)
00649 {  
00650   int i=0;
00651   for (i=0; i< cfg->nframes; i++) {
00652     if(cfg->framelist[i]  != NULL) {
00653         cpl_free(cfg->framelist[i]);
00654              cfg->framelist[i]=NULL;
00655     }
00656   }
00657   if(cfg->frametype != NULL)     cpl_free(cfg->frametype); 
00658   if(cfg->framelist != NULL)     cpl_free(cfg->framelist);
00659   if(cfg->frameposition != NULL) cpl_free(cfg->frameposition);
00660 }

Generated on Wed Oct 26 13:08:53 2005 for SINFONI Pipeline Reference Manual by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001