IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 13, 2007, 12:16:43 PM (18 years ago)
Author:
Paul Price
Message:

Support for dual convolution. Dual convolution doesn't work yet, but if it ever does, ppSub can support it!

File:
1 edited

Legend:

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

    r15448 r15817  
    6060    float optThresh = psMetadataLookupF32(&mdok, config->arguments, "OPTIMUM.TOL"); // Tolerance for search
    6161    int optOrder = psMetadataLookupS32(&mdok, config->arguments, "OPTIMUM.ORDER"); // Order for search
     62    bool dual = psMetadataLookupBool(&mdok, config->arguments, "DUAL"); // Dual convolution?
     63
     64    pmSubtractionMode mode = dual ? PM_SUBTRACTION_MODE_DUAL : PM_SUBTRACTION_MODE_UNSURE; // Subtraction mode
     65    pmReadout *conv2 = NULL;            // Convolved image, for dual convolution
     66    if (dual) {
     67        conv2 = pmReadoutAlloc(NULL);
     68    }
    6269
    6370    // Generate masks if they don't exist
     
    9097    }
    9198
    92     if (!pmSubtractionMatch(outRO, inRO, refRO, footprint, regionSize, spacing, threshold, sources,
     99    if (!pmSubtractionMatch(outRO, conv2, inRO, refRO, footprint, regionSize, spacing, threshold, sources,
    93100                            stampsName, type, size, order, widths, orders, inner, ringsOrder,
    94101                            binning, optimum, optWidths, optOrder, optThresh, iter, rej, maskBad,
    95                             maskBlank, badFrac, PM_SUBTRACTION_MODE_UNSURE)) {
     102                            maskBlank, badFrac, mode)) {
    96103        psError(PS_ERR_UNKNOWN, false, "Unable to match images.");
     104        psFree(conv2);
    97105        psFree(outRO);
    98106        return false;
     
    106114                     "Subtraction kernel", kernels->description);
    107115
    108 
    109116    psImage *kernelImage = psMetadataLookupPtr(NULL, outRO->analysis,
    110117                                               "SUBTRACTION.KERNEL.IMAGE"); // Image of the kernels
     
    114121
    115122    // Do the subtraction
    116     if (reverse) {
    117         psBinaryOp(outRO->image, outRO->image, "-", inRO->image);
    118     } else {
    119         psBinaryOp(outRO->image, inRO->image, "-", outRO->image);
    120     }
    121     psBinaryOp(outRO->mask, outRO->mask, "|", inRO->mask);
    122     if (outRO->weight) {
    123         psBinaryOp(outRO->weight, outRO->weight, "+", inRO->weight);
     123    {
     124        // Subtraction is: minuend - subtrahend
     125        psImage *minuendImage = outRO->image;
     126        psImage *subtrahendImage = (dual ? conv2->image : inRO->image);
     127        psImage *minuendWeight = outRO->image;
     128        psImage *subtrahendWeight = (dual ? conv2->weight : inRO->weight);
     129        psImage *mask2 = (dual ? conv2->mask : inRO->mask);
     130
     131        if (reverse) {
     132            psImage *temp = subtrahendImage;
     133            subtrahendImage = minuendImage;
     134            minuendImage = temp;
     135
     136            temp = subtrahendWeight;
     137            subtrahendWeight = minuendWeight;
     138            minuendWeight = temp;
     139        }
     140
     141        psBinaryOp(outRO->image, minuendImage, "-", subtrahendImage);
     142        psBinaryOp(outRO->mask, outRO->mask, "|", mask2);
     143        if (minuendWeight && subtrahendWeight) {
     144            psBinaryOp(outRO->weight, minuendWeight, "+", subtrahendWeight);
     145        }
    124146    }
    125147
Note: See TracChangeset for help on using the changeset viewer.