Changeset 25001
- Timestamp:
- Aug 5, 2009, 2:58:25 PM (17 years ago)
- Location:
- trunk/magic/remove/src
- Files:
-
- 4 edited
-
Line.c (modified) (2 diffs)
-
streaksextern.c (modified) (1 diff)
-
streaksextern.h (modified) (2 diffs)
-
streaksremove.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/magic/remove/src/Line.c
r24382 r25001 444 444 if (y >= 0 && y < numRows) 445 445 { 446 pixel = psAlloc (sizeof(PixelPos)); 447 pixel->x = (unsigned int) x; 448 pixel->y = (unsigned int) y; 449 psArrayAdd (pixels, 1024, pixel); 450 psFree (pixel); 446 psImageSet(pixels, x, y, 1); 451 447 } 452 448 } … … 494 490 if (x >=0 && x < numCols) 495 491 { 496 pixel = psAlloc (sizeof(PixelPos)); 497 pixel->x = (unsigned int) x; 498 pixel->y = (unsigned int) y; 499 psArrayAdd (pixels, 1024, pixel); 500 psFree (pixel); 492 psImageSet(pixels, x, y, 1); 501 493 } 502 494 } -
trunk/magic/remove/src/streaksextern.c
r24382 r25001 34 34 int i; 35 35 Line line; 36 StreakPixels *pixels = psArrayAllocEmpty (1024); 36 StreakPixels *pixels = psImageAlloc(numCols, numRows, PS_TYPE_U8); 37 psImageInit(pixels, 0); 37 38 int streaksOnComponent = 0; 38 39 -
trunk/magic/remove/src/streaksextern.h
r20308 r25001 4 4 /** psLib includes */ 5 5 6 #include "ps Array.h"6 #include "psImage.h" 7 7 8 8 /** streakremove includes */ … … 36 36 /** For now, use psArray to define a list of PixelPos pointers */ 37 37 38 typedef ps ArrayStreakPixels;38 typedef psImage StreakPixels; 39 39 40 40 /** Create a list of pixel positions from a Streaks pointer list -
trunk/magic/remove/src/streaksremove.c
r24998 r25001 13 13 static bool readAndCopyToOutput(streakFiles *sf, bool exciseAll); 14 14 static void exciseNonWarpedPixels(streakFiles *sfiles, double newMaskValue); 15 static bool warpedPixel(streakFiles *sfiles, PixelPos *cellCoord);15 static bool warpedPixel(streakFiles *sfiles, int x, int y); 16 16 static void excisePixel(streakFiles *sfiles, unsigned int x, unsigned int y, bool streak, double newMaskValue); 17 17 static void writeImages(streakFiles *sf, bool exciseImageCube); … … 146 146 } 147 147 148 totalStreakPixels += psArrayLength(pixels);149 148 150 149 psTimerStart("REMOVE_STREAKS"); 151 150 152 // for each pixel covered by the streak153 for (int i = 0; i < psArrayLength (pixels); ++i) {154 PixelPos *pixelPos = psArrayGet (pixels, i);155 156 // if this pixel was not part of the warp, skip because it has already been157 // excised (unless we weren't asked to check) 158 if (!checkNonWarpedPixels || warpedPixel(sfiles, pixelPos)) {159 160 excisePixel(sfiles, pixelPos->x, pixelPos->y, true, maskStreak);161 162 } else {163 // This pixel was not included in any warp and has thus already excised164 // by exciseNonWarpedPixels151 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 } 165 164 } 166 165 } … … 178 177 exciseImageCube = true; 179 178 } 180 psArrayElementsFree (pixels);181 179 psFree(pixels); 182 180 } … … 756 754 757 755 static bool 758 warpedPixel(streakFiles *sfiles, PixelPos *cellCoord)756 warpedPixel(streakFiles *sfiles, int x, int y) 759 757 { 760 758 PixelPos chipCoord; … … 767 765 // we clip so that the streak calculation code doesn't have to 768 766 // clipping here insures that we don't touch the overscan regions 769 if (( cellCoord->x < 0) || (cellCoord->x >= sfiles->inImage->numCols) ||770 ( cellCoord->y < 0) || (cellCoord->y >= sfiles->inImage->numRows)) {767 if ((x < 0) || (x >= sfiles->inImage->numCols) || 768 (y < 0) || (y >= sfiles->inImage->numRows)) { 771 769 return false; 772 770 } 773 771 774 cellToChipInt(&chipCoord.x, &chipCoord.y, sfiles->astrom, cellCoord->x, cellCoord->y);772 cellToChipInt(&chipCoord.x, &chipCoord.y, sfiles->astrom, x, y); 775 773 776 774 if (chipCoord.x < 0 || chipCoord.x >= sfiles->warpedPixels->numCols) { … … 838 836 } 839 837 } 840 841 838 842 839 // get rid of unused elements (don't know if this is necessary)
Note:
See TracChangeset
for help on using the changeset viewer.
