diff --git a/loadrunable.cpp b/loadrunable.cpp index a12204e..cb26f12 100644 --- a/loadrunable.cpp +++ b/loadrunable.cpp @@ -192,19 +192,20 @@ bool loadFITS(const QString path, ImageInfoData &info, std::shared_ptr 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 if(image) image->convertToGLFormat(); + + break; } } noload: