IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28566


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

Add option to output mask and variance.

File:
1 edited

Legend:

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

    r27370 r28566  
    2929    )
    3030{
     31    if (!name) {
     32        return;
     33    }
    3134    psArray *files = psArrayAlloc(1); // Array with file names
    3235    files->data[0] = psStringCopy(name);
     
    5356        psMetadataAddStr(arguments, PS_LIST_TAIL, "-image", 0, "Input image", NULL);
    5457        psMetadataAddStr(arguments, PS_LIST_TAIL, "-mask", 0, "Input mask", NULL);
     58        psMetadataAddStr(arguments, PS_LIST_TAIL, "-variance", 0, "Input variance", NULL);
    5559        psMetadataAddStr(arguments, PS_LIST_TAIL, "-kernel", 0, "Convolution kernel", NULL);
    5660        psMetadataAddBool(arguments, PS_LIST_TAIL, "-reference", 0, "Input is actually reference?", false);
    5761        psMetadataAddS32(arguments, PS_LIST_TAIL, "-threads", 0, "Threads to use", 0);
     62        psMetadataAddBool(arguments, PS_LIST_TAIL, "-save-all", 0, "Save all outputs?", false);
    5863
    5964        if (argc == 1 || !psArgumentParse(arguments, &argc, argv) || argc != 2) {
     
    6368        const char *inImage = psMetadataLookupStr(NULL, arguments, "-image"); // Input image
    6469        const char *inMask = psMetadataLookupStr(NULL, arguments, "-mask"); // Input mask
     70        const char *inVariance = psMetadataLookupStr(NULL, arguments, "-variance"); // Input variance
    6571        const char *inKernel = psMetadataLookupStr(NULL, arguments, "-kernel"); // Input kernel
    6672        if (!inImage || !inKernel) {
     
    7278        fileList("PPSUB.INPUT", inImage, "Input image", config);
    7379        fileList("PPSUB.INPUT.MASK", inMask, "Input mask", config);
     80        fileList("PPSUB.INPUT.VARIANCE", inVariance, "Input variance", config);
    7481        fileList("PPSUB.INPUT.KERNEL", inKernel, "Input kernel", config);
    7582        psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "Name of the output image", argv[1]);
     
    8188            goto die;
    8289        }
    83         pmFPAfile *mask = pmFPAfileBindFromArgs(&status, image, config, "PPSUB.INPUT.MASK",
    84                                                 "PPSUB.INPUT.MASK");
    85         if (!mask || !status || mask->type != PM_FPA_FILE_MASK) {
    86             psError(PPSUB_ERR_CONFIG, false, "Unable to define input mask file.");
    87             goto die;
     90        if (inMask) {
     91            pmFPAfile *mask = pmFPAfileBindFromArgs(&status, image, config, "PPSUB.INPUT.MASK",
     92                                                    "PPSUB.INPUT.MASK");
     93            if (!mask || !status || mask->type != PM_FPA_FILE_MASK) {
     94                psError(PPSUB_ERR_CONFIG, false, "Unable to define input mask file.");
     95                goto die;
     96            }
     97        }
     98        if (inVariance) {
     99            pmFPAfile *variance = pmFPAfileBindFromArgs(&status, image, config, "PPSUB.INPUT.VARIANCE",
     100                                                        "PPSUB.INPUT.VARIANCE");
     101            if (!variance || !status || variance->type != PM_FPA_FILE_VARIANCE) {
     102                psError(PPSUB_ERR_CONFIG, false, "Unable to define input variance file.");
     103                goto die;
     104            }
    88105        }
    89106
     
    101118        }
    102119        output->save = true;
     120
     121        if (psMetadataLookupBool(NULL, arguments, "-save-all")) {
     122            pmFPAfile *outMask = pmFPAfileDefineOutput(config, output->fpa, "PPSUB.INPUT.CONV.MASK");
     123            if (!outMask || outMask->type != PM_FPA_FILE_MASK) {
     124                psError(PPSUB_ERR_CONFIG, false, "Unable to define output mask file.");
     125                goto die;
     126            }
     127            outMask->save = true;
     128
     129            pmFPAfile *outVar = pmFPAfileDefineOutput(config, output->fpa, "PPSUB.INPUT.CONV.VARIANCE");
     130            if (!outVar || outVar->type != PM_FPA_FILE_VARIANCE) {
     131                psError(PPSUB_ERR_CONFIG, false, "Unable to define output variance file.");
     132                goto die;
     133            }
     134            outVar->save = true;
     135        }
    103136    }
    104137
Note: See TracChangeset for help on using the changeset viewer.