Load XISF::ReadImageProperties
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
#include <wcslib/wcshdr.h>
|
#include <wcslib/wcshdr.h>
|
||||||
#include <wcslib/wcsfix.h>
|
#include <wcslib/wcsfix.h>
|
||||||
#include "pcl/FITSHeaderKeyword.h"
|
#include "pcl/FITSHeaderKeyword.h"
|
||||||
|
#include "pcl/Property.h"
|
||||||
|
|
||||||
static const QVector<QByteArray> noEditableKey = {"SIMPLE", "BITPIX", "NAXIS", "NAXIS1", "NAXIS2", "NAXIS3", "EXTEND", "BZERO", "BSCALE"};
|
static const QVector<QByteArray> noEditableKey = {"SIMPLE", "BITPIX", "NAXIS", "NAXIS1", "NAXIS2", "NAXIS3", "EXTEND", "BZERO", "BSCALE"};
|
||||||
|
|
||||||
@@ -43,6 +44,38 @@ FITSRecord::FITSRecord(const pcl::FITSHeaderKeyword &record)
|
|||||||
value = string;
|
value = string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FITSRecord::FITSRecord(const pcl::Property &property)
|
||||||
|
{
|
||||||
|
key = property.Identifier().c_str();
|
||||||
|
|
||||||
|
const pcl::Variant &pclval = property.Value();
|
||||||
|
switch(pclval.Type())
|
||||||
|
{
|
||||||
|
case pcl::VariantType::Bool:
|
||||||
|
value = pclval.ToBool();
|
||||||
|
break;
|
||||||
|
case pcl::VariantType::Int8:
|
||||||
|
case pcl::VariantType::Int16:
|
||||||
|
case pcl::VariantType::Int32:
|
||||||
|
case pcl::VariantType::Int64:
|
||||||
|
value = pclval.ToInt64();
|
||||||
|
break;
|
||||||
|
case pcl::VariantType::UInt8:
|
||||||
|
case pcl::VariantType::UInt16:
|
||||||
|
case pcl::VariantType::UInt32:
|
||||||
|
case pcl::VariantType::UInt64:
|
||||||
|
value = pclval.ToUInt64();
|
||||||
|
break;
|
||||||
|
case pcl::VariantType::Float:
|
||||||
|
case pcl::VariantType::Double:
|
||||||
|
value = pclval.ToDouble();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
value = pclval.ToIsoString().c_str();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray FITSRecord::valueToByteArray() const
|
QByteArray FITSRecord::valueToByteArray() const
|
||||||
{
|
{
|
||||||
if(value.type() == QVariant::Bool)
|
if(value.type() == QVariant::Bool)
|
||||||
|
|||||||
+2
-1
@@ -6,7 +6,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace pcl { class FITSHeaderKeyword; }
|
namespace pcl { class FITSHeaderKeyword; class Property; }
|
||||||
|
|
||||||
struct FITSRecord
|
struct FITSRecord
|
||||||
{
|
{
|
||||||
@@ -17,6 +17,7 @@ struct FITSRecord
|
|||||||
FITSRecord(){}
|
FITSRecord(){}
|
||||||
FITSRecord(const QByteArray &key, const QVariant &value, const QByteArray &comment);
|
FITSRecord(const QByteArray &key, const QVariant &value, const QByteArray &comment);
|
||||||
FITSRecord(const pcl::FITSHeaderKeyword &record);
|
FITSRecord(const pcl::FITSHeaderKeyword &record);
|
||||||
|
FITSRecord(const pcl::Property &property);
|
||||||
QByteArray valueToByteArray() const;
|
QByteArray valueToByteArray() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -349,6 +349,12 @@ bool loadXISF(const QString &path, ImageInfoData &info, RawImage **image)
|
|||||||
{
|
{
|
||||||
info.fitsHeader.append(fits);
|
info.fitsHeader.append(fits);
|
||||||
}
|
}
|
||||||
|
auto imageproperties = xisf.ReadImageProperties();
|
||||||
|
for(auto prop : imageproperties)
|
||||||
|
{
|
||||||
|
info.fitsHeader.append(prop);
|
||||||
|
}
|
||||||
|
|
||||||
info.wcs = std::make_shared<WCSData>(xisf.ImageInfo().width, xisf.ImageInfo().height, info.fitsHeader);
|
info.wcs = std::make_shared<WCSData>(xisf.ImageInfo().width, xisf.ImageInfo().height, info.fitsHeader);
|
||||||
info.info.append({QObject::tr("Width"), QString::number(xisf.ImageInfo().width)});
|
info.info.append({QObject::tr("Width"), QString::number(xisf.ImageInfo().width)});
|
||||||
info.info.append({QObject::tr("Height"), QString::number(xisf.ImageInfo().height)});
|
info.info.append({QObject::tr("Height"), QString::number(xisf.ImageInfo().height)});
|
||||||
@@ -534,6 +540,12 @@ bool readXISFHeader(const QString &path, ImageInfoData &info)
|
|||||||
{
|
{
|
||||||
info.fitsHeader.append(fits);
|
info.fitsHeader.append(fits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto imageproperties = xisf.ReadImageProperties();
|
||||||
|
for(auto prop : imageproperties)
|
||||||
|
{
|
||||||
|
info.fitsHeader.append(prop);
|
||||||
|
}
|
||||||
info.wcs = std::make_shared<WCSData>(xisf.ImageInfo().width, xisf.ImageInfo().height, info.fitsHeader);
|
info.wcs = std::make_shared<WCSData>(xisf.ImageInfo().width, xisf.ImageInfo().height, info.fitsHeader);
|
||||||
if(!info.wcs->valid())info.wcs.reset();
|
if(!info.wcs->valid())info.wcs.reset();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user