IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 25, 2009, 3:27:16 PM (17 years ago)
Author:
bills
Message:

move loop to excise pixels to a function in anticipation of removing calls
to psImageSet and psImageGet

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/magic/remove/src/streaksremove.c

    r25084 r25198  
    1818static void updateAstrometry(streakFiles *sfiles);
    1919static void censorSources(streakFiles *sfiles, psU32 maskStreak);
     20static long censorPixels(streakFiles *sfiles, psImage * pixels, bool checkNonWarpedPixels, psU16 maskStreak);
    2021
    2122int
     
    146147                }
    147148
    148 
    149149                psTimerStart("REMOVE_STREAKS");
    150150
    151                 for (int y=0 ; y < sfiles->inImage->numRows; y++) {
    152                     for (int x = 0; x < sfiles->inImage->numCols; x++) {
    153                         if (psImageGet(pixels, x, y)) {
    154                             ++totalStreakPixels;
    155                             if (!checkNonWarpedPixels || warpedPixel(sfiles, x, y)) {
    156 
    157                                 excisePixel(sfiles, x, y, true, maskStreak);
    158 
    159                             } else {
    160                                 // This pixel was not included in any warp and has thus already excised
    161                                 // by exciseNonWarpedPixels
    162                             }
    163                         }
    164                     }
    165                 }
     151                totalStreakPixels += censorPixels(sfiles, pixels, checkNonWarpedPixels, maskStreak);
    166152
    167153                psLogMsg("streaksremove", PS_LOG_INFO, "time to remove streak pixels: %f\n", psTimerClear("REMOVE_STREAKS"));
     
    254240
    255241    return 0;
     242}
     243
     244static long
     245censorPixels(streakFiles *sfiles, psImage *pixels, bool checkNonWarpedPixels, psU16 maskStreak)
     246{
     247    long streakPixels = 0;
     248
     249    for (int y=0 ; y < sfiles->inImage->numRows; y++) {
     250        for (int x = 0; x < sfiles->inImage->numCols; x++) {
     251            if (psImageGet(pixels, x, y)) {
     252                ++streakPixels;
     253                if (!checkNonWarpedPixels || warpedPixel(sfiles, x, y)) {
     254
     255                    excisePixel(sfiles, x, y, true, maskStreak);
     256
     257                } else {
     258                    // This pixel was not included in any warp and has thus already excised
     259                    // by exciseNonWarpedPixels
     260                }
     261            }
     262        }
     263    }
     264    return streakPixels;
    256265}
    257266
Note: See TracChangeset for help on using the changeset viewer.