AxesLength.hxx

Go to the documentation of this file.
00001 
00002 
00003 
00004 //-----------------------------------------------------------------------------
00005 // SVN: $Id: AxesLength.hxx 4813 2008-05-29 22:55:39Z RossCollins $
00006 //-----------------------------------------------------------------------------
00007 #ifndef AXESLENGTH_H
00008 #define AXESLENGTH_H
00009 
00010 #include "DataMethod.hxx"
00011 #include "FitsFile.h"
00012 //-----------------------------------------------------------------------------
00015 template<typename DataType>
00016 class AxesLength : public DataMethod<DataType>
00017 {
00018 public:
00020   AxesLength(const FitsFile& aFile)
00021     : mFile(aFile) { DataMethod<DataType>::methodName = "AxesLength"; }
00022 
00024   virtual ~AxesLength() {}
00025 
00027   void setSource(IntMap& tbls, IntMap& cols, StringMap units)
00028     { extnumColno = cols[0]; }
00029 
00031   void setTarget(IntMap& cols, StringMap units)
00032   {
00033     numaxesColno = cols[0];
00034     axis1Colno = cols[1];
00035     axis2Colno = cols[2];
00036   }
00037 
00038   void doit(TableData<DataType>& data, int row1, int row2)
00039   {
00040     double extNum;
00041     int naxes, npixx, npixy;
00042 
00043     for (int rowNo = row1; rowNo < row2; ++rowNo)
00044     {
00045       // move to the extension
00046       data.value(extnumColno, rowNo, extNum);
00047       mFile.movabsHdu((int)extNum);
00048 
00049       // get either the znaxis values for a compressed image
00050       // or the naxis values for an uncompressed one
00051       if (mFile.hasKey("ZIMAGE"))
00052       {
00053         mFile.readKey(FitsFile::ZNAXIS, naxes);
00054         mFile.readKey(FitsFile::ZNAXIS1, npixx);
00055         mFile.readKey(FitsFile::ZNAXIS2, npixy);
00056       }
00057       else
00058       {
00059         mFile.readKey(FitsFile::NAXIS, naxes);
00060         mFile.readKey(FitsFile::NAXIS1, npixx);
00061         mFile.readKey(FitsFile::NAXIS2, npixy);
00062       }
00063 
00064       data.assign(numaxesColno, rowNo, naxes);
00065       data.assign(axis1Colno, rowNo, npixx);
00066       data.assign(axis2Colno, rowNo, npixy);
00067     }
00068   }
00069   // No data from raw data included
00070   void doit2(TableData<DataType>& rawData, TableData<DataType>& data, int row1, int row2) { }
00071 
00072 private:
00073   FitsFile mFile;
00074   int extnumColno;
00075   int numaxesColno;
00076   int axis1Colno;
00077   int axis2Colno;
00078 };
00079 //-----------------------------------------------------------------------------
00080 #endif
00081 //-----------------------------------------------------------------------------
00082 // Change log:
00083 //
00084 // 13-Jun-2005, ETWS: First version, this file determines the image size
00085 //                    form either ZNAXIS or NAXIS, depending if the fits
00086 //                    file is compressed or not.
00087 //  7-Dec-2005, ETWS: Included move of Fits Keys into class FitsFile
00088 //  7-Apr-2008, ETWS: Upgraded to use new detection table layout.
Generated on Mon Oct 4 10:38:34 2010 for WfcamSrc by  doxygen 1.6.3