IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 5, 2009, 4:31:25 PM (17 years ago)
Author:
Paul Price
Message:

Merging pap_branch_20090128. Resolved a small number of conflicts. Compiles, but not tested in detail.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/imcombine/pmSubtractionMatch.c

    r21247 r21363  
    6060                      const pmReadout *ro2, // Readout 2
    6161                      const psImage *subMask, // Mask for subtraction, or NULL
    62                       psImage *weight,  // Weight map
     62                      psImage *variance,  // Variance map
    6363                      const psRegion *region, // Region of interest, or NULL
    6464                      float threshold,  // Threshold for stamp finding
     
    8080
    8181    psTrace("psModules.imcombine", 3, "Extracting stamps...\n");
    82     if (!pmSubtractionStampsExtract(*stamps, ro1->image, ro2 ? ro2->image : NULL, weight, size)) {
     82    if (!pmSubtractionStampsExtract(*stamps, ro1->image, ro2 ? ro2->image : NULL, variance, size)) {
    8383        psError(PS_ERR_UNKNOWN, false, "Unable to extract stamps.");
    8484        return false;
     
    111111            conv1->mask = NULL;
    112112        }
    113         if (conv1->weight) {
    114             psFree(conv1->weight);
    115             conv1->weight = NULL;
     113        if (conv1->variance) {
     114            psFree(conv1->variance);
     115            conv1->variance = NULL;
    116116        }
    117117    }
     
    126126            conv2->mask = NULL;
    127127        }
    128         if (conv2->weight) {
    129             psFree(conv2->weight);
    130             conv2->weight = NULL;
     128        if (conv2->variance) {
     129            psFree(conv2->variance);
     130            conv2->variance = NULL;
    131131        }
    132132    }
     
    191191    }
    192192
    193     // Where does our weight map come from?
    194     // Getting the weight exactly right is not necessary --- it's just used for weighting.
    195     psImage *weight = NULL;             // Weight image to use
    196     if (ro1->weight && ro2->weight) {
    197         weight = (psImage*)psBinaryOp(NULL, ro1->weight, "+", ro2->weight);
    198     } else if (ro1->weight) {
    199         weight = psMemIncrRefCounter(ro1->weight);
    200     } else if (ro2->weight) {
    201         weight = psMemIncrRefCounter(ro2->weight);
     193    // Where does our variance map come from?
     194    // Getting the variance exactly right is not necessary --- it's just used for weighting.
     195    psImage *variance = NULL;             // Variance image to use
     196    if (ro1->variance && ro2->variance) {
     197        variance = (psImage*)psBinaryOp(NULL, ro1->variance, "+", ro2->variance);
     198    } else if (ro1->variance) {
     199        variance = psMemIncrRefCounter(ro1->variance);
     200    } else if (ro2->variance) {
     201        variance = psMemIncrRefCounter(ro2->variance);
    202202    } else {
    203         weight = (psImage*)psBinaryOp(NULL, ro1->image, "+", ro2->image);
     203        variance = (psImage*)psBinaryOp(NULL, ro1->image, "+", ro2->image);
    204204    }
    205205
     
    274274            // We get the stamps here; we will also attempt to get stamps at the first iteration, but it
    275275            // doesn't matter.
    276             if (!getStamps(&stamps, ro1, ro2, subMask, weight, NULL, threshold, stampSpacing,
     276            if (!getStamps(&stamps, ro1, ro2, subMask, variance, NULL, threshold, stampSpacing,
    277277                           size, footprint, subMode)) {
    278278                goto MATCH_ERROR;
     
    336336                psLogMsg("psModules.imcombine", PS_LOG_INFO, "Iteration %d.", k);
    337337
    338                 if (!getStamps(&stamps, ro1, ro2, subMask, weight, region, threshold, stampSpacing,
     338                if (!getStamps(&stamps, ro1, ro2, subMask, variance, region, threshold, stampSpacing,
    339339                               size, footprint, subMode)) {
    340340                    goto MATCH_ERROR;
     
    439439    psFree(subMask);
    440440    subMask = NULL;
    441     psFree(weight);
    442     weight = NULL;
    443 
    444     if (!pmSubtractionBorder(conv1->image, conv1->weight, conv1->mask, size, maskBad)) {
     441    psFree(variance);
     442    variance = NULL;
     443
     444    if (!pmSubtractionBorder(conv1->image, conv1->variance, conv1->mask, size, maskBad)) {
    445445        psError(PS_ERR_UNKNOWN, false, "Unable to set border of convolved image.");
    446446        goto MATCH_ERROR;
     
    482482    psFree(kernels);
    483483    psFree(stamps);
    484     psFree(weight);
     484    psFree(variance);
    485485    psFree(rng);
    486486    return false;
Note: See TracChangeset for help on using the changeset viewer.