IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 2, 2006, 1:30:35 PM (20 years ago)
Author:
eugene
Message:

updated to use new image/subimage/region coordinate consistency

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotParseCamera.c

    r6117 r6311  
    11# include "psphot.h"
     2
     3# define METADATA_ADD_DEFAULT(CONFIG, TYPE, NAME, VALUE, COMMENT)\
     4    { psMetadataItem *ITEM; \
     5      ITEM = psMetadataLookup (CONFIG, NAME); \
     6      if (ITEM == NULL) { \
     7        psMetadataAdd##TYPE (CONFIG, PS_LIST_TAIL, NAME, 0, COMMENT, VALUE); \
     8      } else { psFree (ITEM); } }
    29
    310ppFile *psphotParseCamera (ppConfig *config) {
    411
    5     bool status;
    6 
    712    ppFile *input = ppFileAlloc ();
    813
    9     input->filename = psMemIncrRefCounter(psMetadataLookupStr(NULL, config->arguments, "-input"));
     14    input->filename = psMemIncrRefCounter(psMetadataLookupStr(NULL, config->arguments, "INPUT_FILE"));
    1015
    1116    // Open the input image
     
    3338    }
    3439
    35     // Determine the correct recipe to use
    36     // if the user specifies a recipe, no default values are supplied
     40    // Determine the correct recipe to use (from camera or from user)
     41    // if config->recipe is not NULL, it is a user-supplied recipe
    3742    if (!config->recipe) {
    38 
    3943        config->recipe = pmConfigRecipeFromCamera(config->camera, PSPHOT_RECIPE);
    4044        if (config->recipe == NULL) {
     
    4347        }
    4448    }
    45    
    46     // recipe override values:
    47     psMetadata *recipe = psMetadataLookupPtr (&status, config->arguments, "RECIPE.OPTIONS");
     49
     50    // recipe override values (command-line options):
    4851    psMetadataItem *item = NULL;
    49     psMetadataIterator *iter = psMetadataIteratorAlloc (recipe, PS_LIST_HEAD, NULL);
     52    psMetadataIterator *iter = psMetadataIteratorAlloc (config->options, PS_LIST_HEAD, NULL);
    5053    while ((item = psMetadataGetAndIncrement (iter)) != NULL) {
    5154        psMetadataAddItem (config->recipe, item, PS_LIST_TAIL, PS_META_REPLACE);
     
    5457    psFree (iter);
    5558
    56     psMetadataAddStr (config->recipe, PS_LIST_TAIL, "FITMODE", 0, "", "NONE");
    57     psMetadataAddStr (config->recipe, PS_LIST_TAIL, "PHOTCODE", 0, "", "NONE");
    58     psMetadataAddStr (config->recipe, PS_LIST_TAIL, "BREAK_POINT", 0, "", "NONE");
     59    // set default recipe values here
     60    METADATA_ADD_DEFAULT (config->recipe, Str, "FITMODE", "NONE", "");
     61    METADATA_ADD_DEFAULT (config->recipe, Str, "PHOTCODE", "NONE", "");
     62    METADATA_ADD_DEFAULT (config->recipe, Str, "BREAK_POINT", "NONE", "");
     63    METADATA_ADD_DEFAULT (config->recipe, Str, "OUTPUT_FORMAT", "CMP", "");
     64    METADATA_ADD_DEFAULT (config->recipe, Str, "OUTPUT_MODE", "SPLIT", "");
    5965
    60     // XXX EAM : extend this to allow an array of selected chips by name
    6166    // Chip selection: if we are using a single chip, select it for each FPA
    62     int chipNum = psMetadataLookupS32(NULL, config->arguments, "-chip"); // Chip number to work on
    63     if (chipNum >= 0) {
    64         if (! pmFPASelectChip(input->fpa, chipNum)) {
    65             psErrorStackPrint(stderr, "Chip number %d doesn't exist in camera.\n", chipNum);
    66             exit(EXIT_FAILURE);
     67    // Chip numbers to work on: -chip 1,2,3,5,8,10
     68    char *chips = psMetadataLookupStr(NULL, config->arguments, "CHIP_SELECTIONS");
     69    if (chips != NULL) {
     70        char *p = chips;
     71        while (strlen(p)) {
     72            char *q = strchr (p, ',');
     73            if (q == NULL) {
     74                q = p + strlen(p);
     75            } else {
     76                *q = 0;
     77                q = q + 1;
     78            }
     79            int chipNum = atoi(p);
     80            // XXX EAM : extend this to allow an array of selected chips (by name)
     81            if (! pmFPASelectChip(input->fpa, chipNum)) {
     82                psErrorStackPrint(stderr, "Chip number %d doesn't exist in camera.\n", chipNum);
     83                exit(EXIT_FAILURE);
     84            }
     85            psLogMsg("psphot", PS_LOG_INFO, "Operating only on chip %d\n", chipNum);
     86            p = q;
    6787        }
    68         psLogMsg("psphot", PS_LOG_INFO, "Operating only on chip %d\n", chipNum);
    6988    }
    7089
     
    7291    input->fpa = pmFPAConstruct(config->camera);
    7392
     93    psTrace(__func__, 1, "Done with psphotParseCamera...\n");
    7494    return input;
    7595}
Note: See TracChangeset for help on using the changeset viewer.