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) {
473 for (
int i = 0; i <
m_naxis; ++i) {
584 "number of bits per data pixel"));
586 "number of data axes"));
587 for (
int i = 0; i <
naxis(); ++i) {
588 std::ostringstream s_key;
589 std::ostringstream s_comment;
590 s_key <<
"NAXIS" << (i+1);
591 s_comment <<
"length of data axis " << (i+1);
596 "required keyword; must = 0"));
598 "required keyword; must = 1"));
650 for (
int i = 0; i <
m_naxis; ++i) {
675 const void* nulval,
int* anynul)
682 long* fpixel =
new long[
m_naxis];
683 long* lpixel =
new long[
m_naxis];
685 for (
int i = 0; i <
m_naxis; ++i) {
692 (
void*)nulval, (
void*)pixels, anynul, &status);
725 std::string msg =
"FITS file not open. Please open the FITS file "
726 "before saving the image.";
738 if (status == 0 && type !=
exttype()) {
758 else if (status != 0) {
784 if (
m_naxis > 0 && pixels != NULL) {
785 long* fpixel =
new long[
m_naxis];
786 long* lpixel =
new long[
m_naxis];
787 for (
int i = 0; i <
m_naxis; ++i) {
792 (
void*)pixels, &status);
850 #if defined(G_RANGE_CHECK)
879 std::string msg =
"2D pixel access operator used for image with "+
881 "the correct pixel access operator.";
886 #if defined(G_RANGE_CHECK)
887 if (ix < 0 || ix >=
m_naxes[0]) {
889 "Pixel index for first dimension",
892 if (iy < 0 || iy >=
m_naxes[1]) {
894 "Pixel index for second dimension",
923 std::string msg =
"3D pixel access operator used for image with "+
925 "the correct pixel access operator.";
930 #if defined(G_RANGE_CHECK)
931 if (ix < 0 || ix >=
m_naxes[0]) {
933 "Pixel index for first dimension",
936 if (iy < 0 || iy >=
m_naxes[1]) {
938 "Pixel index for second dimension",
941 if (iz < 0 || iz >=
m_naxes[2]) {
943 "Pixel index for third dimension",
974 std::string msg =
"4D pixel access operator used for image with "+
976 "the correct pixel access operator.";
981 #if defined(G_RANGE_CHECK)
982 if (ix < 0 || ix >=
m_naxes[0]) {
984 "Pixel index for first dimension",
987 if (iy < 0 || iy >=
m_naxes[1]) {
989 "Pixel index for second dimension",
992 if (iz < 0 || iz >=
m_naxes[2]) {
994 "Pixel index for third dimension",
997 if (it < 0 || it >=
m_naxes[3]) {
999 "Pixel index for third dimension",
const int & bitpix(void) const
Return number of Bits per pixel (negative=floating point)
#define __ffghsp(A, B, C, D)
Abstract FITS image base class.
#define __ffdhdu(A, B, C)
int offset(const int &ix) const
Return pixel offset.
const int & naxis(void) const
Return dimension of image.
void open_image(void *vptr)
Open Image.
std::string print_hdu(const GChatter &chatter=NORMAL) const
Print basic HDU information.
#define __ffpss(A, B, C, D, E, F)
Abstract FITS extension base class.
void data_close(void)
Close FITS image.
void move_to_hdu(void)
Move FITS file pointer to HDU.
void data_open(void *vptr)
Open FITS image.
virtual void * ptr_nulval(void)=0
virtual void init_data(void)=0
void * m_fitsfile
FITS file pointer pointing on actual HDU.
#define __ffiimg(A, B, C, D, E)
#define __ffcrim(A, B, C, D, E)
FITS file class interface definition.
virtual void alloc_nulval(const void *value)=0
virtual void alloc_data(void)=0
Abstract FITS image base class definition.
GFitsHDU & operator=(const GFitsHDU &hdu)
Assignment operator.
int m_num_pixels
Number of image pixels.
void save_image(int datatype, const void *pixels)
Save FITS image.
void data_save(void)
Save FITS image.
#define __ffrsim(A, B, C, D, E)
void init_image_header(void)
Initialise image header.
long * m_naxes
Number of pixels in each dimension.
#define __ffmahd(A, B, C, D)
virtual void * pixels(void)=0
CFITSIO interface header.
virtual int type(void) const =0
void data_connect(void *vptr)
Connect FITS image.
const void * nulval(void) const
Return nul value.
GFitsImage(void)
Void constructor.
#define __ffgsv(A, B, C, D, E, F, G, H, I)
#define __ffgisz(A, B, C, D)
int m_anynul
Number of NULLs encountered.
void fetch_data(void)
Fetch image pixels.
GFitsHeader m_header
HDU header.
void init_members(void)
Initialise class members.
int m_naxis
Image dimension.
int naxes(const int &axis) const
Return dimension of an image axis.
std::string print(const GChatter &chatter=NORMAL) const
Print column information.
std::string typecode(int type) const
Return typecode as string.
virtual ~GFitsImage(void)
Destructor.
const int & npix(void) const
Return size of pixel array.
GChatter reduce(const GChatter &chatter)
Reduce chattiness by one level.
void copy_members(const GFitsImage &image)
Copy class members.
int m_bitpix
Number of Bits/pixel.
#define __ffgidm(A, B, C)
Exception handler interface definition.
void load_image(int datatype, const void *pixels, const void *nulval, int *anynul)
Load FITS image.
GFitsImage & operator=(const GFitsImage &image)
Assignment operator.
int fits_move_to_hdu(const std::string &caller, void *vptr, const int &hdunum=0)
Move to FITS extension.
virtual void * ptr_data(void)=0
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
HDUType exttype(void) const
Return extension type.
int m_hdunum
HDU number (starting from 0)
void free_members(void)
Delete class members.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.