IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 7, 2007, 4:18:37 PM (19 years ago)
Author:
Paul Price
Message:

Wasn't putting filenames onto the arguments as arrays, which is required for the pmFPAfileDefine functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSub/src/ppSubArguments.c

    r13593 r13713  
    152152}
    153153
     154// Add a single filename to the arguments as an array, so that it can be used with pmFPAfileBindFromArgs, etc
     155static void fileList(const char *file, // The symbolic name for the file
     156                     const char *name, // The name of the file
     157                     const char *comment, // Description of the file
     158                     pmConfig *config // Configuration
     159    )
     160{
     161    psArray *files = psArrayAlloc(1); // Array with file names
     162    files->data[0] = psStringCopy(name);
     163    psMetadataAddArray(config->arguments, PS_LIST_TAIL, file, 0, comment, files);
     164    psFree(files);
     165    return;
     166}
     167
     168//////////////////////////////////////////////////////////////////////////////////////////////////////////////
    154169
    155170bool ppSubArguments(int argc, char *argv[], pmConfig *config)
     
    187202    }
    188203
    189     psArray *files = psArrayAlloc(1);   // Array with file names
    190     files->data[0] = psStringCopy(argv[1]);
    191     psMetadataAddArray(config->arguments, PS_LIST_TAIL, "INPUT", 0, "Name of the input image", files);
    192     psFree(files);
    193     files = psArrayAlloc(1);
    194     files->data[0] = psStringCopy(argv[2]);
    195     psMetadataAddArray(config->arguments, PS_LIST_TAIL, "REF", 0, "Name of the reference image", files);
    196     psFree(files);
     204    fileList("INPUT", argv[1], "Name of the input image",     config);
     205    fileList("REF",   argv[2], "Name of the reference image", config);
    197206    psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "Name of the output image", argv[3]);
    198207
    199     valueArgStr(config, arguments, "-inmask",    "INPUT.MASK",    config->arguments);
    200     valueArgStr(config, arguments, "-inweight",  "INPUT.WEIGHT",  config->arguments);
    201     valueArgStr(config, arguments, "-refmask",   "REF.MASK",      config->arguments);
    202     valueArgStr(config, arguments, "-refweight", "REF.WEIGHT",    config->arguments);
     208    const char *inMask = psMetadataLookupStr(NULL, arguments, "-inmask"); // Name of input mask
     209    if (inMask && strlen(inMask) > 0) {
     210        fileList("INPUT.MASK", inMask, "Name of the input mask image", config);
     211    }
     212    const char *inWeight = psMetadataLookupStr(NULL, arguments, "-inweight"); // Name of input weight
     213    if (inWeight && strlen(inWeight) > 0) {
     214        fileList("INPUT.WEIGHT", inWeight, "Name of the input weight image", config);
     215    }
     216
     217    const char *refMask = psMetadataLookupStr(NULL, arguments, "-refmask"); // Name of reference mask
     218    if (refMask && strlen(refMask) > 0) {
     219        fileList("REF.MASK", refMask, "Name of the reference mask image", config);
     220    }
     221    const char *refWeight = psMetadataLookupStr(NULL, arguments, "-refweight"); // Name of reference weight
     222    if (refWeight && strlen(refWeight) > 0) {
     223        fileList("REF.WEIGHT", refWeight, "Name of the reference weight image", config);
     224    }
     225
    203226    valueArgStr(config, arguments, "-stat",      "STATS",         config->arguments);
    204227
Note: See TracChangeset for help on using the changeset viewer.