IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 31, 2011, 4:28:27 PM (15 years ago)
Author:
bills
Message:

Implement the accessor functions. Remove the GetCell accessor versions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/fits/psFitsTableNew.h

    r32228 r32263  
    4444} psFitsTable;
    4545
    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)
     47int psFitsTableGetColumnNumber(psFitsTable *table, const char *name);
    5248
    5349psFitsTable *psFitsReadTableNew(const psFits *fits);
    5450bool 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
    5553bool psFitsTableCensor(psFitsTable *table, bool *rowMask);
    5654
    57 psF32 psFitsTableGetCellF32(psFitsTable *table, int row, int col);
     55// Get value for given row and column name
     56psBool psFitsTableGetBool(bool *status, psFitsTable *table, int row, const char* name);
     57psS8 psFitsTableGetS8(bool *status, psFitsTable *table, int row, const char* name);
     58psU8 psFitsTableGetU8(bool *status, psFitsTable *table, int row, const char* name);
     59psS16 psFitsTableGetS16(bool *status, psFitsTable *table, int row, const char* name);
     60psU16 psFitsTableGetU16(bool *status, psFitsTable *table, int row, const char* name);
     61psS32 psFitsTableGetS32(bool *status, psFitsTable *table, int row, const char* name);
     62psU32 psFitsTableGetU32(bool *status, psFitsTable *table, int row, const char* name);
     63psS64 psFitsTableGetS64(bool *status, psFitsTable *table, int row, const char* name);
     64psU64 psFitsTableGetU64(bool *status, psFitsTable *table, int row, const char* name);
    5865
    59 psF32 psFitsTableGetF32(bool *status, psFitsTable *table, psString name, int row);
     66psF32 psFitsTableGetF32(bool *status, psFitsTable *table, int row, const char* name);
     67psF64 psFitsTableGetF64(bool *status, psFitsTable *table, int row, const char* name);
    6068
    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.