[3493] | 1 | /*
|
---|
| 2 | --- SOPHYA software - FitsIOServer module ---
|
---|
| 3 | C. Magneville, 2001
|
---|
| 4 | (C) UPS+LAL IN2P3/CNRS (C) DAPNIA-SPP/CEA
|
---|
| 5 | */
|
---|
[1654] | 6 | /* Interface Fits BINARY/ASCII Table Column Reader cmv 26/09/2001 */
|
---|
| 7 | #ifndef FABTCOLREAD_H_SEEN
|
---|
| 8 | #define FABTCOLREAD_H_SEEN
|
---|
| 9 |
|
---|
| 10 | #include "machdefs.h"
|
---|
[2322] | 11 | #include <iostream>
|
---|
[1654] | 12 | #include <string.h>
|
---|
| 13 | #include <string>
|
---|
| 14 |
|
---|
| 15 | #include "anydataobj.h"
|
---|
| 16 | #include "tvector.h"
|
---|
| 17 | #include "FitsIO/fitsio.h"
|
---|
| 18 |
|
---|
| 19 | namespace SOPHYA {
|
---|
| 20 |
|
---|
[2449] | 21 | ///////////////////////////////////////////////////////////////////
|
---|
| 22 | //! Class for opening a FITS file for reading
|
---|
| 23 | class FitsOpenFile : public AnyDataObj {
|
---|
| 24 | public:
|
---|
| 25 | FitsOpenFile(string fname);
|
---|
| 26 | FitsOpenFile(const char *cfname);
|
---|
| 27 | FitsOpenFile();
|
---|
| 28 | FitsOpenFile(FitsOpenFile& fof);
|
---|
| 29 | virtual ~FitsOpenFile();
|
---|
| 30 |
|
---|
[2456] | 31 | inline string FileName() const {return FitsFN;}
|
---|
| 32 | //! Get the number of the HDU read
|
---|
| 33 | inline int HDU(void) const {return IHdu;}
|
---|
| 34 | //! Get the number of the HDU type
|
---|
| 35 | inline int HDUType(void) const {return HduType;}
|
---|
| 36 | //! Get the number of HDU in file
|
---|
| 37 | inline int NHDU() const {return NHdu;}
|
---|
| 38 | //! Get the CFISTIO fits file pointer
|
---|
| 39 | inline fitsfile* GetFitsPtr() const {return FitsPtr;}
|
---|
| 40 | //! Set the positionning status of the file
|
---|
| 41 | inline void SetPosStatus(bool sta=true) {HasBeenPos = sta;}
|
---|
| 42 | //! Get the positionning status of the file
|
---|
| 43 | inline bool GetPosStatus(void) const {return HasBeenPos;}
|
---|
[2449] | 44 |
|
---|
[2456] | 45 | int MoveToHDU(int ihdu);
|
---|
| 46 | int MoveToFirst(int hdutype,int ihdudeb=1);
|
---|
| 47 | int MoveToLast(int hdutype,int ihdudeb=1);
|
---|
| 48 | void Print(void);
|
---|
| 49 |
|
---|
[3572] | 50 | static double ReadKey(fitsfile *fitsptr,const char *keyname);
|
---|
| 51 | static long ReadKeyL(fitsfile *fitsptr,const char *keyname);
|
---|
| 52 | static LONGLONG ReadKeyLL(fitsfile *fitsptr,const char *keyname);
|
---|
| 53 | static string ReadKeyS(fitsfile *fitsptr,const char *keyname);
|
---|
[2453] | 54 | static void printerror(int sta);
|
---|
| 55 |
|
---|
[2449] | 56 | protected:
|
---|
| 57 | void Init(const char *cfname);
|
---|
| 58 | void Delete(void);
|
---|
| 59 |
|
---|
| 60 | string FitsFN;
|
---|
[2456] | 61 | int NHdu, IHdu, HduType;
|
---|
[2449] | 62 | fitsfile *FitsPtr;
|
---|
[2456] | 63 | bool HasBeenPos;
|
---|
[2449] | 64 | };
|
---|
| 65 |
|
---|
| 66 | ///////////////////////////////////////////////////////////////////
|
---|
[1654] | 67 | //! Class for reading a column in a FITS ASCII or BINARY table
|
---|
[2449] | 68 | class FitsABTColRd : public AnyDataObj {
|
---|
[1654] | 69 | public:
|
---|
[4029] | 70 | FitsABTColRd(FitsOpenFile* fof,string collabel,int ihdu=0,int lp=0);
|
---|
| 71 | FitsABTColRd(FitsOpenFile* fof,int colnum,int ihdu=0,int lp=0);
|
---|
[2449] | 72 | FitsABTColRd(FitsABTColRd& fbt);
|
---|
| 73 | FitsABTColRd();
|
---|
| 74 | virtual ~FitsABTColRd();
|
---|
[1654] | 75 |
|
---|
[3572] | 76 | double ReadKey(const char *keyname);
|
---|
| 77 | long ReadKeyL(const char *keyname);
|
---|
| 78 | LONGLONG ReadKeyLL(const char *keyname);
|
---|
| 79 | string ReadKeyS(const char *keyname);
|
---|
[1814] | 80 |
|
---|
[4029] | 81 | double Read(LONGLONG n,long nfirstel=0);
|
---|
| 82 | int_8 ReadLL(LONGLONG n,long nfirstel=0);
|
---|
[4025] | 83 | complex<r_8> ReadComplex(LONGLONG n,long nfirstel=0);
|
---|
| 84 | char* ReadInStr(LONGLONG n,long nfirstel=0);
|
---|
[2170] | 85 |
|
---|
[3128] | 86 | LONGLONG Read(LONGLONG n1,LONGLONG n2,TVector<uint_2>& data);
|
---|
| 87 | LONGLONG Read(LONGLONG n1,LONGLONG n2,TVector<int_4>& data);
|
---|
| 88 | LONGLONG Read(LONGLONG n1,LONGLONG n2,TVector<int_8>& data);
|
---|
| 89 | LONGLONG Read(LONGLONG n1,LONGLONG n2,TVector<float>& data);
|
---|
| 90 | LONGLONG Read(LONGLONG n1,LONGLONG n2,TVector<double>& data);
|
---|
[1654] | 91 |
|
---|
[1659] | 92 | //! return the value of the first row
|
---|
[4029] | 93 | double ReadFirstRow(long nfirstel) {return Read(0,nfirstel);}
|
---|
| 94 | double ReadFirstRow(void) {return Read(0);}
|
---|
[1659] | 95 | //! return the value of the last row
|
---|
[4029] | 96 | double ReadLastRow(long nfirstel) {return Read(NBline-1,nfirstel);}
|
---|
| 97 | double ReadLastRow(void) {return Read(NBline-1);}
|
---|
[1659] | 98 |
|
---|
[4023] | 99 | LONGLONG FirstRow(long nfirstel,double val1,double val2,LONGLONG rowstart=-1);
|
---|
| 100 | inline LONGLONG FirstRow(double val1,double val2,LONGLONG rowstart=-1)
|
---|
| 101 | {return FirstRow(0,val1,val2,rowstart);}
|
---|
| 102 | LONGLONG LastRow(long nfirstel,double val1,double val2,LONGLONG rowstart=-1);
|
---|
| 103 | inline LONGLONG LastRow(double val1,double val2,LONGLONG rowstart=-1)
|
---|
| 104 | {return LastRow(0,val1,val2,rowstart);}
|
---|
[1659] | 105 |
|
---|
[1654] | 106 | //! Set debug level
|
---|
[2456] | 107 | inline void SetDebug(int lp=0) {DbgLevel = (unsigned short) lp;}
|
---|
[1654] | 108 | //! Set null value to be return when reading null data (0=return the data)
|
---|
[2456] | 109 | inline void SetNulVal(double nulval=0.) {NulVal = nulval;}
|
---|
[1654] | 110 | //! Get the FITS file name
|
---|
[2456] | 111 | inline string FileName(void) const
|
---|
| 112 | {if(FitsOF) return FitsOF->FileName(); else return (string)"";}
|
---|
[2449] | 113 | //! Get the pointer to FitsOpenFile
|
---|
[2456] | 114 | inline FitsOpenFile* GetFitsOpenFile(void) const {return FitsOF;}
|
---|
[1673] | 115 | //! Get the FITS file pointer (cfistio pointer)
|
---|
[3114] | 116 | inline fitsfile* GetFitsPtr(void) const {return FitsOF->GetFitsPtr();}
|
---|
[1654] | 117 | //! Get the number of HDU in the FITS file
|
---|
[2456] | 118 | inline int NHDU(void) const
|
---|
| 119 | {if(FitsOF) return FitsOF->NHDU(); else return 0;}
|
---|
[1654] | 120 | //! Get the number of the HDU read
|
---|
[2456] | 121 | inline int HDU(void) const
|
---|
| 122 | {if(FitsOF) return FitsOF->HDU(); else return 0;}
|
---|
[1654] | 123 | //! Get the HDU type
|
---|
[2456] | 124 | inline int HDUType(void) const
|
---|
| 125 | {if(FitsOF) return FitsOF->HDUType(); else return 0;}
|
---|
[1654] | 126 | //! Get the number of rows in the FITS HDU to be read
|
---|
[3128] | 127 | inline LONGLONG GetNbLine(void) const {return NBline;}
|
---|
[1654] | 128 | //! Get the number of columns in the FITS HDU to be read
|
---|
[2456] | 129 | inline int GetNbCol(void) const {return NBcol;}
|
---|
[1654] | 130 | //! Get the columns number that is read
|
---|
[2456] | 131 | inline int GetColNum(void) const {return ColNum;}
|
---|
[1654] | 132 | //! Get the columns label that is read
|
---|
[2456] | 133 | inline string GetColLabel(void) const {return ColLabel;}
|
---|
[1654] | 134 | //! Get the columns type code that is read
|
---|
[2456] | 135 | inline int GetColTypeCode(void) const {return ColTypeCode;}
|
---|
[1654] | 136 | //! Get the columns fits tunit that is read
|
---|
[2456] | 137 | inline string GetColTUnit(void) const {return ColTUnit;}
|
---|
[1654] | 138 | //! Get the columns fits tform that is read
|
---|
[2456] | 139 | inline string GetColTForm(void) const {return ColTForm;}
|
---|
[4023] | 140 | //! Get the columns fits repeat that is read
|
---|
| 141 | inline long GetColRepeat(void) const {return ColRepeat;}
|
---|
[1654] | 142 | //! Print to os
|
---|
[2456] | 143 | virtual void Print(ostream& os,int lp=1) const;
|
---|
[1654] | 144 | //! Print to stdout
|
---|
[2456] | 145 | inline void Print(int lp=1) const {Print(cout,lp);}
|
---|
[1654] | 146 |
|
---|
| 147 | protected:
|
---|
[4029] | 148 | void Init(FitsOpenFile* fof,const char *collabel,int colnum,int ihdu,int lp);
|
---|
[1654] | 149 | void Delete(void);
|
---|
| 150 |
|
---|
[2456] | 151 | string ColLabel,ColTUnit,ColTForm;
|
---|
[4025] | 152 | int ColNum,ColTypeCode,ColDispWidth,NBcol;
|
---|
[4023] | 153 | long ColRepeat;
|
---|
[3128] | 154 | LONGLONG NBline;
|
---|
[4025] | 155 | char *StrBuff;
|
---|
[1654] | 156 |
|
---|
[1657] | 157 | double NulVal;
|
---|
| 158 | unsigned short DbgLevel;
|
---|
[1654] | 159 |
|
---|
[3128] | 160 | LONGLONG NFitsRead;
|
---|
[2449] | 161 | FitsOpenFile* FitsOF;
|
---|
[1654] | 162 | };
|
---|
| 163 |
|
---|
[2449] | 164 | ///////////////////////////////////////////////////////////////////
|
---|
| 165 | //! Class for reading a column in a FITS ASCII or BINARY table with fits file opening
|
---|
| 166 | class FitsABTColRead : public FitsABTColRd {
|
---|
| 167 | public:
|
---|
[4029] | 168 | FitsABTColRead(string fname,string collabel,int ihdu=0,int lp=0);
|
---|
| 169 | FitsABTColRead(string fname,int colnum,int ihdu=0,int lp=0);
|
---|
| 170 | FitsABTColRead(const char *cfname,const char *collabel,int ihdu=0,int lp=0);
|
---|
| 171 | FitsABTColRead(const char *cfname,int colnum,int ihdu=0,int lp=0);
|
---|
[2449] | 172 | FitsABTColRead(FitsABTColRead& fbt);
|
---|
| 173 | FitsABTColRead();
|
---|
| 174 | virtual ~FitsABTColRead();
|
---|
| 175 | };
|
---|
| 176 |
|
---|
[2453] | 177 |
|
---|
| 178 | ///////////////////////////////////////////////////////////////////
|
---|
[4029] | 179 | //! Class for reading ALL the columns in a FITS ASCII or BINARY table
|
---|
[3660] | 180 | class FitsABTColRd1F : public AnyDataObj {
|
---|
| 181 | public:
|
---|
[4025] | 182 | FitsABTColRd1F(FitsOpenFile* fof,int ihdu=0,int lp=0);
|
---|
[3660] | 183 | virtual ~FitsABTColRd1F();
|
---|
| 184 |
|
---|
| 185 | double ReadKey(const char *keyname);
|
---|
| 186 | long ReadKeyL(const char *keyname);
|
---|
| 187 | LONGLONG ReadKeyLL(const char *keyname);
|
---|
| 188 | string ReadKeyS(const char *keyname);
|
---|
| 189 |
|
---|
[4029] | 190 | double Read(int ColNum,LONGLONG n,long nfirstel=0);
|
---|
| 191 | int_8 ReadLL(int ColNum,LONGLONG n,long nfirstel=0);
|
---|
[4025] | 192 | complex<r_8> ReadComplex(int ColNum,LONGLONG n,long nfirstel=0);
|
---|
| 193 | char* ReadInStr(int ColNum,LONGLONG n,long nfirstel=0);
|
---|
[3660] | 194 | int GetColNum(const char *colname);
|
---|
| 195 |
|
---|
| 196 | //! Set debug level
|
---|
| 197 | inline void SetDebug(int lp=0) {DbgLevel = (unsigned short) lp;}
|
---|
| 198 | //! Set null value to be return when reading null data (0=return the data)
|
---|
| 199 | inline void SetNulVal(double nulval=0.) {NulVal = nulval;}
|
---|
| 200 | //! Get the FITS file name
|
---|
| 201 | inline string FileName(void) const
|
---|
| 202 | {if(FitsOF) return FitsOF->FileName(); else return (string)"";}
|
---|
| 203 | //! Get the pointer to FitsOpenFile
|
---|
| 204 | inline FitsOpenFile* GetFitsOpenFile(void) const {return FitsOF;}
|
---|
| 205 | //! Get the FITS file pointer (cfistio pointer)
|
---|
| 206 | inline fitsfile* GetFitsPtr(void) const {return FitsOF->GetFitsPtr();}
|
---|
| 207 | //! Get the number of HDU in the FITS file
|
---|
| 208 | inline int NHDU(void) const
|
---|
| 209 | {if(FitsOF) return FitsOF->NHDU(); else return 0;}
|
---|
| 210 | //! Get the number of the HDU read
|
---|
| 211 | inline int HDU(void) const
|
---|
| 212 | {if(FitsOF) return FitsOF->HDU(); else return 0;}
|
---|
| 213 | //! Get the HDU type
|
---|
| 214 | inline int HDUType(void) const
|
---|
| 215 | {if(FitsOF) return FitsOF->HDUType(); else return 0;}
|
---|
| 216 | //! Get the number of rows in the FITS HDU to be read
|
---|
| 217 | inline LONGLONG GetNbLine(void) const {return NBline;}
|
---|
| 218 | //! Get the number of columns in the FITS HDU to be read
|
---|
| 219 | inline int GetNbCol(void) const {return NBcol;}
|
---|
| 220 | //! Get the columns label that is read
|
---|
| 221 | inline string GetColLabel(int ColNum) const
|
---|
| 222 | {if(ColNum<0 || ColNum>=NBcol) return string(""); else return ColLabel[ColNum];}
|
---|
| 223 | //! Get the columns type code that is read
|
---|
| 224 | inline int GetColTypeCode(int ColNum) const
|
---|
| 225 | {if(ColNum<0 || ColNum>=NBcol) return -999; else return ColTypeCode[ColNum];}
|
---|
| 226 | //! Get the columns fits tunit that is read
|
---|
| 227 | inline string GetColTUnit(int ColNum) const
|
---|
| 228 | {if(ColNum<0 || ColNum>=NBcol) return string(""); else return ColTUnit[ColNum];}
|
---|
| 229 | //! Get the columns fits tform that is read
|
---|
| 230 | inline string GetColTForm(int ColNum) const
|
---|
| 231 | {if(ColNum<0 || ColNum>=NBcol) return string(""); else return ColTForm[ColNum];}
|
---|
[4023] | 232 | //! Get the columns fits repeat that is read
|
---|
| 233 | inline long GetColRepeat(int ColNum) const
|
---|
| 234 | {if(ColNum<0 || ColNum>=NBcol) return -999; else return ColRepeat[ColNum];}
|
---|
[3660] | 235 | //! Print to os
|
---|
| 236 | virtual void Print(ostream& os,int lp=1) const;
|
---|
| 237 | //! Print to stdout
|
---|
| 238 | inline void Print(int lp=1) const {Print(cout,lp);}
|
---|
| 239 |
|
---|
| 240 | protected:
|
---|
[4025] | 241 | void Init(FitsOpenFile* fof,int ihdu,int lp);
|
---|
[3660] | 242 | void Delete(void);
|
---|
| 243 |
|
---|
| 244 | vector<string> ColLabel,ColTUnit,ColTForm;
|
---|
[4025] | 245 | vector<int> ColTypeCode, ColDispWidth;
|
---|
[4023] | 246 | vector<long> ColRepeat;
|
---|
[3660] | 247 | int NBcol;
|
---|
| 248 | LONGLONG NBline;
|
---|
[4025] | 249 | vector<char*> StrBuff;
|
---|
[3660] | 250 |
|
---|
| 251 | double NulVal;
|
---|
| 252 | unsigned short DbgLevel;
|
---|
| 253 |
|
---|
| 254 | FitsOpenFile* FitsOF;
|
---|
| 255 | };
|
---|
| 256 |
|
---|
| 257 |
|
---|
| 258 | ///////////////////////////////////////////////////////////////////
|
---|
| 259 | //! Class for reading ALL the columns in a FITS ASCII or BINARY table with fits file opening
|
---|
| 260 | class FitsABTColRead1F : public FitsABTColRd1F {
|
---|
| 261 | public:
|
---|
[4025] | 262 | FitsABTColRead1F(string fname,int ihdu=0,int lp=0);
|
---|
| 263 | FitsABTColRead1F(const char *cfname,int ihdu=0,int lp=0);
|
---|
[3660] | 264 | virtual ~FitsABTColRead1F();
|
---|
| 265 | };
|
---|
| 266 |
|
---|
| 267 | ///////////////////////////////////////////////////////////////////
|
---|
[2453] | 268 | //! Class for reading a 2D image from a FITS file
|
---|
| 269 | class FitsImg2DRd : public AnyDataObj {
|
---|
| 270 | public:
|
---|
| 271 | FitsImg2DRd(FitsOpenFile* fof,int ihdu=0,int lp=0);
|
---|
| 272 | FitsImg2DRd(FitsImg2DRd& fbt);
|
---|
| 273 | FitsImg2DRd();
|
---|
| 274 | virtual ~FitsImg2DRd();
|
---|
| 275 |
|
---|
[3572] | 276 | double ReadKey(const char *keyname);
|
---|
| 277 | long ReadKeyL(const char *keyname);
|
---|
| 278 | LONGLONG ReadKeyLL(const char *keyname);
|
---|
| 279 | string ReadKeyS(const char *keyname);
|
---|
[2453] | 280 |
|
---|
[3128] | 281 | LONGLONG Read(TMatrix<uint_2>& data);
|
---|
| 282 | LONGLONG Read(TMatrix<int_4>& data);
|
---|
| 283 | LONGLONG Read(TMatrix<int_8>& data);
|
---|
| 284 | LONGLONG Read(TMatrix<float>& data);
|
---|
| 285 | LONGLONG Read(TMatrix<double>& data);
|
---|
[3188] | 286 | double Read(LONGLONG numcol, LONGLONG numrow);
|
---|
[2453] | 287 |
|
---|
| 288 | //! Set debug level
|
---|
| 289 | inline void SetDebug(int lp=0) {DbgLevel = (unsigned short) lp;}
|
---|
| 290 | //! Set null value to be return when reading null data (0=return the data)
|
---|
| 291 | inline void SetNulVal(double nulval=0.) {NulVal = nulval;}
|
---|
| 292 | //! Get the pointer to FitsOpenFile
|
---|
[2456] | 293 | inline FitsOpenFile* GetFitsOpenFile(void) const {return FitsOF;}
|
---|
| 294 | //! Get the FITS file pointer (cfistio pointer)
|
---|
[3114] | 295 | inline fitsfile* GetFitsPtr(void) const {return FitsOF->GetFitsPtr();}
|
---|
[2456] | 296 | //! Get the number of HDU in the FITS file
|
---|
| 297 | inline int NHDU(void) const
|
---|
| 298 | {if(FitsOF) return FitsOF->NHDU(); else return 0;}
|
---|
[2453] | 299 | //! Get the number of the HDU read
|
---|
[2456] | 300 | inline int HDU(void) const
|
---|
| 301 | {if(FitsOF) return FitsOF->HDU(); else return 0;}
|
---|
[2453] | 302 | //! Get the HDU type
|
---|
[2456] | 303 | inline int HDUType(void) const
|
---|
| 304 | {if(FitsOF) return FitsOF->HDUType(); else return 0;}
|
---|
[2453] | 305 | //! Get NAXIS1
|
---|
[3128] | 306 | inline LONGLONG Naxis1(void) const {return Naxis[0];}
|
---|
[2453] | 307 | //! Get NAXIS2
|
---|
[3128] | 308 | inline LONGLONG Naxis2(void) const {return Naxis[1];}
|
---|
[2453] | 309 |
|
---|
| 310 | protected:
|
---|
| 311 | void Init(FitsOpenFile* fof,int ihdu,int lp);
|
---|
| 312 |
|
---|
[3128] | 313 | LONGLONG Naxis[2];
|
---|
[2453] | 314 | double NulVal;
|
---|
| 315 | unsigned short DbgLevel;
|
---|
| 316 |
|
---|
| 317 | FitsOpenFile* FitsOF;
|
---|
| 318 | };
|
---|
[2591] | 319 |
|
---|
[2791] | 320 | ///////////////////////////////////////////////////////////////////
|
---|
| 321 | //! Class for reading a 2D image from a FITS file
|
---|
| 322 | class FitsImg2DRead : public FitsImg2DRd {
|
---|
| 323 | public:
|
---|
| 324 | FitsImg2DRead(string fname,int ihdu=0,int lp=0);
|
---|
| 325 | FitsImg2DRead(const char *cfname,int ihdu=0,int lp=0);
|
---|
| 326 | FitsImg2DRead(FitsImg2DRead& fbt);
|
---|
| 327 | FitsImg2DRead();
|
---|
| 328 | virtual ~FitsImg2DRead();
|
---|
| 329 | };
|
---|
| 330 |
|
---|
[3114] | 331 |
|
---|
| 332 | ///////////////////////////////////////////////////////////////////
|
---|
| 333 | //! Class for reading a 3D image from a FITS file
|
---|
| 334 | class FitsImg3DRd : public AnyDataObj {
|
---|
| 335 | public:
|
---|
| 336 | FitsImg3DRd(FitsOpenFile* fof,int ihdu=0,int lp=0);
|
---|
| 337 | FitsImg3DRd(FitsImg3DRd& fbt);
|
---|
| 338 | FitsImg3DRd();
|
---|
| 339 | virtual ~FitsImg3DRd();
|
---|
| 340 |
|
---|
[3572] | 341 | double ReadKey(const char *keyname);
|
---|
| 342 | long ReadKeyL(const char *keyname);
|
---|
| 343 | LONGLONG ReadKeyLL(const char *keyname);
|
---|
| 344 | string ReadKeyS(const char *keyname);
|
---|
[3114] | 345 |
|
---|
[3128] | 346 | LONGLONG Read(TArray<uint_2>& data);
|
---|
| 347 | LONGLONG Read(TArray<int_4>& data);
|
---|
| 348 | LONGLONG Read(TArray<int_8>& data);
|
---|
| 349 | LONGLONG Read(TArray<float>& data);
|
---|
| 350 | LONGLONG Read(TArray<double>& data);
|
---|
[3772] | 351 |
|
---|
| 352 | LONGLONG Read(LONGLONG j, LONGLONG k, TVector<int_4>& data);
|
---|
| 353 | LONGLONG Read(LONGLONG j, LONGLONG k, TVector<float>& data);
|
---|
| 354 | LONGLONG Read(LONGLONG j, LONGLONG k, TVector<double>& data);
|
---|
| 355 |
|
---|
[3188] | 356 | double Read(LONGLONG i, LONGLONG j, LONGLONG k);
|
---|
[3114] | 357 |
|
---|
| 358 | //! Set debug level
|
---|
| 359 | inline void SetDebug(int lp=0) {DbgLevel = (unsigned short) lp;}
|
---|
| 360 | //! Set null value to be return when reading null data (0=return the data)
|
---|
| 361 | inline void SetNulVal(double nulval=0.) {NulVal = nulval;}
|
---|
| 362 | //! Get the pointer to FitsOpenFile
|
---|
| 363 | inline FitsOpenFile* GetFitsOpenFile(void) const {return FitsOF;}
|
---|
| 364 | //! Get the FITS file pointer (cfistio pointer)
|
---|
| 365 | inline fitsfile* GetFitsPtr(void) const {return FitsOF->GetFitsPtr();}
|
---|
| 366 | //! Get the number of HDU in the FITS file
|
---|
| 367 | inline int NHDU(void) const
|
---|
| 368 | {if(FitsOF) return FitsOF->NHDU(); else return 0;}
|
---|
| 369 | //! Get the number of the HDU read
|
---|
| 370 | inline int HDU(void) const
|
---|
| 371 | {if(FitsOF) return FitsOF->HDU(); else return 0;}
|
---|
| 372 | //! Get the HDU type
|
---|
| 373 | inline int HDUType(void) const
|
---|
| 374 | {if(FitsOF) return FitsOF->HDUType(); else return 0;}
|
---|
| 375 | //! Get NAXIS1
|
---|
[3128] | 376 | inline LONGLONG Naxis1(void) const {return Naxis[0];}
|
---|
[3114] | 377 | //! Get NAXIS2
|
---|
[3128] | 378 | inline LONGLONG Naxis2(void) const {return Naxis[1];}
|
---|
[3114] | 379 | //! Get NAXIS3
|
---|
[3128] | 380 | inline LONGLONG Naxis3(void) const {return Naxis[2];}
|
---|
[3114] | 381 |
|
---|
| 382 | protected:
|
---|
| 383 | void Init(FitsOpenFile* fof,int ihdu,int lp);
|
---|
| 384 |
|
---|
[3128] | 385 | LONGLONG Naxis[3];
|
---|
[3114] | 386 | double NulVal;
|
---|
| 387 | unsigned short DbgLevel;
|
---|
| 388 |
|
---|
| 389 | FitsOpenFile* FitsOF;
|
---|
| 390 | };
|
---|
| 391 |
|
---|
| 392 | ///////////////////////////////////////////////////////////////////
|
---|
| 393 | //! Class for reading a 3D image from a FITS file
|
---|
| 394 | class FitsImg3DRead : public FitsImg3DRd {
|
---|
| 395 | public:
|
---|
| 396 | FitsImg3DRead(string fname,int ihdu=0,int lp=0);
|
---|
| 397 | FitsImg3DRead(const char *cfname,int ihdu=0,int lp=0);
|
---|
| 398 | FitsImg3DRead(FitsImg3DRead& fbt);
|
---|
| 399 | FitsImg3DRead();
|
---|
| 400 | virtual ~FitsImg3DRead();
|
---|
| 401 | };
|
---|
| 402 |
|
---|
[2591] | 403 | } // namespace SOPHYA
|
---|
| 404 | #endif /* FABTCOLREAD_H_SEEN */
|
---|