38#define G_NAXES "GFitsImage::naxes(int)"
39#define G_OPEN_IMAGE "GFitsImage::open(void*)"
40#define G_LOAD_IMAGE "GFitsImage::load_image(int,void*,void*,int*)"
41#define G_SAVE_IMAGE "GFitsImage::save_image(int,void*)"
42#define G_OFFSET_1D "GFitsImage::offset(int&)"
43#define G_OFFSET_2D "GFitsImage::offset(int&,int&)"
44#define G_OFFSET_3D "GFitsImage::offset(int&,int&,int&)"
45#define G_OFFSET_4D "GFitsImage::offset(int&,int&,int&,int&)"
196 const int& nz,
const int& nt) :
GFitsHDU()
249 for (
int i = 0; i <
m_naxis; ++i) {
309 if (
this != &image) {
347 #if defined(G_RANGE_CHECK)
348 if (axis < 0 || axis >=
naxis()) {
404 result.append(
"=== GFitsImage ===");
416 for (
int i = 0; i <
naxis(); ++i) {
481 for (
int i = 0; i <
m_naxis; ++i) {
592 "number of bits per data pixel"));
594 "number of data axes"));
595 for (
int i = 0; i <
naxis(); ++i) {
596 std::ostringstream s_key;
597 std::ostringstream s_comment;
598 s_key <<
"NAXIS" << (i+1);
599 s_comment <<
"length of data axis " << (i+1);
604 "required keyword; must = 0"));
606 "required keyword; must = 1"));
658 for (
int i = 0; i <
m_naxis; ++i) {
715 long* fpixel =
new long[
m_naxis];
716 long* lpixel =
new long[
m_naxis];
718 for (
int i = 0; i <
m_naxis; ++i) {
758 std::string msg =
"FITS file not open. Please open the FITS file "
759 "before saving the image.";
791 else if (status != 0) {
818 long* fpixel =
new long[
m_naxis];
819 long* lpixel =
new long[
m_naxis];
820 for (
int i = 0; i <
m_naxis; ++i) {
883 #if defined(G_RANGE_CHECK)
912 std::string msg =
"2D pixel access operator used for image with "+
914 "the correct pixel access operator.";
919 #if defined(G_RANGE_CHECK)
920 if (ix < 0 || ix >=
m_naxes[0]) {
922 "Pixel index for first dimension",
925 if (iy < 0 || iy >=
m_naxes[1]) {
927 "Pixel index for second dimension",
956 std::string msg =
"3D pixel access operator used for image with "+
958 "the correct pixel access operator.";
963 #if defined(G_RANGE_CHECK)
964 if (ix < 0 || ix >=
m_naxes[0]) {
966 "Pixel index for first dimension",
969 if (iy < 0 || iy >=
m_naxes[1]) {
971 "Pixel index for second dimension",
974 if (iz < 0 || iz >=
m_naxes[2]) {
976 "Pixel index for third dimension",
1003 const int& it)
const
1007 std::string msg =
"4D pixel access operator used for image with "+
1009 "the correct pixel access operator.";
1014 #if defined(G_RANGE_CHECK)
1015 if (ix < 0 || ix >=
m_naxes[0]) {
1017 "Pixel index for first dimension",
1020 if (iy < 0 || iy >=
m_naxes[1]) {
1022 "Pixel index for second dimension",
1025 if (iz < 0 || iz >=
m_naxes[2]) {
1027 "Pixel index for third dimension",
1030 if (it < 0 || it >=
m_naxes[3]) {
1032 "Pixel index for third dimension",
Exception handler interface definition.
CFITSIO interface header.
#define __ffpscl(A, B, C, D)
#define __ffpss(A, B, C, D, E, F)
#define __ffrsim(A, B, C, D, E)
#define __ffiimg(A, B, C, D, E)
#define __ffgisz(A, B, C, D)
#define __ffghsp(A, B, C, D)
#define __ffmahd(A, B, C, D)
#define __ffgidm(A, B, C)
#define __ffdhdu(A, B, C)
#define __ffcrim(A, B, C, D, E)
#define __ffgsv(A, B, C, D, E, F, G, H, I)
Abstract FITS image base class definition.
FITS file class interface definition.
Abstract FITS extension base class.
bool has_card(const int &cardno) const
Check existence of header card.
GFitsHeader m_header
HDU header.
GFitsHDU & operator=(const GFitsHDU &hdu)
Assignment operator.
void * m_fitsfile
FITS file pointer pointing on actual HDU.
int m_hdunum
HDU number (starting from 0)
void move_to_hdu(void)
Move FITS file pointer to HDU.
double real(const std::string &keyname) const
Return card value as double precision.
std::string typecode(int type) const
Return typecode as string.
std::string print_hdu(const GChatter &chatter=NORMAL) const
Print basic HDU information.
Abstract FITS image base class.
void open_image(void *vptr)
Open Image.
virtual void init_data(void)=0
virtual void * ptr_nulval(void)=0
int m_naxis
Image dimension.
double m_bscale
Scaling for integer pixels.
int naxes(const int &axis) const
Return dimension of an image axis.
const int & bitpix(void) const
Return number of Bits per pixel (negative=floating point)
int offset(const int &ix) const
Return pixel offset.
void free_members(void)
Delete class members.
const int & npix(void) const
Return size of pixel array.
void load_image(int datatype, const void *pixels, const void *nulval, int *anynul)
Load FITS image.
void fetch_data(void)
Fetch image pixels.
long * m_naxes
Number of pixels in each dimension.
const int & naxis(void) const
Return dimension of image.
double m_bzero
Offset for integer pixels.
HDUType exttype(void) const
Return extension type.
virtual void alloc_nulval(const void *value)=0
void data_save(void)
Save FITS image.
void save_image(int datatype, const void *pixels)
Save FITS image.
int m_bitpix
Number of Bits/pixel.
void copy_members(const GFitsImage &image)
Copy class members.
int m_num_pixels
Number of image pixels.
void init_image_header(void)
Initialise image header.
std::string print(const GChatter &chatter=NORMAL) const
Print column information.
void data_open(void *vptr)
Open FITS image.
GFitsImage & operator=(const GFitsImage &image)
Assignment operator.
const int & anynul(void) const
Return number of nul values encountered during loading.
virtual void * ptr_data(void)=0
void data_connect(void *vptr)
Connect FITS image.
GFitsImage(void)
Void constructor.
virtual void alloc_data(void)=0
const void * nulval(void) const
Return nul value.
virtual void * pixels(void)=0
int m_anynul
Number of NULLs encountered.
virtual int type(void) const =0
void data_close(void)
Close FITS image.
virtual ~GFitsImage(void)
Destructor.
void init_members(void)
Initialise class members.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
int fits_move_to_hdu(const std::string &caller, void *vptr, const int &hdunum=0)
Move to FITS extension.
GChatter reduce(const GChatter &chatter)
Reduce chattiness by one level.