Index: /trunk/psLib/src/fits/psFitsTableNew.c
===================================================================
--- /trunk/psLib/src/fits/psFitsTableNew.c	(revision 32262)
+++ /trunk/psLib/src/fits/psFitsTableNew.c	(revision 32263)
@@ -95,5 +95,6 @@
 
 void
-freeTable(psFitsTable *table) {
+freeTable(psFitsTable *table)
+{
     for (int col = 0; col < table->numCols; col++) {
         psFitsTableColumn *column = &table->columns[col];
@@ -287,6 +288,6 @@
 }
 
-// return the index for a given column
-int psFitsTableGetColumnIndex(psFitsTable *table, psString name)
+// return the column number with a given name
+int psFitsTableGetColumnNumber(psFitsTable *table, const char *name)
 {
     bool mdok;
@@ -294,5 +295,5 @@
 
     if (!mdok) {
-        psFitsError(mdok, false, "Failed to lookup column index for %s", name);
+        psFitsError(mdok, true, "Failed to lookup column index for %s", name);
         return -1;
     }
@@ -301,20 +302,92 @@
 }
 
-// return F32 value for given cell
-psF32 psFitsTableGetCellF32(psFitsTable *table, int row, int col) {
-    return table->columns[col].data.F32[row];
-}
-
-// return value for a named column for a given row
-psF32 psFitsTableGetF32(bool *status, psFitsTable *table, psString name, int row) {
-    bool mdok;
-    int col = psFitsTableGetColumnIndex(table, name);
-
-    if (mdok) {
-        return table->columns[col].data.F32[row];
-    } else {
-        return 0;
-    }
-}
+#define psFitsTableGetNumTYPE(TYPE, NAME) \
+ps##TYPE psFitsTableGet##NAME(bool *status, psFitsTable *table, int row, const char *name) \
+{ \
+    ps##TYPE value = 0; \
+    if (status) { \
+        *status = true; \
+    } \
+    \
+    if (row >= table->numRows || row < 0) { \
+        if (status) { \
+            *status = false; \
+        } \
+        return 0; \
+    } \
+    bool mdok; \
+    int col = psMetadataLookupS32(&mdok, table->index, name); \
+    if (!mdok) { \
+        if (status) { \
+            *status = false; \
+        } \
+        return 0; \
+    } \
+    if (col < 0) { \
+        if (status) { \
+            *status = false; \
+        } \
+        return 0; \
+    } \
+    psFitsTableColumn *column = &table->columns[col]; \
+    switch (column->type) { \
+        case PS_DATA_S8: \
+        value = (ps##TYPE)column->data.S8[row]; \
+        break; \
+    case PS_DATA_S16: \
+        value = (ps##TYPE)column->data.S16[row]; \
+        break; \
+    case PS_DATA_S32: \
+        value = (ps##TYPE)column->data.S32[row]; \
+        break; \
+    case PS_DATA_S64: \
+        value = (ps##TYPE)column->data.S64[row]; \
+        break; \
+    case PS_DATA_U8: \
+        value = (ps##TYPE)column->data.U8[row]; \
+        break; \
+    case PS_DATA_U16: \
+        value = (ps##TYPE)column->data.U16[row]; \
+        break; \
+    case PS_DATA_U32: \
+        value = (ps##TYPE)column->data.U32[row]; \
+        break; \
+    case PS_DATA_U64: \
+        value = (ps##TYPE)column->data.U64[row]; \
+        break; \
+    case PS_DATA_F32: \
+        value = (ps##TYPE)column->data.F32[row]; \
+        break; \
+    case PS_DATA_F64: \
+        value = (ps##TYPE)column->data.F64[row]; \
+        break; \
+    case PS_DATA_BOOL: \
+        if (column->data.BOOL[row]) { \
+            value = 1; \
+        } \
+        break; \
+    default: \
+        /* if you get to this point, the value is not a number. */ \
+        if (status) {  \
+            *status = false; \
+        }  \
+        break; \
+    } \
+    return value; \
+}
+
+// #define psFitsTableGetNumTYPE(TYPE, NAME)
+
+psFitsTableGetNumTYPE(S8, S8);
+psFitsTableGetNumTYPE(U8, U8);
+psFitsTableGetNumTYPE(S16, S16);
+psFitsTableGetNumTYPE(U16, U16);
+psFitsTableGetNumTYPE(S32, S32);
+psFitsTableGetNumTYPE(U32, U32);
+psFitsTableGetNumTYPE(S64, S64);
+psFitsTableGetNumTYPE(U64, U64);
+psFitsTableGetNumTYPE(F32, F32);
+psFitsTableGetNumTYPE(F64, F64);
+psFitsTableGetNumTYPE(Bool, BOOL);
 
 // remove rows from table that are marked in the mask array as censored.
Index: /trunk/psLib/src/fits/psFitsTableNew.h
===================================================================
--- /trunk/psLib/src/fits/psFitsTableNew.h	(revision 32262)
+++ /trunk/psLib/src/fits/psFitsTableNew.h	(revision 32263)
@@ -44,66 +44,26 @@
 } psFitsTable;
 
-// return index of column by name
-int psFitsTableGetColumnIndex(psFitsTable *table, psString name);
-
-// return type for column
-// Most code knows it's tables so this won't be used much
-int psFitsTableGetColumnType(psFitsTable *table, int col);
+// return column number of column with name (-1 if not found)
+int psFitsTableGetColumnNumber(psFitsTable *table, const char *name);
 
 psFitsTable *psFitsReadTableNew(const psFits *fits);
 bool psFitsWriteTableNew(psFits *fits, const psMetadata *header, psFitsTable *table, const char *extname);
+
+// remove rows from table whose entry in the supplied array are true
 bool psFitsTableCensor(psFitsTable *table, bool *rowMask);
 
-psF32 psFitsTableGetCellF32(psFitsTable *table, int row, int col);
+// Get value for given row and column name
+psBool psFitsTableGetBool(bool *status, psFitsTable *table, int row, const char* name);
+psS8 psFitsTableGetS8(bool *status, psFitsTable *table, int row, const char* name);
+psU8 psFitsTableGetU8(bool *status, psFitsTable *table, int row, const char* name);
+psS16 psFitsTableGetS16(bool *status, psFitsTable *table, int row, const char* name);
+psU16 psFitsTableGetU16(bool *status, psFitsTable *table, int row, const char* name);
+psS32 psFitsTableGetS32(bool *status, psFitsTable *table, int row, const char* name);
+psU32 psFitsTableGetU32(bool *status, psFitsTable *table, int row, const char* name);
+psS64 psFitsTableGetS64(bool *status, psFitsTable *table, int row, const char* name);
+psU64 psFitsTableGetU64(bool *status, psFitsTable *table, int row, const char* name);
 
-psF32 psFitsTableGetF32(bool *status, psFitsTable *table, psString name, int row);
+psF32 psFitsTableGetF32(bool *status, psFitsTable *table, int row, const char* name);
+psF64 psFitsTableGetF64(bool *status, psFitsTable *table, int row, const char* name);
 
-
-#ifdef notdef
-// Accessors
-psF32 psFitsTableGetCellF32(psFitsTable *table, int row, int col)
-{
-    assert(row >= 0 && row < table->numRows);
-    assert(col >= 0 && col < table->numCols);
-    assert(table->columns[col].type == PS_TYPE_F32);
-
-    return table->columns[col].data.F32[row];
-}
-
----------------------------
-// code in streaksremove censore sources beocomes
-
-    psFitsTable *table = psFitsReadTableNew(in->fits);
-    int x_col = psFitsGetColumnIndex(table, "X_PSF");
-    int y_col = psFitsGetColumnIndex(table, "X_PSF");
-
-    // Array of booleans. If true don't write the row.
-    bool rowMask = psAlloc(table->numRows * sizeof(bool));
-    bzero(rowMask, table->numRows * sizeof(bool));
-
-    for (int i=0; i < table->numRows; i++) {
-        psF32 x = psFitsTableGetCellF32(table, row, x_col);
-        psF32 y = psFitsTableGetCellF32(table, row, y_col);
-
-        if ((x >= maskImage->numCols) || (y >= maskImage->numRows) 
-            || (x <  0) || (y < 0) || isnan(x) || isnan(y)) {
-            mask = maskStreak;
-        } else {
-            mask = maskImage->data.PS_TYPE_IMAGE_MASK_DATA[(int)y][(int)x];
-        }
-
-        // Key the source if the center pixel is not masked with maskStreak
-        if (mask & maskStreak) {
-            numCensored++;
-            rowMask[i] = true;
-        }
-    }
-
-    if (numCensored < table->numRows) {
-        psFitsWriteTableNew(out->fits, header, table, extname, rowMask);
-    } else {
-        psFitsWriteTableNewEmpty(out->fits, header, table, extname);
-    }
-#endif // notdef
-
-#endif // #ifndef PS_FITSTABLENEW_H
+#endif
