Luiza  v03-01
GloriaFitsImage.h
1 // -*- mode: c++; mode: auto-fill; mode: flyspell-prog; -*-
2 
3 
4 #ifndef GloriaFitsImage_h
5 #define GloriaFitsImage_h 1
6 
7 
8 /*
9  * This source code is part of the LUIZA software package for GLORIA.
10  * You are free to use this source files for your own development as
11  * long as it stays in a public research context. You are not
12  * allowed to use it for commercial purpose. You must put this
13  * header with author names in all development based on this file.
14  *
15  */
16 
17 #include <string>
18 #include <vector>
19 #include <map>
20 
21 #include "GloriaFitsHeader.h"
22 
23 namespace gloria{
24 
26 
44 
45  public:
46 
48 
52 
54  /* Creates image and reads its contents from the fits file */
55  GloriaFitsImage(std::string FitsFileName);
56 
58  GloriaFitsImage(const GloriaFitsImage& sourceFitsImage);
59 
60 
62 
66  GloriaFitsImage(int NpixelX, int NpixelY, bool useFloatPixels=true);
67 
68 
71 
72 
74 
78  void ReadFitsFile(std::string FitsFileName);
79 
81 
99  void WriteFitsFile(std::string FitsFileName, int cBitPix=0, int cBZero=0, double cBScale=1.0);
100 
101 
103 
104  GloriaFitsImage& operator+=(const long shift);
105 
106 
108 
111  GloriaFitsImage& operator+=(const double shift);
112 
113 
115 
119 
120 
122 
126 
127 
129 
130  GloriaFitsImage& operator*=(const long fac);
131 
132 
134 
137  GloriaFitsImage& operator*=(const double fac);
138 
139 
141 
145 
146 
148 
152 
153 
154  // Data access methods
155  // ===================
156 
158  inline int SizeX() const { return _sizeX; };
159 
161  inline int SizeY() const { return _sizeY; };
162 
164 
167  inline int PixelBits() const { return _bitsPerPixel; };
168 
170  inline bool IsIntImage() const {return _isIntImage; };
171 
173  inline bool IsFloatImage() const {return _isFloatImage; };
174 
176  inline long* GetIntImageData() const {return _intPixels; };
177 
179  inline double* GetFloatImageData() const {return _floatPixels; };
180 
181 
183 
186  void ConvertToFloat();
187 
188 
190 
193  void ConvertToInt();
194 
195 
196 
197 private:
198 
199  void InitializeEmptyImage();
200  void AllocateMemory(int NpixelX, int NpixelY, bool useFloatPixels=true);
201  void ReleaseMemory();
202 
204  int _sizeX, _sizeY;
205 
207  int _bitsPerPixel;
208 
210  bool _isIntImage;
211  long* _intPixels;
212 
213  bool _isFloatImage;
214  double* _floatPixels;
215 
216  } ;
217 
218 
219 }
220 
221 #endif
222 
223 
224 
int SizeY() const
Returns size of image in Y.
Definition: GloriaFitsImage.h:161
namespace for data storing and exchange formats
Definition: GloriaAstrometry.h:15
int SizeX() const
Returns size of image in X.
Definition: GloriaFitsImage.h:158
GloriaFitsImage & operator+=(const long shift)
Shift values of all pixels by given value.
Definition: GloriaFitsImage.cc:336
void ConvertToInt()
Convert image pixels to integer numbers.
Definition: GloriaFitsImage.cc:316
long * GetIntImageData() const
Returns pointer to the array of integer pixel values.
Definition: GloriaFitsImage.h:176
void ReadFitsFile(std::string FitsFileName)
Read fits image from file to the existing structure.
Definition: GloriaFitsImage.cc:195
int PixelBits() const
Returns number of bits per pixel.
Definition: GloriaFitsImage.h:167
void ConvertToFloat()
Convert image pixels to floating point numbers.
Definition: GloriaFitsImage.cc:297
void WriteFitsFile(std::string FitsFileName, int cBitPix=0, int cBZero=0, double cBScale=1.0)
Write image to fits file.
Definition: GloriaFitsImage.cc:571
GloriaFitsImage()
Default constructor.
Definition: GloriaFitsImage.cc:119
GloriaFitsImage & operator-=(const GloriaFitsImage &img)
Subtract an image.
Definition: GloriaFitsImage.cc:447
GloriaFitsImage & operator/=(const GloriaFitsImage &img)
Divide by image.
Definition: GloriaFitsImage.cc:523
Class for reading and processing fits images in Luiza.
Definition: GloriaFitsImage.h:43
~GloriaFitsImage()
Destructor.
Definition: GloriaFitsImage.cc:127
Class for handling fits file headers.
Definition: GloriaFitsHeader.h:33
bool IsFloatImage() const
Returns true if image contains floating point pixel values (double)
Definition: GloriaFitsImage.h:173
GloriaFitsImage & operator*=(const long fac)
Scale values of all pixels by given value.
Definition: GloriaFitsImage.cc:372
double * GetFloatImageData() const
Returns pointer to the array of floating point pixel values.
Definition: GloriaFitsImage.h:179
bool IsIntImage() const
Returns true if image contains integer pixel values (long)
Definition: GloriaFitsImage.h:170