IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 21, 2006, 12:51:48 PM (20 years ago)
Author:
eugene
Message:

various fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImageParseCamera.c

    r7592 r7621  
    66    bool status = false;
    77
    8     // the input image defines the camera
     8    // the input image defines the camera, and all recipes and options the follow
    99    pmFPAfile *input = pmFPAfileDefineFromArgs (&status, config, "PPIMAGE.INPUT", "INPUT");
    1010    if (!status) {
     
    1414
    1515    // add recipe options supplied on command line
    16     psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes,   "PHASE2");
     16    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, "PHASE2");
    1717    psMetadata *arglist = psMetadataLookupPtr (&status, config->arguments, "PPIMAGE.OPTIONS");
    1818    psMetadataCopy (recipe, arglist);
     
    2020    // parse the options from the metadata format to the ppImageOptions structure
    2121    ppImageOptions *options = ppImageOptionsParse (config);
    22 
    23     // the following files are output targets
    24     pmFPAfileDefineOutput (config, input->fpa, "PPIMAGE.OUTPUT");
    25     pmFPAfileDefineNewCamera (config, "PPIMAGE.OUTPUT.CHIP");
    2622
    2723    // the following are defined from the argument list, if given,
     
    5652        if (!status) psAbort ("ppImageParseDetrend", "can't find a flat image source");
    5753    }
    58     if (options->doBin1) {
    59         pmFPAfile *file = pmFPAfileDefineFromFPA (config, input->fpa, options->xBin1, options->yBin1, "PPIMAGE.BIN1");
    60         if (options->doBin1JPG) {
    61             pmFPAfileDefineOutput (config, file->fpa, "PPIMAGE.JPEG1");
     54
     55    // the following files are output targets
     56    pmFPAfile *output = pmFPAfileDefineOutput (config, input->fpa, "PPIMAGE.OUTPUT");
     57    pmFPAfile *byChip = pmFPAfileDefineNewCamera (config, "PPIMAGE.OUTPUT.CHIP");
     58    pmFPAfile *byFPA1 = pmFPAfileDefineNewCamera (config, "PPIMAGE.OUTPUT.FPA1");
     59    pmFPAfile *byFPA2 = pmFPAfileDefineNewCamera (config, "PPIMAGE.OUTPUT.FPA2");
     60
     61    // save any of these files?
     62    output->save = options->BaseFITS;
     63    byChip->save = options->ChipFITS;
     64    byFPA1->save = options->FPA1FITS;
     65    byFPA2->save = options->FPA2FITS;
     66
     67    // output is used as a carrier: input to byChip
     68    output->freeLevel = PM_FPA_LEVEL_CHIP;
     69
     70    // define the binned target files (which may just be carriers for some camera configurations)
     71    pmFPAfile *bin1 = pmFPAfileDefineFromFPA (config, byChip->fpa, options->xBin1, options->yBin1, "PPIMAGE.BIN1");
     72    pmFPAfile *bin2 = pmFPAfileDefineFromFPA (config, byChip->fpa, options->xBin2, options->yBin2, "PPIMAGE.BIN2");
     73
     74    // set the CELL.XBIN and CELL.YBIN for the output mosaiced FPAs
     75    for (int i = 0; i < byFPA1->fpa->chips->n; i++) {
     76        pmChip *chip = byFPA1->fpa->chips->data[i];
     77        for (int j = 0; j < chip->cells->n; j++) {
     78            pmCell *cell = chip->cells->data[j];
     79            psMetadataAddF32 (cell->concepts, PS_LIST_TAIL, "CELL.XBIN", PS_META_REPLACE, "", options->xBin1);
     80            psMetadataAddF32 (cell->concepts, PS_LIST_TAIL, "CELL.YBIN", PS_META_REPLACE, "", options->yBin1);
    6281        }
    6382    }
    64     if (options->doBin2) {
    65         pmFPAfile *file = pmFPAfileDefineFromFPA (config, input->fpa, options->xBin2, options->yBin2, "PPIMAGE.BIN2");
    66         if (options->doBin2JPG) {
    67             pmFPAfileDefineOutput (config, file->fpa, "PPIMAGE.JPEG2");
     83    for (int i = 0; i < byFPA2->fpa->chips->n; i++) {
     84        pmChip *chip = byFPA2->fpa->chips->data[i];
     85        for (int j = 0; j < chip->cells->n; j++) {
     86            pmCell *cell = chip->cells->data[j];
     87            psMetadataAddF32 (cell->concepts, PS_LIST_TAIL, "CELL.XBIN", PS_META_REPLACE, "", options->xBin2);
     88            psMetadataAddF32 (cell->concepts, PS_LIST_TAIL, "CELL.YBIN", PS_META_REPLACE, "", options->yBin2);
    6889        }
    6990    }
    7091
    71     // ppImage is supplied with an output name, which may be used by multiple
    72     // output files to construct the output names.  supply this value to the
    73     // files which are write types.
    74     char *output = psMetadataLookupPtr(&status, config->arguments, "OUTPUT");
    75     pmFPAfileAddFileNames (config->files, "OUTPUT", output, PM_FPA_MODE_WRITE);
     92    // bin1 and bin2 are used as carriers: input for byFPA1, byFPA2
     93    bin1->freeLevel = PM_FPA_LEVEL_FPA;
     94    bin2->freeLevel = PM_FPA_LEVEL_FPA;
     95
     96    pmFPAfile *jpg1 = pmFPAfileDefineOutput (config, byFPA1->fpa, "PPIMAGE.JPEG1");
     97    pmFPAfile *jpg2 = pmFPAfileDefineOutput (config, byFPA2->fpa, "PPIMAGE.JPEG2");
     98
     99    // XXX we could potentially not define these pmFPAfiles if no output is requested...
     100    bin1->save = options->Bin1FITS;
     101    bin2->save = options->Bin2FITS;
     102    jpg1->save = options->Bin1JPEG;
     103    jpg2->save = options->Bin2JPEG;
    76104
    77105    // Chip selection: turn on only the chips specified (pass status to suppress missing-key log msg)
Note: See TracChangeset for help on using the changeset viewer.