[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:
|
---|
[2449] | 70 | FitsABTColRd(FitsOpenFile* fof,string collabel,int ihdu=0
|
---|
| 71 | ,long blen=100,long bsens=1,int lp=0);
|
---|
| 72 | FitsABTColRd(FitsOpenFile* fof,int colnum,int ihdu=0
|
---|
| 73 | ,long blen=100,long bsens=1,int lp=0);
|
---|
| 74 | FitsABTColRd(FitsABTColRd& fbt);
|
---|
| 75 | FitsABTColRd();
|
---|
| 76 | virtual ~FitsABTColRd();
|
---|
[1654] | 77 |
|
---|
| 78 | void ChangeBuffer(long blen=100,long bsens=1);
|
---|
| 79 |
|
---|
[3572] | 80 | double ReadKey(const char *keyname);
|
---|
| 81 | long ReadKeyL(const char *keyname);
|
---|
| 82 | LONGLONG ReadKeyLL(const char *keyname);
|
---|
| 83 | string ReadKeyS(const char *keyname);
|
---|
[1814] | 84 |
|
---|
[3128] | 85 | double Read(LONGLONG n,bool usebuffer=true);
|
---|
[2170] | 86 |
|
---|
[3128] | 87 | LONGLONG Read(LONGLONG n1,LONGLONG n2,TVector<uint_2>& data);
|
---|
| 88 | LONGLONG Read(LONGLONG n1,LONGLONG n2,TVector<int_4>& data);
|
---|
| 89 | LONGLONG Read(LONGLONG n1,LONGLONG n2,TVector<int_8>& data);
|
---|
| 90 | LONGLONG Read(LONGLONG n1,LONGLONG n2,TVector<float>& data);
|
---|
| 91 | LONGLONG Read(LONGLONG n1,LONGLONG n2,TVector<double>& data);
|
---|
[1654] | 92 |
|
---|
[1659] | 93 | //! return the value of the first row
|
---|
| 94 | double ReadFirstRow(bool usebuffer=false)
|
---|
| 95 | {return Read(0,usebuffer);}
|
---|
| 96 | //! return the value of the last row
|
---|
| 97 | double ReadLastRow(bool usebuffer=false)
|
---|
| 98 | {return Read(NBline-1,usebuffer);}
|
---|
| 99 |
|
---|
[3128] | 100 | LONGLONG FirstRow(double val1,double val2,LONGLONG rowstart=-1);
|
---|
| 101 | LONGLONG LastRow(double val1,double val2,LONGLONG rowstart=-1);
|
---|
[1659] | 102 |
|
---|
[1654] | 103 | //! Set debug level
|
---|
[2456] | 104 | inline void SetDebug(int lp=0) {DbgLevel = (unsigned short) lp;}
|
---|
[1654] | 105 | //! Set null value to be return when reading null data (0=return the data)
|
---|
[2456] | 106 | inline void SetNulVal(double nulval=0.) {NulVal = nulval;}
|
---|
[1654] | 107 | //! Get the FITS file name
|
---|
[2456] | 108 | inline string FileName(void) const
|
---|
| 109 | {if(FitsOF) return FitsOF->FileName(); else return (string)"";}
|
---|
[2449] | 110 | //! Get the pointer to FitsOpenFile
|
---|
[2456] | 111 | inline FitsOpenFile* GetFitsOpenFile(void) const {return FitsOF;}
|
---|
[1673] | 112 | //! Get the FITS file pointer (cfistio pointer)
|
---|
[3114] | 113 | inline fitsfile* GetFitsPtr(void) const {return FitsOF->GetFitsPtr();}
|
---|
[1654] | 114 | //! Get the number of HDU in the FITS file
|
---|
[2456] | 115 | inline int NHDU(void) const
|
---|
| 116 | {if(FitsOF) return FitsOF->NHDU(); else return 0;}
|
---|
[1654] | 117 | //! Get the number of the HDU read
|
---|
[2456] | 118 | inline int HDU(void) const
|
---|
| 119 | {if(FitsOF) return FitsOF->HDU(); else return 0;}
|
---|
[1654] | 120 | //! Get the HDU type
|
---|
[2456] | 121 | inline int HDUType(void) const
|
---|
| 122 | {if(FitsOF) return FitsOF->HDUType(); else return 0;}
|
---|
[1654] | 123 | //! Get the number of rows in the FITS HDU to be read
|
---|
[3128] | 124 | inline LONGLONG GetNbLine(void) const {return NBline;}
|
---|
[1654] | 125 | //! Get the number of columns in the FITS HDU to be read
|
---|
[2456] | 126 | inline int GetNbCol(void) const {return NBcol;}
|
---|
[1654] | 127 | //! Get the columns number that is read
|
---|
[2456] | 128 | inline int GetColNum(void) const {return ColNum;}
|
---|
[1654] | 129 | //! Get the columns label that is read
|
---|
[2456] | 130 | inline string GetColLabel(void) const {return ColLabel;}
|
---|
[1654] | 131 | //! Get the columns type code that is read
|
---|
[2456] | 132 | inline int GetColTypeCode(void) const {return ColTypeCode;}
|
---|
[1654] | 133 | //! Get the columns fits tunit that is read
|
---|
[2456] | 134 | inline string GetColTUnit(void) const {return ColTUnit;}
|
---|
[1654] | 135 | //! Get the columns fits tform that is read
|
---|
[2456] | 136 | inline string GetColTForm(void) const {return ColTForm;}
|
---|
[1657] | 137 | //! Get the read requested buffer length
|
---|
[2456] | 138 | inline long GetBLen(void) const {return BuffLen;}
|
---|
[1654] | 139 | //! Get the read buffer direction
|
---|
[2456] | 140 | inline long GetBSens(void) const {return BuffSens;}
|
---|
[1654] | 141 | //! Print to os
|
---|
[2456] | 142 | virtual void Print(ostream& os,int lp=1) const;
|
---|
[1654] | 143 | //! Print to stdout
|
---|
[2456] | 144 | inline void Print(int lp=1) const {Print(cout,lp);}
|
---|
[1657] | 145 | //! Get the read effective buffer length
|
---|
[2456] | 146 | inline long GetNBuffer(void) const {return NBuffer;}
|
---|
[1654] | 147 | //! Get the read bufferpointer
|
---|
| 148 | inline double* GetBuffer(void) {return Buffer;}
|
---|
| 149 |
|
---|
| 150 | protected:
|
---|
[2449] | 151 | void Init(FitsOpenFile* fof,const char *collabel,int colnum
|
---|
[1654] | 152 | ,int ihdu,long blen,long bsens,int lp);
|
---|
| 153 | void Delete(void);
|
---|
| 154 |
|
---|
[2456] | 155 | string ColLabel,ColTUnit,ColTForm;
|
---|
| 156 | int ColNum,ColTypeCode,NBcol;
|
---|
[3128] | 157 | LONGLONG NBline;
|
---|
[1654] | 158 |
|
---|
[1657] | 159 | double NulVal;
|
---|
| 160 | unsigned short DbgLevel;
|
---|
[1654] | 161 | long BuffLen, BuffSens;
|
---|
| 162 |
|
---|
[3128] | 163 | LONGLONG NFitsRead;
|
---|
[2449] | 164 | FitsOpenFile* FitsOF;
|
---|
[3128] | 165 | LONGLONG LineDeb, LineFin;
|
---|
[1654] | 166 | double *Buffer;
|
---|
| 167 | long NBuffer;
|
---|
| 168 | };
|
---|
| 169 |
|
---|
[2449] | 170 | ///////////////////////////////////////////////////////////////////
|
---|
| 171 | //! Class for reading a column in a FITS ASCII or BINARY table with fits file opening
|
---|
| 172 | class FitsABTColRead : public FitsABTColRd {
|
---|
| 173 | public:
|
---|
| 174 | FitsABTColRead(string fname,string collabel,int ihdu=0
|
---|
| 175 | ,long blen=100,long bsens=1,int lp=0);
|
---|
| 176 | FitsABTColRead(string fname,int colnum,int ihdu=0
|
---|
| 177 | ,long blen=100,long bsens=1,int lp=0);
|
---|
| 178 | FitsABTColRead(const char *cfname,const char *collabel,int ihdu=0
|
---|
| 179 | ,long blen=100,long bsens=1,int lp=0);
|
---|
| 180 | FitsABTColRead(const char *cfname,int colnum,int ihdu=0
|
---|
| 181 | ,long blen=100,long bsens=1,int lp=0);
|
---|
| 182 | FitsABTColRead(FitsABTColRead& fbt);
|
---|
| 183 | FitsABTColRead();
|
---|
| 184 | virtual ~FitsABTColRead();
|
---|
| 185 | };
|
---|
| 186 |
|
---|
[2453] | 187 |
|
---|
| 188 | ///////////////////////////////////////////////////////////////////
|
---|
[3660] | 189 | //! Class for reading ALL the columns in a FITS ASCII or BINARY table
|
---|
| 190 | class FitsABTColRd1F : public AnyDataObj {
|
---|
| 191 | public:
|
---|
| 192 | FitsABTColRd1F(FitsOpenFile* fof,int ihdu=0
|
---|
| 193 | ,long blen=100,long bsens=1,int lp=0);
|
---|
| 194 | virtual ~FitsABTColRd1F();
|
---|
| 195 |
|
---|
| 196 | void ChangeBuffer(long blen=100,long bsens=1);
|
---|
| 197 |
|
---|
| 198 | double ReadKey(const char *keyname);
|
---|
| 199 | long ReadKeyL(const char *keyname);
|
---|
| 200 | LONGLONG ReadKeyLL(const char *keyname);
|
---|
| 201 | string ReadKeyS(const char *keyname);
|
---|
| 202 |
|
---|
| 203 | double Read(int ColNum,LONGLONG n,bool usebuffer=true);
|
---|
| 204 | int GetColNum(const char *colname);
|
---|
| 205 |
|
---|
| 206 | //! Set debug level
|
---|
| 207 | inline void SetDebug(int lp=0) {DbgLevel = (unsigned short) lp;}
|
---|
| 208 | //! Set null value to be return when reading null data (0=return the data)
|
---|
| 209 | inline void SetNulVal(double nulval=0.) {NulVal = nulval;}
|
---|
| 210 | //! Get the FITS file name
|
---|
| 211 | inline string FileName(void) const
|
---|
| 212 | {if(FitsOF) return FitsOF->FileName(); else return (string)"";}
|
---|
| 213 | //! Get the pointer to FitsOpenFile
|
---|
| 214 | inline FitsOpenFile* GetFitsOpenFile(void) const {return FitsOF;}
|
---|
| 215 | //! Get the FITS file pointer (cfistio pointer)
|
---|
| 216 | inline fitsfile* GetFitsPtr(void) const {return FitsOF->GetFitsPtr();}
|
---|
| 217 | //! Get the number of HDU in the FITS file
|
---|
| 218 | inline int NHDU(void) const
|
---|
| 219 | {if(FitsOF) return FitsOF->NHDU(); else return 0;}
|
---|
| 220 | //! Get the number of the HDU read
|
---|
| 221 | inline int HDU(void) const
|
---|
| 222 | {if(FitsOF) return FitsOF->HDU(); else return 0;}
|
---|
| 223 | //! Get the HDU type
|
---|
| 224 | inline int HDUType(void) const
|
---|
| 225 | {if(FitsOF) return FitsOF->HDUType(); else return 0;}
|
---|
| 226 | //! Get the number of rows in the FITS HDU to be read
|
---|
| 227 | inline LONGLONG GetNbLine(void) const {return NBline;}
|
---|
| 228 | //! Get the number of columns in the FITS HDU to be read
|
---|
| 229 | inline int GetNbCol(void) const {return NBcol;}
|
---|
| 230 | //! Get the columns label that is read
|
---|
| 231 | inline string GetColLabel(int ColNum) const
|
---|
| 232 | {if(ColNum<0 || ColNum>=NBcol) return string(""); else return ColLabel[ColNum];}
|
---|
| 233 | //! Get the columns type code that is read
|
---|
| 234 | inline int GetColTypeCode(int ColNum) const
|
---|
| 235 | {if(ColNum<0 || ColNum>=NBcol) return -999; else return ColTypeCode[ColNum];}
|
---|
| 236 | //! Get the columns fits tunit that is read
|
---|
| 237 | inline string GetColTUnit(int ColNum) const
|
---|
| 238 | {if(ColNum<0 || ColNum>=NBcol) return string(""); else return ColTUnit[ColNum];}
|
---|
| 239 | //! Get the columns fits tform that is read
|
---|
| 240 | inline string GetColTForm(int ColNum) const
|
---|
| 241 | {if(ColNum<0 || ColNum>=NBcol) return string(""); else return ColTForm[ColNum];}
|
---|
| 242 | //! Get the read requested buffer length
|
---|
| 243 | inline long GetBLen(void) const {return BuffLen;}
|
---|
| 244 | //! Get the read buffer direction
|
---|
| 245 | inline long GetBSens(void) const {return BuffSens;}
|
---|
| 246 | //! Print to os
|
---|
| 247 | virtual void Print(ostream& os,int lp=1) const;
|
---|
| 248 | //! Print to stdout
|
---|
| 249 | inline void Print(int lp=1) const {Print(cout,lp);}
|
---|
| 250 | //! Get the read effective buffer length
|
---|
| 251 | inline long GetNBuffer(void) const {return NBuffer;}
|
---|
| 252 | //! Get the read bufferpointer
|
---|
| 253 | inline double* GetBuffer(int ColNum)
|
---|
| 254 | {if(ColNum<0 || ColNum>=NBcol) return NULL; else return Buffer[ColNum];}
|
---|
| 255 |
|
---|
| 256 | protected:
|
---|
| 257 | void Init(FitsOpenFile* fof,int ihdu,long blen,long bsens,int lp);
|
---|
| 258 | void Delete(void);
|
---|
| 259 |
|
---|
| 260 | vector<string> ColLabel,ColTUnit,ColTForm;
|
---|
| 261 | vector<int> ColTypeCode;
|
---|
| 262 | int NBcol;
|
---|
| 263 | LONGLONG NBline;
|
---|
| 264 |
|
---|
| 265 | double NulVal;
|
---|
| 266 | unsigned short DbgLevel;
|
---|
| 267 | long BuffLen, BuffSens;
|
---|
| 268 |
|
---|
| 269 | FitsOpenFile* FitsOF;
|
---|
| 270 | vector<LONGLONG> LineDeb, LineFin;
|
---|
| 271 | double **Buffer;
|
---|
| 272 | long NBuffer;
|
---|
| 273 | };
|
---|
| 274 |
|
---|
| 275 |
|
---|
| 276 | ///////////////////////////////////////////////////////////////////
|
---|
| 277 | //! Class for reading ALL the columns in a FITS ASCII or BINARY table with fits file opening
|
---|
| 278 | class FitsABTColRead1F : public FitsABTColRd1F {
|
---|
| 279 | public:
|
---|
| 280 | FitsABTColRead1F(string fname,int ihdu=0
|
---|
| 281 | ,long blen=100,long bsens=1,int lp=0);
|
---|
| 282 | FitsABTColRead1F(const char *cfname,int ihdu=0
|
---|
| 283 | ,long blen=100,long bsens=1,int lp=0);
|
---|
| 284 | virtual ~FitsABTColRead1F();
|
---|
| 285 | };
|
---|
| 286 |
|
---|
| 287 | ///////////////////////////////////////////////////////////////////
|
---|
[2453] | 288 | //! Class for reading a 2D image from a FITS file
|
---|
| 289 | class FitsImg2DRd : public AnyDataObj {
|
---|
| 290 | public:
|
---|
| 291 | FitsImg2DRd(FitsOpenFile* fof,int ihdu=0,int lp=0);
|
---|
| 292 | FitsImg2DRd(FitsImg2DRd& fbt);
|
---|
| 293 | FitsImg2DRd();
|
---|
| 294 | virtual ~FitsImg2DRd();
|
---|
| 295 |
|
---|
[3572] | 296 | double ReadKey(const char *keyname);
|
---|
| 297 | long ReadKeyL(const char *keyname);
|
---|
| 298 | LONGLONG ReadKeyLL(const char *keyname);
|
---|
| 299 | string ReadKeyS(const char *keyname);
|
---|
[2453] | 300 |
|
---|
[3128] | 301 | LONGLONG Read(TMatrix<uint_2>& data);
|
---|
| 302 | LONGLONG Read(TMatrix<int_4>& data);
|
---|
| 303 | LONGLONG Read(TMatrix<int_8>& data);
|
---|
| 304 | LONGLONG Read(TMatrix<float>& data);
|
---|
| 305 | LONGLONG Read(TMatrix<double>& data);
|
---|
[3188] | 306 | double Read(LONGLONG numcol, LONGLONG numrow);
|
---|
[2453] | 307 |
|
---|
| 308 | //! Set debug level
|
---|
| 309 | inline void SetDebug(int lp=0) {DbgLevel = (unsigned short) lp;}
|
---|
| 310 | //! Set null value to be return when reading null data (0=return the data)
|
---|
| 311 | inline void SetNulVal(double nulval=0.) {NulVal = nulval;}
|
---|
| 312 | //! Get the pointer to FitsOpenFile
|
---|
[2456] | 313 | inline FitsOpenFile* GetFitsOpenFile(void) const {return FitsOF;}
|
---|
| 314 | //! Get the FITS file pointer (cfistio pointer)
|
---|
[3114] | 315 | inline fitsfile* GetFitsPtr(void) const {return FitsOF->GetFitsPtr();}
|
---|
[2456] | 316 | //! Get the number of HDU in the FITS file
|
---|
| 317 | inline int NHDU(void) const
|
---|
| 318 | {if(FitsOF) return FitsOF->NHDU(); else return 0;}
|
---|
[2453] | 319 | //! Get the number of the HDU read
|
---|
[2456] | 320 | inline int HDU(void) const
|
---|
| 321 | {if(FitsOF) return FitsOF->HDU(); else return 0;}
|
---|
[2453] | 322 | //! Get the HDU type
|
---|
[2456] | 323 | inline int HDUType(void) const
|
---|
| 324 | {if(FitsOF) return FitsOF->HDUType(); else return 0;}
|
---|
[2453] | 325 | //! Get NAXIS1
|
---|
[3128] | 326 | inline LONGLONG Naxis1(void) const {return Naxis[0];}
|
---|
[2453] | 327 | //! Get NAXIS2
|
---|
[3128] | 328 | inline LONGLONG Naxis2(void) const {return Naxis[1];}
|
---|
[2453] | 329 |
|
---|
| 330 | protected:
|
---|
| 331 | void Init(FitsOpenFile* fof,int ihdu,int lp);
|
---|
| 332 |
|
---|
[3128] | 333 | LONGLONG Naxis[2];
|
---|
[2453] | 334 | double NulVal;
|
---|
| 335 | unsigned short DbgLevel;
|
---|
| 336 |
|
---|
| 337 | FitsOpenFile* FitsOF;
|
---|
| 338 | };
|
---|
[2591] | 339 |
|
---|
[2791] | 340 | ///////////////////////////////////////////////////////////////////
|
---|
| 341 | //! Class for reading a 2D image from a FITS file
|
---|
| 342 | class FitsImg2DRead : public FitsImg2DRd {
|
---|
| 343 | public:
|
---|
| 344 | FitsImg2DRead(string fname,int ihdu=0,int lp=0);
|
---|
| 345 | FitsImg2DRead(const char *cfname,int ihdu=0,int lp=0);
|
---|
| 346 | FitsImg2DRead(FitsImg2DRead& fbt);
|
---|
| 347 | FitsImg2DRead();
|
---|
| 348 | virtual ~FitsImg2DRead();
|
---|
| 349 | };
|
---|
| 350 |
|
---|
[3114] | 351 |
|
---|
| 352 | ///////////////////////////////////////////////////////////////////
|
---|
| 353 | //! Class for reading a 3D image from a FITS file
|
---|
| 354 | class FitsImg3DRd : public AnyDataObj {
|
---|
| 355 | public:
|
---|
| 356 | FitsImg3DRd(FitsOpenFile* fof,int ihdu=0,int lp=0);
|
---|
| 357 | FitsImg3DRd(FitsImg3DRd& fbt);
|
---|
| 358 | FitsImg3DRd();
|
---|
| 359 | virtual ~FitsImg3DRd();
|
---|
| 360 |
|
---|
[3572] | 361 | double ReadKey(const char *keyname);
|
---|
| 362 | long ReadKeyL(const char *keyname);
|
---|
| 363 | LONGLONG ReadKeyLL(const char *keyname);
|
---|
| 364 | string ReadKeyS(const char *keyname);
|
---|
[3114] | 365 |
|
---|
[3128] | 366 | LONGLONG Read(TArray<uint_2>& data);
|
---|
| 367 | LONGLONG Read(TArray<int_4>& data);
|
---|
| 368 | LONGLONG Read(TArray<int_8>& data);
|
---|
| 369 | LONGLONG Read(TArray<float>& data);
|
---|
| 370 | LONGLONG Read(TArray<double>& data);
|
---|
[3772] | 371 |
|
---|
| 372 | LONGLONG Read(LONGLONG j, LONGLONG k, TVector<int_4>& data);
|
---|
| 373 | LONGLONG Read(LONGLONG j, LONGLONG k, TVector<float>& data);
|
---|
| 374 | LONGLONG Read(LONGLONG j, LONGLONG k, TVector<double>& data);
|
---|
| 375 |
|
---|
[3188] | 376 | double Read(LONGLONG i, LONGLONG j, LONGLONG k);
|
---|
[3114] | 377 |
|
---|
| 378 | //! Set debug level
|
---|
| 379 | inline void SetDebug(int lp=0) {DbgLevel = (unsigned short) lp;}
|
---|
| 380 | //! Set null value to be return when reading null data (0=return the data)
|
---|
| 381 | inline void SetNulVal(double nulval=0.) {NulVal = nulval;}
|
---|
| 382 | //! Get the pointer to FitsOpenFile
|
---|
| 383 | inline FitsOpenFile* GetFitsOpenFile(void) const {return FitsOF;}
|
---|
| 384 | //! Get the FITS file pointer (cfistio pointer)
|
---|
| 385 | inline fitsfile* GetFitsPtr(void) const {return FitsOF->GetFitsPtr();}
|
---|
| 386 | //! Get the number of HDU in the FITS file
|
---|
| 387 | inline int NHDU(void) const
|
---|
| 388 | {if(FitsOF) return FitsOF->NHDU(); else return 0;}
|
---|
| 389 | //! Get the number of the HDU read
|
---|
| 390 | inline int HDU(void) const
|
---|
| 391 | {if(FitsOF) return FitsOF->HDU(); else return 0;}
|
---|
| 392 | //! Get the HDU type
|
---|
| 393 | inline int HDUType(void) const
|
---|
| 394 | {if(FitsOF) return FitsOF->HDUType(); else return 0;}
|
---|
| 395 | //! Get NAXIS1
|
---|
[3128] | 396 | inline LONGLONG Naxis1(void) const {return Naxis[0];}
|
---|
[3114] | 397 | //! Get NAXIS2
|
---|
[3128] | 398 | inline LONGLONG Naxis2(void) const {return Naxis[1];}
|
---|
[3114] | 399 | //! Get NAXIS3
|
---|
[3128] | 400 | inline LONGLONG Naxis3(void) const {return Naxis[2];}
|
---|
[3114] | 401 |
|
---|
| 402 | protected:
|
---|
| 403 | void Init(FitsOpenFile* fof,int ihdu,int lp);
|
---|
| 404 |
|
---|
[3128] | 405 | LONGLONG Naxis[3];
|
---|
[3114] | 406 | double NulVal;
|
---|
| 407 | unsigned short DbgLevel;
|
---|
| 408 |
|
---|
| 409 | FitsOpenFile* FitsOF;
|
---|
| 410 | };
|
---|
| 411 |
|
---|
| 412 | ///////////////////////////////////////////////////////////////////
|
---|
| 413 | //! Class for reading a 3D image from a FITS file
|
---|
| 414 | class FitsImg3DRead : public FitsImg3DRd {
|
---|
| 415 | public:
|
---|
| 416 | FitsImg3DRead(string fname,int ihdu=0,int lp=0);
|
---|
| 417 | FitsImg3DRead(const char *cfname,int ihdu=0,int lp=0);
|
---|
| 418 | FitsImg3DRead(FitsImg3DRead& fbt);
|
---|
| 419 | FitsImg3DRead();
|
---|
| 420 | virtual ~FitsImg3DRead();
|
---|
| 421 | };
|
---|
| 422 |
|
---|
[2591] | 423 | } // namespace SOPHYA
|
---|
| 424 | #endif /* FABTCOLREAD_H_SEEN */
|
---|