Skip dummy HDU in compressed FITS

This commit is contained in:
2024-03-25 22:53:51 +01:00
parent bbc13ec8a5
commit 174134a9ee
+11 -8
View File
@@ -192,19 +192,20 @@ bool loadFITS(const QString path, ImageInfoData &info, std::shared_ptr<RawImage>
int status = 0;
int type = -1;
fits_open_diskfile(&file, path.toLocal8Bit().data(), READONLY, &status);
int hudtype = IMAGE_HDU;
fits_movabs_hdu(file, 1, &hudtype, &status);
fits_get_hdu_type(file, &type, &status);
int num = 0;
fits_get_num_hdus(file, &num, &status);
if(type == IMAGE_HDU)
int imgtype;
int naxis;
long naxes[3] = {0};
for(int i=1; i <= num; i++)
{
int imgtype;
int naxis;
long naxes[3] = {0};
fits_movabs_hdu(file, i, IMAGE_HDU, &status);
fits_get_hdu_type(file, &type, &status);
fits_get_img_param(file, 3, &imgtype, &naxis, naxes, &status);
fits_get_img_equivtype(file, &imgtype, &status);
if(naxis >= 2 && naxis <= 3 && status == 0)
if(type == IMAGE_HDU && naxis >= 2 && naxis <= 3 && status == 0)
{
RawImage::DataType type;
int fitstype;
@@ -270,6 +271,8 @@ bool loadFITS(const QString path, ImageInfoData &info, std::shared_ptr<RawImage>
if(image)
image->convertToGLFormat();
break;
}
}
noload: