[471] | 1 | #ifndef FITSIOSERVER_SEEN
|
---|
| 2 | #define FITSIOSERVER_SEEN
|
---|
| 3 |
|
---|
[663] | 4 | #include "machdefs.h"
|
---|
[471] | 5 | #include "tvector.h"
|
---|
| 6 | #include "sphericalmap.h"
|
---|
[838] | 7 | #include "spherehealpix.h"
|
---|
[471] | 8 | #include "localmap.h"
|
---|
[477] | 9 | #include "ntuple.h"
|
---|
[838] | 10 | //#include "outilsinit.h"
|
---|
[477] | 11 | #include "cimage.h"
|
---|
[471] | 12 | #include "dvlist.h"
|
---|
[689] | 13 | #include "anydataobj.h"
|
---|
[838] | 14 | #include "FitsIO/fitsio.h"
|
---|
[663] | 15 |
|
---|
[477] | 16 | #define LEN_KEYWORD 9
|
---|
| 17 |
|
---|
[471] | 18 | class FitsIoServer
|
---|
| 19 | {
|
---|
[477] | 20 |
|
---|
[471] | 21 | public :
|
---|
| 22 |
|
---|
[689] | 23 | FitsIoServer() : FITS_tab_typ_(0),i_4tab_(NULL),r_4tab_(NULL),r_8tab_(NULL)
|
---|
| 24 | {;}
|
---|
[695] | 25 | virtual ~FitsIoServer()
|
---|
[477] | 26 | {
|
---|
| 27 | if (i_4tab_ != NULL) delete [] i_4tab_;
|
---|
[488] | 28 | if (r_4tab_ != NULL) delete [] r_4tab_;
|
---|
| 29 | if (r_8tab_ != NULL) delete [] r_8tab_;
|
---|
[477] | 30 | }
|
---|
| 31 |
|
---|
[482] | 32 | void load(TMatrix<double>& mat, char flnm[]);
|
---|
[605] | 33 | void load(TMatrix<float>& mat, char flnm[]);
|
---|
| 34 | void load(TMatrix<int_4>& mat, char flnm[]);
|
---|
[482] | 35 | void load(NTuple& ntpl,char flnm[],int hdunum);
|
---|
[477] | 36 | void load(SphericalMap<double>& sph, char flnm[]);
|
---|
| 37 | void load(SphericalMap<float>& sph, char flnm[]);
|
---|
| 38 | void load(LocalMap<double>& sph, char flnm[]);
|
---|
[482] | 39 | void load(ImageR4& DpcImg,char flnm[]);
|
---|
| 40 | void load(ImageI4& DpcImg,char flnm[]);
|
---|
[838] | 41 | void load(SphereHealpix<float>& sph, char flnm[], int nth=1);
|
---|
| 42 | void load(SphereHealpix<double>& sph, char flnm[], int nth=1);
|
---|
| 43 | void load(SphereHealpix<double>& sph1,SphereHealpix<double>& sph2,SphereHealpix<double>& sph3, char filename[]);
|
---|
| 44 | void load(SphereHealpix<float>& sph1,SphereHealpix<float>& sph2,SphereHealpix<float>& sph3, char filename[]);
|
---|
[482] | 45 | void save(TMatrix<double>& mat, char flnm[]);
|
---|
[605] | 46 | void save(TMatrix<float>& mat, char flnm[]);
|
---|
| 47 | void save(TMatrix<int_4>& mat, char flnm[]);
|
---|
[482] | 48 | void save(NTuple& ntpl,char flnm[]);
|
---|
[477] | 49 | void save(SphericalMap<double>& sph, char flnm[]);
|
---|
| 50 | void save(SphericalMap<float>& sph, char flnm[]);
|
---|
[838] | 51 |
|
---|
| 52 | // nth : numero d'ordre de la sphere sur le fichier de sauvegarde
|
---|
| 53 | // si on veut sauver une seule sphere : nth=1
|
---|
| 54 | // so veut sauver par exemple 3 spheres, on appelle 3 fois save
|
---|
| 55 | // avec respectivement nth=1, 2, 3
|
---|
| 56 | void save(SphereHealpix<float>& sph, char filename[], int nth=1);
|
---|
| 57 | void save(SphereHealpix<double>& sph, char filename[], int nth=1);
|
---|
| 58 |
|
---|
| 59 | void save(SphereHealpix<double>& sph1,SphereHealpix<double>& sph2,SphereHealpix<double>& sph3, char filename[]);
|
---|
| 60 | void save(SphereHealpix<float>& sph1,SphereHealpix<float>& sph2,SphereHealpix<float>& sph3, char filename[]);
|
---|
| 61 | void save(const LocalMap<double>& locm, char flnm[]);
|
---|
[488] | 62 | void save(const ImageR4& DpcImg,char flnm[]);
|
---|
| 63 | void save(const ImageI4& DpcImg,char flnm[]);
|
---|
[477] | 64 | void sinus_picture_projection(SphericalMap<double>& sph, char flnm[]);
|
---|
| 65 | void sinus_picture_projection(SphericalMap<float>& sph, char flnm[]);
|
---|
[564] | 66 | void Mollweide_picture_projection(SphericalMap<float>& sph, char flnm[]);
|
---|
[603] | 67 | void Mollweide_picture_projection(SphericalMap<double>& sph, char flnm[]);
|
---|
[477] | 68 | void picture(LocalMap<double>& lcm, char flnm[]);
|
---|
| 69 | void readheader(char flnm[]);
|
---|
| 70 |
|
---|
[689] | 71 | virtual AnyDataObj* loadobj(char flnm[],int hdunum = 1);
|
---|
| 72 |
|
---|
[477] | 73 | private :
|
---|
| 74 |
|
---|
| 75 | // creer, ecrire une imageformat FITS, a partir des tableaux de donnees
|
---|
| 76 | // dtab_, ftab_ prealablement remplis
|
---|
[689] | 77 | void planck_write_img(char flnm[],int naxis,int n1,int n2,int n3,DVList &dvl);
|
---|
[477] | 78 |
|
---|
[689] | 79 | void planck_read_img(char flnm[],int &naxis,int &n1,int &n2,int &n3,DVList &dvl);
|
---|
[838] | 80 | void planck_read_bntbl(char flnm[], int hdunum, int& npixels, DVList& dvl,int tfields=1);
|
---|
| 81 | void planck_write_bntbl(char flnm[], int npixels, char typeOfContent[], char extname[], char comment1[], DVList& dvl, int tfields=1, int nth=1);
|
---|
[477] | 82 | void write_picture(long* naxes,float* map,char* filename) const;
|
---|
| 83 |
|
---|
[603] | 84 | void printerror(int& status) const;
|
---|
| 85 | void printerror(int& status, char* texte) const;
|
---|
[477] | 86 | bool check_keyword(fitsfile*,int,char keyword[]);
|
---|
| 87 |
|
---|
| 88 | inline int key_type_PL2FITS(char typ)
|
---|
| 89 | {
|
---|
| 90 | switch (typ)
|
---|
| 91 | {
|
---|
| 92 | case 'I' :
|
---|
| 93 | return TINT;
|
---|
| 94 | case 'D' :
|
---|
| 95 | return TDOUBLE;
|
---|
| 96 | case 'S' :
|
---|
| 97 | return TSTRING;
|
---|
| 98 | default :
|
---|
| 99 | cout << " FITSIOSERVER : type de donnee non prevu " << endl;
|
---|
| 100 | return 0;
|
---|
| 101 | }
|
---|
| 102 | }
|
---|
| 103 |
|
---|
| 104 | int FITS_tab_typ_;
|
---|
[479] | 105 | int_4* i_4tab_;
|
---|
[488] | 106 | r_4* r_4tab_;
|
---|
| 107 | r_8* r_8tab_;
|
---|
[471] | 108 | };
|
---|
[477] | 109 |
|
---|
[471] | 110 | #endif
|
---|
| 111 |
|
---|
| 112 |
|
---|
| 113 |
|
---|