Changeset 32264 for trunk/magic/remove/src/streaksremove.c
- Timestamp:
- Aug 31, 2011, 4:37:24 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/magic/remove/src/streaksremove.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/magic/remove/src/streaksremove.c
r32252 r32264 983 983 // XXX: Handle case where numCols == 0 Can that happen? 984 984 // Previously we were writing a blank extension 985 int xCol = psFitsTableGetColumnIndex(table, "X_PSF"); 985 986 // For speed we get intimate with the table 987 // avoid 2 * numRows lookups of the column number by looking 988 // it up ahead of time and verifying that the type is what we 989 // expect. 990 int xCol = psFitsTableGetColumnNumber(table, "X_PSF"); 986 991 assert(xCol >= 0 && xCol < table->numCols); 987 988 int yCol = psFitsTableGetColumnIndex(table, "Y_PSF"); 992 assert(table->columns[xCol].type == PS_DATA_F32); 993 994 int yCol = psFitsTableGetColumnNumber(table, "Y_PSF"); 989 995 assert(yCol >= 0 && yCol < table->numCols); 990 996 assert(table->columns[yCol].type == PS_DATA_F32); 997 998 // We mark censored rows in this array. 991 999 bool *rowCensored = psAlloc(table->numRows * sizeof(bool)); 1000 memset(rowCensored, 0, table->numRows * sizeof(bool)); 992 1001 int numCensored = 0; 993 1002 994 1003 for (int i = 0 ; i < table->numRows; i++) { 995 psF32 x = psFitsTableGetCellF32(table, i, xCol); 996 psF32 y = psFitsTableGetCellF32(table, i, yCol); 997 1004 1005 #ifndef GO_SLOWER 1006 psF32 x = table->columns[xCol].data.F32[i]; 1007 psF32 y = table->columns[yCol].data.F32[i]; 1008 #else 1009 psF32 x = psFitsTableGetF32(NULL, table, i, "X_PSF"); 1010 psF32 y = psFitsTableGetF32(NULL, table, i, "Y_PSF"); 1011 #endif 998 1012 psImageMaskType mask; 999 1013 if ((x >= maskImage->numCols) || (y >= maskImage->numRows) || (x < 0) || (y < 0) || isnan(x) || isnan(y)) { … … 1004 1018 1005 1019 // Key the source if the center pixel is not masked with maskStreak 1006 if (!(mask & maskStreak) ) { 1007 // psArraySet(outTable, j++, row); 1008 rowCensored[i] = false; 1009 } else { 1020 if (mask & maskStreak) { 1010 1021 rowCensored[i] = true; 1011 1022 numCensored++; … … 1013 1024 } 1014 1025 1026 // remove the censored rows from the table 1015 1027 if (!psFitsTableCensor(table, rowCensored)) { 1016 1028 streaksExit("", PS_EXIT_PROG_ERROR);
Note:
See TracChangeset
for help on using the changeset viewer.
