Changeset 6311 for trunk/psphot/src/psphotParseCamera.c
- Timestamp:
- Feb 2, 2006, 1:30:35 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotParseCamera.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotParseCamera.c
r6117 r6311 1 1 # 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); } } 2 9 3 10 ppFile *psphotParseCamera (ppConfig *config) { 4 11 5 bool status;6 7 12 ppFile *input = ppFileAlloc (); 8 13 9 input->filename = psMemIncrRefCounter(psMetadataLookupStr(NULL, config->arguments, " -input"));14 input->filename = psMemIncrRefCounter(psMetadataLookupStr(NULL, config->arguments, "INPUT_FILE")); 10 15 11 16 // Open the input image … … 33 38 } 34 39 35 // Determine the correct recipe to use 36 // if the user specifies a recipe, no default values are supplied40 // Determine the correct recipe to use (from camera or from user) 41 // if config->recipe is not NULL, it is a user-supplied recipe 37 42 if (!config->recipe) { 38 39 43 config->recipe = pmConfigRecipeFromCamera(config->camera, PSPHOT_RECIPE); 40 44 if (config->recipe == NULL) { … … 43 47 } 44 48 } 45 46 // recipe override values: 47 psMetadata *recipe = psMetadataLookupPtr (&status, config->arguments, "RECIPE.OPTIONS"); 49 50 // recipe override values (command-line options): 48 51 psMetadataItem *item = NULL; 49 psMetadataIterator *iter = psMetadataIteratorAlloc ( recipe, PS_LIST_HEAD, NULL);52 psMetadataIterator *iter = psMetadataIteratorAlloc (config->options, PS_LIST_HEAD, NULL); 50 53 while ((item = psMetadataGetAndIncrement (iter)) != NULL) { 51 54 psMetadataAddItem (config->recipe, item, PS_LIST_TAIL, PS_META_REPLACE); … … 54 57 psFree (iter); 55 58 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", ""); 59 65 60 // XXX EAM : extend this to allow an array of selected chips by name61 66 // 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; 67 87 } 68 psLogMsg("psphot", PS_LOG_INFO, "Operating only on chip %d\n", chipNum);69 88 } 70 89 … … 72 91 input->fpa = pmFPAConstruct(config->camera); 73 92 93 psTrace(__func__, 1, "Done with psphotParseCamera...\n"); 74 94 return input; 75 95 }
Note:
See TracChangeset
for help on using the changeset viewer.
