IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 7, 2013, 12:01:01 PM (13 years ago)
Author:
eugene
Message:

pswarp can now take an input.mdc file with multiple input images listed to generate a warp for a collection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130419/pswarp/src/pswarpArguments.c

    r35421 r35527  
    8383    pswarpSetThreads();
    8484
    85     pmConfigFileSetsMD (config->arguments, &argc, argv, "INPUT", "-file", "-list");
    86     pmConfigFileSetsMD (config->arguments, &argc, argv, "MASK", "-mask", "-masklist");
    87     pmConfigFileSetsMD (config->arguments, &argc, argv, "VARIANCE", "-variance", "-variancelist");
    88     pmConfigFileSetsMD (config->arguments, &argc, argv, "BACKGROUND", "-background", "-bkglist");
     85    // there are three mutually exclusive ways of providing the input
     86    // 1) supply -file (filename) [-mask .. -variance ..] on the command line
     87    // 2) supply -input (input.mdc) on the command line
     88    // 3) load inputs from RUN config info
     89
     90    // below, we check first for -file then for -input.  failure to find either implies use of
     91    // the configuration metadata file.
     92
     93    bool singleInput = pmConfigFileSetsMD (config->arguments, &argc, argv, "INPUT", "-file", "-list");
     94    if (singleInput) {
     95        if (psArgumentGet(argc, argv, "-input")) {
     96            psErrorStackPrint(stderr, "error in arguments : -input and -file / -list are mutually exclusive");
     97            exit(PS_EXIT_CONFIG_ERROR);
     98        }       
     99        pmConfigFileSetsMD (config->arguments, &argc, argv, "MASK", "-mask", "-masklist");
     100        pmConfigFileSetsMD (config->arguments, &argc, argv, "VARIANCE", "-variance", "-variancelist");
     101        pmConfigFileSetsMD (config->arguments, &argc, argv, "BACKGROUND", "-background", "-bkglist");
     102    } else {
     103        // find the input data file (an mdc file)
     104        if ((N = psArgumentGet(argc, argv, "-input"))) {
     105            if (argc <= N+1) {
     106                psErrorStackPrint(stderr, "Expected to see 1 more argument; saw %d", argc - 1);
     107                exit(PS_EXIT_CONFIG_ERROR);
     108            }
     109            psArgumentRemove(N, &argc, argv);
     110
     111            unsigned int numBad = 0;                     // Number of bad lines
     112            psMetadata *inputs = psMetadataConfigRead(NULL, &numBad, argv[N], false); // Input file info
     113            if (!inputs || numBad > 0) {
     114                psErrorStackPrint(stderr, "Unable to cleanly read MDC file with inputs.");
     115                exit(PS_EXIT_CONFIG_ERROR);
     116            }
     117            psMetadataAddMetadata(config->arguments, PS_LIST_TAIL, "INPUTS", 0, "Metadata with input details", inputs);
     118            psFree(inputs);
     119
     120            psArgumentRemove(N, &argc, argv);
     121        }
     122    }
     123    if (argc != 3) {
     124        usage();
     125    }
     126    if (psErrorCodeLast() != PS_ERR_NONE) {
     127        psErrorStackPrint(stderr, "error in arguments");
     128        exit(PS_EXIT_CONFIG_ERROR);
     129    }
    89130   
    90     if (argc != 3) {
    91         usage();
    92     }
    93 
    94 
    95131    psArray *array;
    96132
Note: See TracChangeset for help on using the changeset viewer.