Add readPixel param to getImage()
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.14)
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
|
||||||
project(libXISF VERSION 0.1.1 LANGUAGES CXX C)
|
project(libXISF VERSION 0.1.2 LANGUAGES CXX C)
|
||||||
|
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
set(CMAKE_AUTOUIC ON)
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
|||||||
+4
-4
@@ -404,12 +404,12 @@ bool Image::addFITSKeywordAsProperty(const QString &name, const QVariant &value)
|
|||||||
|
|
||||||
void *Image::imageData()
|
void *Image::imageData()
|
||||||
{
|
{
|
||||||
return _dataBlock.data.data();
|
return _dataBlock.data.isNull() ? nullptr : _dataBlock.data.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
const void *Image::imageData() const
|
const void *Image::imageData() const
|
||||||
{
|
{
|
||||||
return _dataBlock.data.data();
|
return _dataBlock.data.isNull() ? nullptr : _dataBlock.data.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Image::imageDataSize() const
|
size_t Image::imageDataSize() const
|
||||||
@@ -591,13 +591,13 @@ int XISFReader::imagesCount() const
|
|||||||
return _images.size();
|
return _images.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
const Image& XISFReader::getImage(uint32_t n)
|
const Image& XISFReader::getImage(uint32_t n, bool readPixels)
|
||||||
{
|
{
|
||||||
if(n >= _images.size())
|
if(n >= _images.size())
|
||||||
throw Error("Out of bounds");
|
throw Error("Out of bounds");
|
||||||
|
|
||||||
Image &img = _images[n];
|
Image &img = _images[n];
|
||||||
if(img._dataBlock.attachmentPos)
|
if(img._dataBlock.attachmentPos && readPixels)
|
||||||
{
|
{
|
||||||
_io->seek(img._dataBlock.attachmentPos);
|
_io->seek(img._dataBlock.attachmentPos);
|
||||||
img._dataBlock.decompress(_io->read(img._dataBlock.attachmentSize));
|
img._dataBlock.decompress(_io->read(img._dataBlock.attachmentSize));
|
||||||
|
|||||||
@@ -227,7 +227,11 @@ public:
|
|||||||
void close();
|
void close();
|
||||||
/** Return number of images inside file */
|
/** Return number of images inside file */
|
||||||
int imagesCount() const;
|
int imagesCount() const;
|
||||||
const Image& getImage(uint32_t n);
|
/** Return reference to Image
|
||||||
|
* @param n index of image
|
||||||
|
* @param readPixel when false it will read pixel data from file and imageData()
|
||||||
|
* will return nullptr */
|
||||||
|
const Image& getImage(uint32_t n, bool readPixels = true);
|
||||||
private:
|
private:
|
||||||
void readXISFHeader();
|
void readXISFHeader();
|
||||||
void readSignature();
|
void readSignature();
|
||||||
|
|||||||
Reference in New Issue
Block a user