IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15787


Ignore:
Timestamp:
Dec 11, 2007, 4:09:06 PM (18 years ago)
Author:
Paul Price
Message:

Cleaning up some stamp processing.

File:
1 edited

Legend:

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

    r15756 r15787  
    5353    psFree(stamp->matrix2);
    5454    psFree(stamp->matrixX);
    55     psFree(stamp->vector);
     55    psFree(stamp->vector1);
     56    psFree(stamp->vector2);
    5657
    5758}
     
    173174    stamp->matrix2 = NULL;
    174175    stamp->matrixX = NULL;
    175     stamp->vector = NULL;
     176    stamp->vector1 = NULL;
     177    stamp->vector2 = NULL;
    176178
    177179    return stamp;
     
    348350        if (!checkStampRegion(xPix, yPix, region)) {
    349351            // It's not in the big region
     352            psTrace("psModules.imcombine", 9, "Rejecting input stamp (%d,%d) because outside region",
     353                    xPix, yPix);
    350354            continue;
    351355        }
    352356        if (!checkStampMask(xPix, yPix, subMask, mode)) {
    353357            // Not a good stamp
     358            psTrace("psModules.imcombine", 9, "Rejecting input stamp (%d,%d) because bad mask",
     359                    xPix, yPix);
    354360            continue;
    355361        }
    356362
    357         for (int j = 0; j < numStamps; j++) {
     363        bool found = false;
     364        for (int j = 0; j < numStamps && !found; j++) {
    358365            psRegion *subRegion = stamps->regions->data[j]; // Subregion of interest
    359366            if (checkStampRegion(xPix, yPix, subRegion)) {
     
    362369
    363370                int index = xList->n;   // Index of new stamp candidate
     371
     372                psVectorExtend(xList, STAMP_LIST_BUFFER, 1);
     373                psVectorExtend(yList, STAMP_LIST_BUFFER, 1);
     374                psVectorExtend(fluxList, STAMP_LIST_BUFFER, 1);
     375
    364376                xList->data.F32[index] = xStamp;
    365377                yList->data.F32[index] = yStamp;
     
    371383                }
    372384
    373                 psVectorExtend(xList, STAMP_LIST_BUFFER, 1);
    374                 psVectorExtend(yList, STAMP_LIST_BUFFER, 1);
    375                 psVectorExtend(fluxList, STAMP_LIST_BUFFER, 1);
    376 
    377                 break;
     385                found = true;
     386                psTrace("psModules.imcombine", 9, "Putting input stamp (%d,%d) into subregion %d",
     387                        xPix, yPix, j);
    378388            }
     389        }
     390
     391        if (!found) {
     392            psTrace("psModules.imcombine", 9, "Unable to find subregion for stamp (%d,%d)",
     393                    xPix, yPix);
    379394        }
    380395    }
     
    563578
    564579
    565 pmSubtractionStampList *pmSubtractionStampsSetFromFile(const char *filename, const psImage *subMask,
    566                                                        const psRegion *region, int footprint, float spacing,
    567                                                        pmSubtractionMode mode)
     580pmSubtractionStampList *pmSubtractionStampsSetFromFile(const char *filename, const psImage *image,
     581                                                       const psImage *subMask, const psRegion *region,
     582                                                       int footprint, float spacing, pmSubtractionMode mode)
    568583{
    569584    PS_ASSERT_STRING_NON_EMPTY(filename, NULL);
     
    583598    psBinaryOp(y, y, "-", psScalarAlloc(1.0, PS_TYPE_F32));
    584599
    585     pmSubtractionStampList *stamps = pmSubtractionStampsSet(x, y, flux, NULL, subMask, region, footprint,
     600    pmSubtractionStampList *stamps = pmSubtractionStampsSet(x, y, flux, image, subMask, region, footprint,
    586601                                                            spacing, mode);
    587602    psFree(data);
Note: See TracChangeset for help on using the changeset viewer.