diff --git a/src/loadimage.cpp b/src/loadimage.cpp index 3ddfacc..e225ea4 100644 --- a/src/loadimage.cpp +++ b/src/loadimage.cpp @@ -241,18 +241,59 @@ bool loadXISF(const QString &path, ImageInfoData &info, std::shared_ptr xisfWCS; auto imageproperties = xisfImage.imageProperties(); for(auto prop : imageproperties) { info.fitsHeader.append(prop); + if(prop.id == "PCL:AstrometricSolution:ReferenceCelestialCoordinates" && prop.value.type() == LibXISF::Variant::Type::F64Vector) + { + auto val = prop.value.value(); + if(val.size() >= 2) + { + xisfWCS.append({"CRVAL1", val[0], "value from PCL:AstrometricSolution"}); + xisfWCS.append({"CRVAL2", val[1], "value from PCL:AstrometricSolution"}); + } + } + else if(prop.id == "PCL:AstrometricSolution:ReferenceImageCoordinates" && prop.value.type() == LibXISF::Variant::Type::F64Vector) + { + auto val = prop.value.value(); + if(val.size() >= 2) + { + xisfWCS.append({"CRPIX1", val[0], "value from PCL:AstrometricSolution"}); + xisfWCS.append({"CRPIX2", val[1], "value from PCL:AstrometricSolution"}); + } + } + else if(prop.id == "PCL:AstrometricSolution:LinearTransformationMatrix" && prop.value.type() == LibXISF::Variant::Type::F64Matrix) + { + auto val = prop.value.value(); + if(val.cols() >= 2 && val.rows() >= 2) + { + xisfWCS.append({"CD1_1", val(0, 0), "value from PCL:AstrometricSolution"}); + xisfWCS.append({"CD1_2", val(0, 1), "value from PCL:AstrometricSolution"}); + xisfWCS.append({"CD2_1", val(1, 0), "value from PCL:AstrometricSolution"}); + xisfWCS.append({"CD2_2", val(1, 1), "value from PCL:AstrometricSolution"}); + } + } + else if(prop.id == "PCL:AstrometricSolution:ProjectionSystem") + { + if(prop.value.toString() == "Gnomonic") + { + xisfWCS.append({"CTYPE1", "RA---TAN", "value from PCL:AstrometricSolution"}); + xisfWCS.append({"CTYPE", "DEC--TAN", "value from PCL:AstrometricSolution"}); + } + } } info.num = xisf.imagesCount(); info.index = index; - info.wcs = std::make_shared(xisfImage.width(), xisfImage.height(), info.fitsHeader); info.info.append({QObject::tr("Width"), QString::number(xisfImage.width())}); info.info.append({QObject::tr("Height"), QString::number(xisfImage.height())}); - if(!info.wcs->valid())info.wcs.reset(); + + auto wcs = std::make_shared(xisfImage.width(), xisfImage.height(), info.fitsHeader); + if(!wcs->valid() && xisfWCS.size())wcs = std::make_shared(xisfImage.width(), xisfImage.height(), xisfWCS); + if(wcs->valid())info.wcs = wcs; RawImage::DataType type; switch(xisfImage.sampleFormat())