IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30957


Ignore:
Timestamp:
Mar 18, 2011, 5:48:39 AM (15 years ago)
Author:
Paul Price
Message:

Cleaning up implementation of MWV sampling fix: the 'while' loop with initialisation and increment was really a 'for' loop; was missing first entry because of pre-increment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20101205/psLib/src/imageops/psImageBackground.c

    r30956 r30957  
    9595    } else {
    9696        // 2011/03/16 - MWV: Hmmm... this overwites the previously defined Npixels that only counted finite-valued pixels.
    97         Npixels = nx * ny; 
     97        Npixels = nx * ny;
    9898
    9999        // Subsample all pixels
     
    108108        //   2) Go through this ordering up to Nsubset to select pixels
    109109        psVector *frndPixelOrder = psVectorAlloc(Npixels, PS_TYPE_F32);
    110         for (long i = 0; i < Npixels; i++) { 
    111             frndPixelOrder->data.F32[i] = psRandomUniform(rng); 
     110        for (long i = 0; i < Npixels; i++) {
     111            frndPixelOrder->data.F32[i] = psRandomUniform(rng);
    112112        }
    113113        // Now sort the array so that we end up with a list of the pixels in random order
     
    115115        // Now loop in our new sorted order
    116116        //  Paul Price suggests fixing this up so that it gets all Nsubset pixels, skipping over the masked ones.
    117         //  This would be implemented with a while loop.  I'm leaving this comment-out till I test the simpler version that just makes this one conceptual change.
    118         //  Ah, we can just use n
    119         int i=0;
    120         while ((n < Nsubset) && (i < Npixels)) {
    121             i++;
    122 //        for (long i = 0; i < Nsubset; i++) {
     117        for (long i = 0; n < Nsubset && i < Npixels; i++) {
    123118            int pixel = frndSortedPixelOrder->data.S32[i];
    124119            int ix = pixel % nx;
Note: See TracChangeset for help on using the changeset viewer.