IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30332


Ignore:
Timestamp:
Jan 21, 2011, 10:56:25 AM (15 years ago)
Author:
eugene
Message:

we need to handle possible small change to the normWindow that force the stamps to change size

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20101205/psModules/src/imcombine/pmSubtractionMatch.c

    r30322 r30332  
    675675                // generate the window function from the set of stamps
    676676                if (!pmSubtractionStampsGetWindow(&tryAgain, stamps, size)) {
    677                     // if we failed, it might be due to the desired normWindow being larger than the current size.
    678                     // in this case, just adjust the size and try again.
     677                    // if we failed, it might be due to the desired normWindow being larger than the current footprint.
     678                    // in this case, just adjust the footprint and try again.
    679679                    if (tryAgain) {
    680                         // keep the same footprint-size buffer:
    681                         int boundary = footprint - size;
    682                         size = PS_MAX(stamps->normWindow1, stamps->normWindow2) + 2;
    683                         footprint = size + boundary;
     680                        footprint = PS_MAX(stamps->normWindow1, stamps->normWindow2) + 2;
    684681
    685682                        // we need to reconstruct everything, so just free the stamps here and retry
     
    731728                psLogMsg("psModules.imcombine", PS_LOG_INFO, "Iteration %d.", k);
    732729
    733                 if (!pmSubtractionStampsSelect(&stamps, ro1, ro2, subMask, variance, region,
    734                                                stampThresh1, stampThresh2, stampSpacing, normFrac,
    735                                                sysError, skyError, size, footprint, subMode)) {
    736                     goto MATCH_ERROR;
    737                 }
    738 
    739                 // Generate the window function from the set of stamps.  Since we succeeded
    740                 // above to define a normWindow, if we fail here, it is probably unrecoverable.
    741                 if (!pmSubtractionStampsGetWindow(NULL, stamps, size)) {
    742                     psError(psErrorCodeLast(), false, "Unable to get stamps window.");
    743                     goto MATCH_ERROR;
     730                bool tryAgain = true;
     731                while (tryAgain) {
     732                    // We get the stamps here; we will also attempt to get stamps at the first iteration, but it
     733                    // doesn't matter.
     734                    if (!pmSubtractionStampsSelect(&stamps, ro1, ro2, subMask, variance, region, stampThresh1, stampThresh2,
     735                                                   stampSpacing, normFrac, sysError, skyError, size, footprint, subMode)) {
     736                        goto MATCH_ERROR;
     737                    }
     738
     739                    // generate the window function from the set of stamps
     740                    if (!pmSubtractionStampsGetWindow(&tryAgain, stamps, size)) {
     741                        // if we failed, it might be due to the desired normWindow being larger than the current footprint.
     742                        // in this case, just adjust the footprint and try again.
     743                        if (tryAgain) {
     744                            footprint = PS_MAX(stamps->normWindow1, stamps->normWindow2) + 2;
     745
     746                            // we need to reconstruct everything, so just free the stamps here and retry
     747                            psFree(stamps);
     748                        } else {
     749                            // unrecoverable error
     750                            psError(psErrorCodeLast(), false, "Unable to get stamp window.");
     751                            goto MATCH_ERROR;
     752                        }
     753                    }
    744754                }
    745755
Note: See TracChangeset for help on using the changeset viewer.