Changeset 32263 for trunk/psLib/src/fits/psFitsTableNew.h
- Timestamp:
- Aug 31, 2011, 4:28:27 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/fits/psFitsTableNew.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/fits/psFitsTableNew.h
r32228 r32263 44 44 } psFitsTable; 45 45 46 // return index of column by name 47 int psFitsTableGetColumnIndex(psFitsTable *table, psString name); 48 49 // return type for column 50 // Most code knows it's tables so this won't be used much 51 int psFitsTableGetColumnType(psFitsTable *table, int col); 46 // return column number of column with name (-1 if not found) 47 int psFitsTableGetColumnNumber(psFitsTable *table, const char *name); 52 48 53 49 psFitsTable *psFitsReadTableNew(const psFits *fits); 54 50 bool psFitsWriteTableNew(psFits *fits, const psMetadata *header, psFitsTable *table, const char *extname); 51 52 // remove rows from table whose entry in the supplied array are true 55 53 bool psFitsTableCensor(psFitsTable *table, bool *rowMask); 56 54 57 psF32 psFitsTableGetCellF32(psFitsTable *table, int row, int col); 55 // Get value for given row and column name 56 psBool psFitsTableGetBool(bool *status, psFitsTable *table, int row, const char* name); 57 psS8 psFitsTableGetS8(bool *status, psFitsTable *table, int row, const char* name); 58 psU8 psFitsTableGetU8(bool *status, psFitsTable *table, int row, const char* name); 59 psS16 psFitsTableGetS16(bool *status, psFitsTable *table, int row, const char* name); 60 psU16 psFitsTableGetU16(bool *status, psFitsTable *table, int row, const char* name); 61 psS32 psFitsTableGetS32(bool *status, psFitsTable *table, int row, const char* name); 62 psU32 psFitsTableGetU32(bool *status, psFitsTable *table, int row, const char* name); 63 psS64 psFitsTableGetS64(bool *status, psFitsTable *table, int row, const char* name); 64 psU64 psFitsTableGetU64(bool *status, psFitsTable *table, int row, const char* name); 58 65 59 psF32 psFitsTableGetF32(bool *status, psFitsTable *table, psString name, int row); 66 psF32 psFitsTableGetF32(bool *status, psFitsTable *table, int row, const char* name); 67 psF64 psFitsTableGetF64(bool *status, psFitsTable *table, int row, const char* name); 60 68 61 62 #ifdef notdef 63 // Accessors 64 psF32 psFitsTableGetCellF32(psFitsTable *table, int row, int col) 65 { 66 assert(row >= 0 && row < table->numRows); 67 assert(col >= 0 && col < table->numCols); 68 assert(table->columns[col].type == PS_TYPE_F32); 69 70 return table->columns[col].data.F32[row]; 71 } 72 73 --------------------------- 74 // code in streaksremove censore sources beocomes 75 76 psFitsTable *table = psFitsReadTableNew(in->fits); 77 int x_col = psFitsGetColumnIndex(table, "X_PSF"); 78 int y_col = psFitsGetColumnIndex(table, "X_PSF"); 79 80 // Array of booleans. If true don't write the row. 81 bool rowMask = psAlloc(table->numRows * sizeof(bool)); 82 bzero(rowMask, table->numRows * sizeof(bool)); 83 84 for (int i=0; i < table->numRows; i++) { 85 psF32 x = psFitsTableGetCellF32(table, row, x_col); 86 psF32 y = psFitsTableGetCellF32(table, row, y_col); 87 88 if ((x >= maskImage->numCols) || (y >= maskImage->numRows) 89 || (x < 0) || (y < 0) || isnan(x) || isnan(y)) { 90 mask = maskStreak; 91 } else { 92 mask = maskImage->data.PS_TYPE_IMAGE_MASK_DATA[(int)y][(int)x]; 93 } 94 95 // Key the source if the center pixel is not masked with maskStreak 96 if (mask & maskStreak) { 97 numCensored++; 98 rowMask[i] = true; 99 } 100 } 101 102 if (numCensored < table->numRows) { 103 psFitsWriteTableNew(out->fits, header, table, extname, rowMask); 104 } else { 105 psFitsWriteTableNewEmpty(out->fits, header, table, extname); 106 } 107 #endif // notdef 108 109 #endif // #ifndef PS_FITSTABLENEW_H 69 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
