IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 20, 2004, 6:15:28 PM (22 years ago)
Author:
Paul Price
Message:

Running faster now by only transforming rejection masks where we're interested. To do: only transform and combine in the second iteration for areas where we're interested

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/stac/src/stacCombine.c

    r2670 r2764  
    106106        }
    107107        for (int i = 0; i < nImages; i++) {
    108             (*rejected)->data[i] = psImageAlloc(numCols, numRows, PS_TYPE_F32); // Create rejection mask
     108            (*rejected)->data[i] = psImageAlloc(numCols, numRows, PS_TYPE_U8); // Create rejection mask
    109109            // Zero out the mask
    110110            for (int r = 0; r < numRows; r++) {
    111111                for (int c = 0; c < numCols; c++) {
    112                     ((psImage*)((*rejected)->data[i]))->data.F32[r][c] = 0.0;
     112                    ((psImage*)((*rejected)->data[i]))->data.U8[r][c] = 0;
    113113                }
    114114            }
     
    154154           
    155155            // Rejection iterations
    156             for (int rejNum = 0; rejNum < nReject; rejNum++) {
    157                 float max = 0.0;
    158                 int maxIndex = -1;
     156            bool keepGoing = true;      // Keep going with rejection?
     157            for (int rejNum = 0; (rejNum < nReject) && keepGoing; rejNum++) {
     158                float max = 0.0;        // Maximum deviation
     159                int maxIndex = -1;      // Index of the maximum deviation
    159160                for (int i = 0; i < nImages; i++) {
    160161                    if (!mask->data.U8[i] && ((pixels->data.F32[i] - average) / deltas->data.F32[i] > max)) {
     
    164165                }
    165166                // Reject the pixel with the maximum deviation
    166                 if (max > reject) {   
     167                if (max > reject) {
    167168                    mask->data.U8[maxIndex] = 1;
    168                     ((psImage*)((*rejected)->data[maxIndex]))->data.F32[y][x] += 1.0;
     169                    ((psImage*)((*rejected)->data[maxIndex]))->data.U8[y][x] += 1.0;
    169170                    // Re-do combination following rejection
    170171                    average = stacCombineMean(pixels, deltas, mask);
    171                 }
    172             } // Rejection iterations
    173            
    174             combined->data.F32[y][x] = stacCombineMean(pixels, deltas, mask);
     172                } else {
     173                    keepGoing = false;
     174                }
     175            }
     176           
     177            combined->data.F32[y][x] = average;
    175178        }
    176179    } // Iterating over output pixels
Note: See TracChangeset for help on using the changeset viewer.