Luiza
v03-01
|
Class for reading and processing fits images in Luiza. More...
#include <GloriaFitsImage.h>
Public Member Functions | |
GloriaFitsImage () | |
Default constructor. More... | |
GloriaFitsImage (std::string FitsFileName) | |
Constructor based on reading fits file. | |
GloriaFitsImage (const GloriaFitsImage &sourceFitsImage) | |
Copy constructor. | |
GloriaFitsImage (int NpixelX, int NpixelY, bool useFloatPixels=true) | |
Constructor allocating 2D image of given size and type. More... | |
~GloriaFitsImage () | |
Destructor. | |
void | ReadFitsFile (std::string FitsFileName) |
Read fits image from file to the existing structure. More... | |
void | WriteFitsFile (std::string FitsFileName, int cBitPix=0, int cBZero=0, double cBScale=1.0) |
Write image to fits file. More... | |
GloriaFitsImage & | operator+= (const long shift) |
Shift values of all pixels by given value. More... | |
GloriaFitsImage & | operator+= (const double shift) |
Shift values of all pixels by given value. More... | |
GloriaFitsImage & | operator+= (const GloriaFitsImage &img) |
Add an image. More... | |
GloriaFitsImage & | operator-= (const GloriaFitsImage &img) |
Subtract an image. More... | |
GloriaFitsImage & | operator*= (const long fac) |
Scale values of all pixels by given value. More... | |
GloriaFitsImage & | operator*= (const double fac) |
Scale values of all pixels by given value. More... | |
GloriaFitsImage & | operator*= (const GloriaFitsImage &img) |
Multiply by image. More... | |
GloriaFitsImage & | operator/= (const GloriaFitsImage &img) |
Divide by image. More... | |
int | SizeX () const |
Returns size of image in X. | |
int | SizeY () const |
Returns size of image in Y. | |
int | PixelBits () const |
Returns number of bits per pixel. More... | |
bool | IsIntImage () const |
Returns true if image contains integer pixel values (long) | |
bool | IsFloatImage () const |
Returns true if image contains floating point pixel values (double) | |
long * | GetIntImageData () const |
Returns pointer to the array of integer pixel values. | |
double * | GetFloatImageData () const |
Returns pointer to the array of floating point pixel values. | |
void | ConvertToFloat () |
Convert image pixels to floating point numbers. More... | |
void | ConvertToInt () |
Convert image pixels to integer numbers. More... | |
Public Member Functions inherited from gloria::GloriaFitsHeader | |
GloriaFitsHeader () | |
Constructor. | |
virtual | ~GloriaFitsHeader () |
Destructor. | |
void | ReadFitsHeader (fitsfile *fp) |
Read fits header from file. More... | |
void | WriteFitsHeader (fitsfile *fp) |
Write header to fits file. More... | |
int | GetKeywordNumber () |
Number of records defined in the header. | |
HeaderRecord & | GetRecordAt (const int ikey) |
Access header record by record index. | |
std::string & | GetKeywordAt (const int ikey) |
Access header keyword by record index. | |
std::string & | GetValueAt (const int ikey) |
Access header value (string) by record index. | |
std::string & | GetCommentAt (const int ikey) |
Access header comment by record index. | |
bool | IsKeywordSet (const char *keyword) |
Check if given keyword is set in the header. | |
HeaderRecord & | GetKeywordRecord (const char *keyword) |
Access header record by record index. | |
std::string & | GetKeywordValue (const char *keyword) |
Access header value (string) by keyword. | |
long | GetKeywordValueInt (const char *keyword) |
Access header value (long int) by keyword. | |
double | GetKeywordValueDouble (const char *keyword) |
Access header value (double) by keyword. | |
void | AddKeyword (const char *keyword, std::string value, std::string comment) |
Add new keyword to the fits header. | |
void | AddKeywordDouble (const char *keyword, double value, std::string comment) |
Add new keyword to the fits header, as double. | |
void | AddKeywordInt (const char *keyword, int value, std::string comment) |
Add new keyword to the fits header, as int. | |
void | AddKeyword (HeaderRecord record) |
Add new keyword record to the fits header. | |
void | SetKeyword (const char *keyword, std::string value, std::string comment) |
Set new value for the existing keyword. Add it if not present. | |
void | SetKeywordDouble (const char *keyword, double value, std::string comment) |
Set new value for the existing keyword as double. Add it if not present. | |
void | SetKeywordInt (const char *keyword, int value, std::string comment) |
Set new value for the existing keyword as int. Add it if not present. | |
void | AddComment (std::string comment) |
Add comment to the header. | |
void | AddHistory (std::string history) |
Add history to the header. | |
void | RemoveKeyword (const char *keyword) |
Remove given keyword from header. More... | |
void | RemoveKeywords (const char *keyword) |
Remove given keyword from header. More... | |
void | CopyHeader (GloriaFitsHeader *source) |
Copy full header from given data object (table or image);. | |
void | PrintHeader (std::ostream &os, int maxRec=100) |
Print FITS header to output stream. Use maxRec=0 to print all records. | |
bool | OK () |
Method returning true if processing was successful. | |
bool | Error () |
Method returning true if there was an error in data processing. | |
std::string | ErrorMessage () |
Returns error message string. | |
void | ClearError () |
Method returning true if there was an error in data processing. | |
std::string | InputFileName () |
void | SetInputFileName (string name) |
std::string | OutputFileName () |
Class for reading and processing fits images in Luiza.
This class allows to read the fits image from file and process it in memory, without need to have the file opened. Virtual fits can be created (not stored on file) to pass images between processors. Current implementation allows simple 2D fits only.
Two kinds of images are possible in general, containing integer or floating point pixel values. To avoid possible information loss more precise types were selected i.e. long for integer pixels and double for floating point pixels. So the image data is stored either in long or double array. This has to be respected when addressing the image content directly (with GloriaFitsImage::GetIntImageData() or GloriaFitsImage::GetFloatImageData() method).
GloriaFitsImage::GloriaFitsImage | ( | ) |
Default constructor.
Default constructor does not allocate any space for storing pixel values.
GloriaFitsImage::GloriaFitsImage | ( | int | NpixelX, |
int | NpixelY, | ||
bool | useFloatPixels = true |
||
) |
Constructor allocating 2D image of given size and type.
The double or long array will be allocated to store image pixel values by default, depending on useFloatPixels parameter.
void GloriaFitsImage::ConvertToFloat | ( | ) |
Convert image pixels to floating point numbers.
Memory allocated for int pixels is released after copying. Returns without error if pixels are already of floating type
Referenced by luiza::AstroImageAdder::processData().
void GloriaFitsImage::ConvertToInt | ( | ) |
Convert image pixels to integer numbers.
Memory allocated for floating point pixels is released after copying. Returns without error if pixels are already of integer type
GloriaFitsImage & GloriaFitsImage::operator*= | ( | const long | fac | ) |
Scale values of all pixels by given value.
Image pixel type is not changed
GloriaFitsImage & GloriaFitsImage::operator*= | ( | const double | fac | ) |
Scale values of all pixels by given value.
If image contains integer pixel values, they are converted to floating point numbers.
GloriaFitsImage & GloriaFitsImage::operator*= | ( | const GloriaFitsImage & | img | ) |
Multiply by image.
If one of images contains integer pixel values, result contains floating point numbers. Image is unchanged if sizes differ.
GloriaFitsImage & GloriaFitsImage::operator+= | ( | const long | shift | ) |
Shift values of all pixels by given value.
Image pixel type is not changed
GloriaFitsImage & GloriaFitsImage::operator+= | ( | const double | shift | ) |
Shift values of all pixels by given value.
If image contains integer pixel values, they are converted to floating point numbers
GloriaFitsImage & GloriaFitsImage::operator+= | ( | const GloriaFitsImage & | img | ) |
Add an image.
If one of images contains integer pixel values, result contains floating point numbers. Image is unchanged if sizes differ.
GloriaFitsImage & GloriaFitsImage::operator-= | ( | const GloriaFitsImage & | img | ) |
Subtract an image.
If one of images contains integer pixel values, result contains floating point numbers. Image is unchanged if sizes differ.
GloriaFitsImage & GloriaFitsImage::operator/= | ( | const GloriaFitsImage & | img | ) |
Divide by image.
If one of images contains integer pixel values, result contains floating point numbers. Image is unchanged if sizes differ.
|
inline |
Returns number of bits per pixel.
For floating point pixel values negative value is returned (-64 for double)
void GloriaFitsImage::ReadFitsFile | ( | std::string | FitsFileName | ) |
Read fits image from file to the existing structure.
Header and Image are read from file and put into existing structure. If image size or type is changed, new array will be allocated to store pixel values. Old header and data are lost.
Referenced by luiza::FitsImageReader::processData(), and luiza::PiTableReader::processData().
void GloriaFitsImage::WriteFitsFile | ( | std::string | FitsFileName, |
int | cBitPix = 0 , |
||
int | cBZero = 0 , |
||
double | cBScale = 1.0 |
||
) |
Write image to fits file.
Header compliant with FITS standard is created cBitPix, cBScale and cBZero parameters, which should be set accordingly to the FITS specifications, decide how the image is stored. Following values are accepted for cBitPix
If cBitPix is set to 0 image is stored in its current format (which is either long or double).
Referenced by luiza::FitsImageWriter::processImages().