IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 15, 2010, 4:26:53 PM (16 years ago)
Author:
Paul Price
Message:

Allow application of a constant instead of an image.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppArith/src/ppArithArguments.c

    r21378 r28346  
    5151                        )
    5252{
    53     psString value = psMetadataLookupStr(NULL, arguments, argName); // Value of interest 
     53    psString value = psMetadataLookupStr(NULL, arguments, argName); // Value of interest
    5454    if (value && strlen(value) > 0) {
    5555        return psMetadataAddStr(target, PS_LIST_TAIL, mdName, 0, NULL, value);
     
    8282    psMetadataAddStr(arguments, PS_LIST_TAIL, "-op", 0, "Operation to perform", NULL);
    8383    psMetadataAddStr(arguments, PS_LIST_TAIL, "-file2", 0, "Second image", NULL);
     84    psMetadataAddF32(arguments, PS_LIST_TAIL, "-const2", 0, "Constant", NAN);
    8485    psMetadataAddBool(arguments, PS_LIST_TAIL, "-mask", 0, "Treat images as masks", false);
    8586    psMetadataAddStr(arguments, PS_LIST_TAIL, "-stats", 0, "Statistics file", NULL);
     
    9899                     "File rule for output", outFilerule);
    99100
    100     bool status = false;                // Status for file definition 
     101    bool status = false;                // Status for file definition
    101102
    102103    // First file
     
    135136        }
    136137    }
     138    float const2 = psMetadataLookupF32(NULL, arguments, "-const2"); // Constant to apply
     139    if (!isnan(const2)) {
     140        if (name2) {
     141            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Cannot specify both -file2 and -const2");
     142            goto ERROR;
     143        }
     144        psMetadataAddF32(config->arguments, PS_LIST_TAIL, "PPARITH.CONST", 0, "Constant to apply", const2);
     145    }
    137146
    138147    // Output image
Note: See TracChangeset for help on using the changeset viewer.