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