PCL
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
XISF.h
Go to the documentation of this file.
1 // ____ ______ __
2 // / __ \ / ____// /
3 // / /_/ // / / /
4 // / ____// /___ / /___ PixInsight Class Library
5 // /_/ \____//_____/ PCL 2.9.3
6 // ----------------------------------------------------------------------------
7 // pcl/XISF.h - Released 2025-02-21T12:13:32Z
8 // ----------------------------------------------------------------------------
9 // This file is part of the PixInsight Class Library (PCL).
10 // PCL is a multiplatform C++ framework for development of PixInsight modules.
11 //
12 // Copyright (c) 2003-2025 Pleiades Astrophoto S.L. All Rights Reserved.
13 //
14 // Redistribution and use in both source and binary forms, with or without
15 // modification, is permitted provided that the following conditions are met:
16 //
17 // 1. All redistributions of source code must retain the above copyright
18 // notice, this list of conditions and the following disclaimer.
19 //
20 // 2. All redistributions in binary form must reproduce the above copyright
21 // notice, this list of conditions and the following disclaimer in the
22 // documentation and/or other materials provided with the distribution.
23 //
24 // 3. Neither the names "PixInsight" and "Pleiades Astrophoto", nor the names
25 // of their contributors, may be used to endorse or promote products derived
26 // from this software without specific prior written permission. For written
27 // permission, please contact info@pixinsight.com.
28 //
29 // 4. All products derived from this software, in any form whatsoever, must
30 // reproduce the following acknowledgment in the end-user documentation
31 // and/or other materials provided with the product:
32 //
33 // "This product is based on software from the PixInsight project, developed
34 // by Pleiades Astrophoto and its contributors (https://pixinsight.com/)."
35 //
36 // Alternatively, if that is where third-party acknowledgments normally
37 // appear, this acknowledgment must be reproduced in the product itself.
38 //
39 // THIS SOFTWARE IS PROVIDED BY PLEIADES ASTROPHOTO AND ITS CONTRIBUTORS
40 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
41 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PLEIADES ASTROPHOTO OR ITS
43 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
44 // EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, BUSINESS
45 // INTERRUPTION; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; AND LOSS OF USE,
46 // DATA OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
49 // POSSIBILITY OF SUCH DAMAGE.
50 // ----------------------------------------------------------------------------
51 
52 #ifndef __PCL_XISF_h
53 #define __PCL_XISF_h
54 
56 
57 #include <pcl/Defs.h>
58 
59 #include <pcl/AutoPointer.h>
60 #include <pcl/ColorFilterArray.h>
61 #include <pcl/DisplayFunction.h>
62 #include <pcl/FITSHeaderKeyword.h>
63 #include <pcl/ICCProfile.h>
64 #include <pcl/Image.h>
65 #include <pcl/ImageInfo.h>
66 #include <pcl/ImageOptions.h>
67 #include <pcl/Property.h>
68 #include <pcl/XML.h>
69 
70 namespace pcl
71 {
72 
73 // ----------------------------------------------------------------------------
74 
101 // ----------------------------------------------------------------------------
102 
103 class XISFReaderEngine;
104 class XISFWriterEngine;
105 
106 class PCL_CLASS Compression;
107 class PCL_CLASS CryptographicHash;
108 
109 // ----------------------------------------------------------------------------
110 
125 namespace XISFChecksum
126 {
127  enum value_type
128  {
129  Unknown = -1,
130  None = 0,
131  SHA1,
132  SHA256,
133  SHA512,
134  NumberOfSupportedAlgorithms
135  };
136 }
137 
138 // ----------------------------------------------------------------------------
139 
159 namespace XISFCompression
160 {
161  enum value_type
162  {
163  Unknown = -1,
164  None = 0,
165  Zlib,
166  LZ4,
167  LZ4HC,
168  Zstd,
169  Zlib_Sh,
170  LZ4_Sh,
171  LZ4HC_Sh,
172  Zstd_Sh,
173  NumberOfSupportedCodecs
174  };
175 }
176 
177 // ----------------------------------------------------------------------------
178 
190 namespace XISFByteOrder
191 {
192  enum value_type
193  {
194  LittleEndian,
195  BigEndian
196  };
197 }
198 
199 // ----------------------------------------------------------------------------
200 
206 class PCL_CLASS XISF
207 {
208 public:
209 
213  using property_type = VariantType::value_type;
214 
218  using image_type = ImageType::value_type;
219 
223  using color_space = ColorSpace::value_type;
224 
228  using block_checksum = XISFChecksum::value_type;
229 
233  using block_compression = XISFCompression::value_type;
234 
238  using block_endianness = XISFByteOrder::value_type;
239 
244  XISF() = delete;
245 
250  XISF( const XISF& ) = delete;
251 
256  XISF& operator =( const XISF& ) = delete;
257 
262  ~XISF() = delete;
263 
264  /*
265  * ### N.B.: As of version 1.8.5.1309: Clang on macOS does not know how to
266  * compile the following constexpr static members, giving buggy 'Undefined
267  * symbols for architecture x86_64' errors on some modules...
268  */
269 #ifndef __clang__
270 
275  constexpr static fsize_type DefaultBlockAlignSize = 4096;
276 
280  constexpr static fsize_type DefaultMaxBlockInlineSize = 3072; // 3072*4/3 = 4096 (base64)
281 
285  constexpr static int MaxThumbnailSize = 1024;
286 
290  constexpr static block_checksum DefaultChecksum = XISFChecksum::None;
291 
295  constexpr static block_compression DefaultCompression = XISFCompression::None;
296 
302  constexpr static int DefaultCompressionLevel = 0;
303 
307  constexpr static int MaxCompressionLevel = 100;
308 
312  constexpr static int DefaultVerbosity = 1;
313 
319  constexpr static bool DefaultFixNonFinite = true;
320 
324  constexpr static double DefaultOutputLowerBound = 0.0;
325 
329  constexpr static double DefaultOutputUpperBound = 1.0;
330 
336  constexpr static bool DefaultStoreFITSKeywords = true;
337 
343  constexpr static bool DefaultIgnoreFITSKeywords = false;
344 
350  constexpr static bool DefaultImportFITSKeywords = false;
351 
355  constexpr static bool DefaultIgnoreEmbeddedData = false;
356 
360  constexpr static bool DefaultIgnoreProperties = false;
361 
365  constexpr static bool DefaultAutoMetadata = true;
366 
370  constexpr static bool DefaultNoWarnings = false;
371 
375  constexpr static bool DefaultWarningsAreErrors = false;
376 
380  constexpr static const char* InternalNamespacePrefix = "XISF:";
381 
385  constexpr static int InternalNamespacePrefixLength = 5;
386 
387 #else
388 
389  static const fsize_type DefaultBlockAlignSize;
390  static const fsize_type DefaultMaxBlockInlineSize;
391  static const int MaxThumbnailSize;
392  static const block_checksum DefaultChecksum;
393  static const block_compression DefaultCompression;
394  static const int DefaultCompressionLevel;
395  static const int MaxCompressionLevel;
396  static const int DefaultVerbosity;
397  static const bool DefaultFixNonFinite;
398  static const double DefaultOutputLowerBound;
399  static const double DefaultOutputUpperBound;
400  static const bool DefaultStoreFITSKeywords;
401  static const bool DefaultIgnoreFITSKeywords;
402  static const bool DefaultImportFITSKeywords;
403  static const bool DefaultIgnoreEmbeddedData;
404  static const bool DefaultIgnoreProperties;
405  static const bool DefaultAutoMetadata;
406  static const bool DefaultNoWarnings;
407  static const bool DefaultWarningsAreErrors;
408  static const char* InternalNamespacePrefix;
409  static const int InternalNamespacePrefixLength;
410 
411 #endif // !__clang__
412 
427  static const char* SampleFormatId( int bitsPerSample, bool floatSample, bool complexSample );
428 
433  template <class P>
434  static const char* SampleFormatId( const GenericImage<P>& image )
435  {
436  return SampleFormatId( P::BitsPerSample(), P::IsFloatSample(), P::IsComplexSample() );
437  }
438 
444  static bool GetSampleFormatFromId( int& bitsPerSample, bool& floatSample, bool& complexSample, const String& id );
445 
458  static const char* ColorSpaceId( color_space colorSpace );
459 
464  static const char* ColorSpaceId( const AbstractImage& image )
465  {
466  return ColorSpaceId( image.ColorSpace() );
467  }
468 
473  static color_space ColorSpaceFromId( const String& id );
474 
482  static const char* PropertyTypeId( property_type type );
483 
488  static property_type PropertyTypeFromId( const String& id );
489 
494  static const char* CompressionCodecId( block_compression codec );
495 
500  static block_compression CompressionCodecFromId( const String& id );
501 
507  static Compression* NewCompression( block_compression codec, size_type itemSize = 1 );
508 
513  static int CompressionLevelForMethod( block_compression codec, int level );
514 
519  static bool CompressionUsesByteShuffle( block_compression codec );
520 
525  static block_compression CompressionCodecNoShuffle( block_compression codec );
526 
531  static bool CompressionNeedsItemSize( block_compression codec );
532 
537  static const char* ChecksumAlgorithmId( block_checksum algorithm );
538 
543  static block_checksum ChecksumAlgorithmFromId( const String& id );
544 
549  static size_type ChecksumLength( block_checksum algorithm );
550 
555  static CryptographicHash* NewCryptographicHash( block_checksum algorithm );
556 
561  static const char* ImageTypeId( image_type type );
562 
567  static image_type ImageTypeFromId( const String& id );
568 
587  static bool IsValidPropertyId( const IsoString& id )
588  {
589  return Property::IsValidIdentifier( id );
590  }
591 
592  static bool IsValidPropertyId( const IsoString::ustring_base& id )
593  {
594  return IsValidPropertyId( IsoString( id ) );
595  }
596 
605  static bool IsInternalPropertyId( const IsoString& id )
606  {
607  return id.StartsWith( InternalNamespacePrefix );
608  }
609 
610  static bool IsInternalPropertyId( const IsoString::ustring_base& id )
611  {
612  return IsInternalPropertyId( IsoString( id ) );
613  }
614 
619  {
620  if ( !IsInternalPropertyId( id ) )
621  return InternalNamespacePrefix + id;
622  return id;
623  }
624 
625  static IsoString InternalPropertyId( const IsoString::ustring_base& id )
626  {
627  return InternalPropertyId( IsoString( id ) );
628  }
629 
642  static bool IsReservedImagePropertyId( const IsoString& id )
643  {
644  if ( id.StartsWith( "Image:" ) )
645  {
646  const char* name = id.At( 6 );
647  return ::strcmp( name, "Id" ) == 0
648  || ::strcmp( name, "Type" ) == 0;
649  }
650  return false;
651  }
652 
664  static void EnsurePTLUTInitialized();
665 };
666 
667 // ----------------------------------------------------------------------------
668 
682 class PCL_CLASS XISFOptions
683 {
684 public:
685 
686  bool storeFITSKeywords : 1;
690  bool ignoreProperties : 1;
691  bool autoMetadata : 1;
692  bool noWarnings : 1;
693  bool warningsAreErrors : 1;
694  XISF::block_checksum checksumAlgorithm : 4;
695  XISF::block_compression compressionCodec : 5;
698  bool fixNonFinite : 1;
703 
708  {
709  Reset();
710  }
711 
715  XISFOptions( const XISFOptions& ) = default;
716 
720  XISFOptions& operator =( const XISFOptions& ) = default;
721 
725  void Reset()
726  {
727  storeFITSKeywords = XISF::DefaultStoreFITSKeywords;
728  ignoreFITSKeywords = XISF::DefaultIgnoreFITSKeywords;
729  importFITSKeywords = XISF::DefaultImportFITSKeywords;
730  ignoreEmbeddedData = XISF::DefaultIgnoreEmbeddedData;
731  ignoreProperties = XISF::DefaultIgnoreProperties;
732  autoMetadata = XISF::DefaultAutoMetadata;
733  noWarnings = XISF::DefaultNoWarnings;
734  warningsAreErrors = XISF::DefaultWarningsAreErrors;
735  checksumAlgorithm = XISF::DefaultChecksum;
736  compressionCodec = XISF::DefaultCompression;
737  compressionLevel = XISF::DefaultCompressionLevel;
738  verbosity = XISF::DefaultVerbosity;
739  fixNonFinite = XISF::DefaultFixNonFinite;
740  blockAlignmentSize = XISF::DefaultBlockAlignSize;
741  maxInlineBlockSize = XISF::DefaultMaxBlockInlineSize;
742  outputLowerBound = XISF::DefaultOutputLowerBound;
743  outputUpperBound = XISF::DefaultOutputUpperBound;
744  }
745 };
746 
747 // ----------------------------------------------------------------------------
748 
765 struct PCL_CLASS XISFFileSignature
766 {
767  uint8 magic[ 8 ] = { 'X', 'I', 'S', 'F', '0', '1', '0', '0' };
768  uint32 headerLength = 0; // length in bytes of the XML file header
769  uint32 reserved = 0; // reserved - must be zero
770 
775  XISFFileSignature() = default;
776 
781 
785  XISFFileSignature& operator =( const XISFFileSignature& ) = default;
786 
792  : headerLength( length )
793  {
794  }
795 
800  void Validate() const;
801 };
802 
803 // ----------------------------------------------------------------------------
804 
819 namespace XISFMessageType
820 {
821  enum value_type
822  {
823  Informative,
824  Note,
825  Warning,
826  RecoverableError
827  };
828 }
829 
830 // ----------------------------------------------------------------------------
831 
847 class PCL_CLASS XISFLogHandler
848 {
849 public:
850 
855  using message_type = XISFMessageType::value_type;
856 
860  XISFLogHandler() = default;
861 
865  virtual ~XISFLogHandler()
866  {
867  }
868 
885  virtual void Init( const String& filePath, bool writing )
886  {
887  }
888 
905  virtual void Log( const String& text, message_type type )
906  {
907  }
908 
918  virtual void Close()
919  {
920  }
921 };
922 
923 // ----------------------------------------------------------------------------
924 
937 class PCL_CLASS XISFReader
938 {
939 public:
940 
946 
951  virtual ~XISFReader() noexcept( false );
952 
953  /*
954  * Copy constructor. This constructor is disabled because %XISF streams are
955  * unique objects.
956  */
957  XISFReader( const XISFReader& ) = delete;
958 
959  /*
960  * Copy assignment. This operator is disabled because %XISF streams are
961  * unique objects.
962  */
963  XISFReader& operator =( const XISFReader& ) = delete;
964 
968  void SetOptions( const pcl::XISFOptions& options );
969 
973  pcl::XISFOptions Options() const
974  {
975  return m_options;
976  }
977 
982  void SetHints( const IsoString& );
983 
993  void SetLogHandler( XISFLogHandler* handler );
994 
999  bool IsOpen() const;
1000 
1004  void Open( const String& path );
1005 
1011  void Close();
1012 
1017  String FilePath() const;
1018 
1022  int NumberOfImages() const;
1023 
1028  void SelectImage( int index );
1029 
1034  int SelectedImageIndex() const;
1035 
1041 
1047 
1055  void SetImageOptions( const pcl::ImageOptions& options );
1056 
1065 
1075 
1085 
1095 
1106 
1116 
1126 
1134 
1143  Variant ReadImageProperty( const IsoString& identifier );
1144 
1153 
1160 
1169  Variant ReadProperty( const IsoString& identifier );
1170 
1178 
1182  void ReadImage( FImage& image );
1183 
1187  void ReadImage( DImage& image );
1188 
1192  void ReadImage( ComplexImage& image );
1193 
1197  void ReadImage( DComplexImage& image );
1198 
1202  void ReadImage( UInt8Image& image );
1203 
1207  void ReadImage( UInt16Image& image );
1208 
1212  void ReadImage( UInt32Image& image );
1213 
1226 
1235  void ReadSamples( FImage::sample* buffer, int startRow, int rowCount, int channel );
1236 
1243  void ReadSamples( DImage::sample* buffer, int startRow, int rowCount, int channel );
1244 
1251  void ReadSamples( ComplexImage::sample* buffer, int startRow, int rowCount, int channel );
1252 
1259  void ReadSamples( DComplexImage::sample* buffer, int startRow, int rowCount, int channel );
1260 
1267  void ReadSamples( UInt8Image::sample* buffer, int startRow, int rowCount, int channel );
1268 
1275  void ReadSamples( UInt16Image::sample* buffer, int startRow, int rowCount, int channel );
1276 
1283  void ReadSamples( UInt32Image::sample* buffer, int startRow, int rowCount, int channel );
1284 
1300 
1301 private:
1302 
1304  AutoPointer<XISFLogHandler> m_logHandler;
1305  XISFOptions m_options;
1306  IsoString m_hints;
1307 
1308  void CheckOpenStream( const char* ) const;
1309  void CheckClosedStream( const char* ) const;
1310 };
1311 
1312 // ----------------------------------------------------------------------------
1313 
1326 class PCL_CLASS XISFWriter
1327 {
1328 public:
1329 
1335 
1340  virtual ~XISFWriter() noexcept( false );
1341 
1342  /*
1343  * Copy constructor. This constructor is disabled because %XISF streams are
1344  * unique objects.
1345  */
1346  XISFWriter( const XISFWriter& ) = delete;
1347 
1348  /*
1349  * Copy assignment. This operator is disabled because %XISF streams are
1350  * unique objects.
1351  */
1352  XISFWriter& operator =( const XISFWriter& ) = delete;
1353 
1357  void SetOptions( const pcl::XISFOptions& options );
1358 
1362  pcl::XISFOptions Options() const
1363  {
1364  return m_options;
1365  }
1366 
1371  void SetHints( const IsoString& );
1372 
1382  void SetLogHandler( XISFLogHandler* handler );
1383 
1398  void SetCreatorApplication( const String& appName );
1399 
1414  void SetCreatorModule( const String& modName );
1415 
1420  bool IsOpen() const;
1421 
1426  void Create( const String& path, int count );
1427 
1433  void Close();
1434 
1439  String FilePath() const;
1440 
1448  void SetImageOptions( const ImageOptions& options );
1449 
1454  void SetImageId( const IsoString& id );
1455 
1460  void WriteFITSKeywords( const FITSKeywordArray& keywords );
1461 
1470 
1474  void WriteICCProfile( const ICCProfile& profile );
1475 
1480  void WriteThumbnail( const UInt8Image& thumbnail );
1481 
1486  void WriteRGBWorkingSpace( const RGBColorSystem& rgbws );
1487 
1493 
1499 
1504  void WriteImageProperty( const IsoString& identifier, const Variant& value );
1505 
1510  void WriteImageProperties( const PropertyArray& properties );
1511 
1518  void RemoveImageProperty( const IsoString& identifier );
1519 
1524  void WriteProperty( const IsoString& identifier, const Variant& value );
1525 
1530  void WriteProperties( const PropertyArray& properties );
1531 
1538  void RemoveProperty( const IsoString& identifier );
1539 
1543  void WriteImage( const Image& image );
1544 
1548  void WriteImage( const DImage& image );
1549 
1553  void WriteImage( const ComplexImage& image );
1554 
1558  void WriteImage( const DComplexImage& image );
1559 
1563  void WriteImage( const UInt8Image& image );
1564 
1568  void WriteImage( const UInt16Image& image );
1569 
1573  void WriteImage( const UInt32Image& image );
1574 
1578  void WriteImage( const ImageVariant& image );
1579 
1587  void CreateImage( const ImageInfo& info );
1588 
1597  void WriteSamples( const FImage::sample* buffer, int startRow, int rowCount, int channel );
1598 
1606  void WriteSamples( const DImage::sample* buffer, int startRow, int rowCount, int channel );
1607 
1615  void WriteSamples( const ComplexImage::sample* buffer, int startRow, int rowCount, int channel );
1616 
1624  void WriteSamples( const DComplexImage::sample* buffer, int startRow, int rowCount, int channel );
1625 
1633  void WriteSamples( const UInt8Image::sample* buffer, int startRow, int rowCount, int channel );
1634 
1642  void WriteSamples( const UInt16Image::sample* buffer, int startRow, int rowCount, int channel );
1643 
1651  void WriteSamples( const UInt32Image::sample* buffer, int startRow, int rowCount, int channel );
1652 
1657  void CloseImage();
1658 
1659 private:
1660 
1662  AutoPointer<XISFLogHandler> m_logHandler;
1663  XISFOptions m_options;
1664  IsoString m_hints;
1665  String m_creatorApplication;
1666  String m_creatorModule;
1667 
1668  void CheckOpenStream( const char* ) const;
1669  void CheckClosedStream( const char* ) const;
1670 };
1671 
1672 // ----------------------------------------------------------------------------
1673 
1674 } // pcl
1675 
1676 #endif // __PCL_XISF_h
1677 
1678 // ----------------------------------------------------------------------------
1679 // EOF pcl/XISF.h - Released 2025-02-21T12:13:32Z
Base class of all two-dimensional images in PCL.
Generic dynamic array.
Definition: Array.h:100
Color filter array (CFA) structure.
Abstract base class of data compression algorithm implementations.
Definition: Compression.h:84
Abstract base class for cryptographic hashing algorithm implementations.
Definition: Cryptography.h:86
Adaptive histogram transformations for image visualization.
Implements a generic, two-dimensional, shared or local image.
Definition: Image.h:278
typename pixel_traits::sample sample
Definition: Image.h:305
A high-level interface to ICC color profiles.
Definition: ICCProfile.h:235
color_space ColorSpace() const noexcept
Definition: ImageColor.h:178
A simple structure to hold basic information about images.
Definition: ImageInfo.h:72
Format-independent, fundamental image stream options.
Definition: ImageOptions.h:214
Acts like a union for all types of images in PCL, with optional class-wide ownership of transported i...
Definition: ImageVariant.h:322
Eight-bit string (ISO/IEC-8859-1 or UTF-8 string)
Definition: String.h:5445
static bool IsValidIdentifier(const IsoString &id)
Definition: Property.h:206
Colorimetrically defined RGB working color space.
Unicode (UTF-16) string.
Definition: String.h:8148
Acts like a union to store instances of different data types.
Definition: Variant.h:332
XISF stream message logger
Definition: XISF.h:848
virtual void Log(const String &text, message_type type)
Definition: XISF.h:905
virtual void Init(const String &filePath, bool writing)
Definition: XISF.h:885
virtual ~XISFLogHandler()
Definition: XISF.h:865
virtual void Close()
Definition: XISF.h:918
XISFLogHandler()=default
XISF-specific file options
Definition: XISF.h:683
uint8 compressionLevel
Codec-independent compression level: 0 = auto, 1 = fast, 100 = maximum compression.
Definition: XISF.h:696
bool ignoreFITSKeywords
Do not load FITS keywords from input XISF files.
Definition: XISF.h:687
bool autoMetadata
Automatically generate a number of reserved XISF properties.
Definition: XISF.h:691
uint16 maxInlineBlockSize
Maximum size in bytes of an inline/embedded block.
Definition: XISF.h:700
uint16 blockAlignmentSize
Block alignment size in bytes (0 = 1 = unaligned).
Definition: XISF.h:699
bool noWarnings
Suppress all warning and diagnostics messages.
Definition: XISF.h:692
uint8 verbosity
Verbosity level: 0 = quiet, > 0 = write console state messages.
Definition: XISF.h:697
double outputUpperBound
Upper bound for output floating point pixel samples (=1.0 by default).
Definition: XISF.h:702
bool ignoreProperties
Do not load existing XISF properties.
Definition: XISF.h:690
bool storeFITSKeywords
Include FITS header keywords in output XISF files.
Definition: XISF.h:686
bool warningsAreErrors
Treat warnings as fatal errors.
Definition: XISF.h:693
XISFOptions(const XISFOptions &)=default
void Reset()
Definition: XISF.h:725
bool fixNonFinite
Replace NaNs, infinities and negative zeros with lower bound values in floating point images (reading...
Definition: XISF.h:698
bool importFITSKeywords
Import FITS keywords as XISF properties.
Definition: XISF.h:688
XISF::block_checksum checksumAlgorithm
The algorithm used for block checksum calculations.
Definition: XISF.h:694
XISF::block_compression compressionCodec
The codec used for compression of XISF blocks.
Definition: XISF.h:695
double outputLowerBound
Lower bound for output floating point pixel samples (=0.0 by default).
Definition: XISF.h:701
bool ignoreEmbeddedData
Do not load existing embedded data (such as ICC profiles for example).
Definition: XISF.h:689
XISF input file stream
Definition: XISF.h:938
Variant ReadImageProperty(const IsoString &identifier)
int SelectedImageIndex() const
String FilePath() const
void ReadImage(UInt32Image &image)
void ReadSamples(UInt16Image::sample *buffer, int startRow, int rowCount, int channel)
void Open(const String &path)
void ReadImage(DComplexImage &image)
DisplayFunction ReadDisplayFunction()
PropertyArray ReadProperties()
PropertyDescriptionArray PropertyDescriptions() const
void ReadSamples(DComplexImage::sample *buffer, int startRow, int rowCount, int channel)
Variant ReadProperty(const IsoString &identifier)
void ReadImage(UInt8Image &image)
void ReadSamples(ComplexImage::sample *buffer, int startRow, int rowCount, int channel)
void SelectImage(int index)
RGBColorSystem ReadRGBWorkingSpace()
void ReadSamples(UInt8Image::sample *buffer, int startRow, int rowCount, int channel)
void ReadSamples(DImage::sample *buffer, int startRow, int rowCount, int channel)
void ReadSamples(FImage::sample *buffer, int startRow, int rowCount, int channel)
void ReadImage(FImage &image)
void ReadSamples(UInt32Image::sample *buffer, int startRow, int rowCount, int channel)
void SetLogHandler(XISFLogHandler *handler)
pcl::ImageOptions ImageOptions() const
pcl::ImageInfo ImageInfo() const
IsoString ImageId() const
PropertyArray ReadImageProperties()
ColorFilterArray ReadColorFilterArray()
UInt8Image ReadThumbnail()
void ReadImage(UInt16Image &image)
int NumberOfImages() const
bool ImplementsIncrementalRead() const
static XMLDocument * ExtractHeader(const String &path, XMLParserOptions options=XMLParserOptions())
void SetImageOptions(const pcl::ImageOptions &options)
void ReadImage(DImage &image)
ICCProfile ReadICCProfile()
PropertyDescriptionArray ImagePropertyDescriptions() const
void ReadImage(ComplexImage &image)
bool IsOpen() const
FITSKeywordArray ReadFITSKeywords()
void SetHints(const IsoString &)
virtual ~XISFReader() noexcept(false)
XISF output file stream
Definition: XISF.h:1327
void WriteICCProfile(const ICCProfile &profile)
void WriteImage(const DImage &image)
void WriteThumbnail(const UInt8Image &thumbnail)
void RemoveImageProperty(const IsoString &identifier)
void SetCreatorApplication(const String &appName)
void WriteSamples(const DComplexImage::sample *buffer, int startRow, int rowCount, int channel)
void WriteImageProperty(const IsoString &identifier, const Variant &value)
void WriteImage(const ComplexImage &image)
void SetCreatorModule(const String &modName)
void WriteProperties(const PropertyArray &properties)
void WriteSamples(const UInt16Image::sample *buffer, int startRow, int rowCount, int channel)
void Create(const String &path, int count)
void WriteImageProperties(const PropertyArray &properties)
void WriteImage(const DComplexImage &image)
void WriteFITSKeywords(const FITSKeywordArray &keywords)
void WriteSamples(const ComplexImage::sample *buffer, int startRow, int rowCount, int channel)
void WriteRGBWorkingSpace(const RGBColorSystem &rgbws)
virtual ~XISFWriter() noexcept(false)
void WriteImage(const UInt16Image &image)
void WriteSamples(const DImage::sample *buffer, int startRow, int rowCount, int channel)
const FITSKeywordArray & FITSKeywords() const
void SetImageId(const IsoString &id)
void WriteSamples(const UInt32Image::sample *buffer, int startRow, int rowCount, int channel)
void WriteColorFilterArray(const ColorFilterArray &cfa)
String FilePath() const
void SetImageOptions(const ImageOptions &options)
void WriteSamples(const FImage::sample *buffer, int startRow, int rowCount, int channel)
void RemoveProperty(const IsoString &identifier)
void SetHints(const IsoString &)
void WriteProperty(const IsoString &identifier, const Variant &value)
bool IsOpen() const
void WriteDisplayFunction(const DisplayFunction &df)
void WriteImage(const ImageVariant &image)
void SetLogHandler(XISFLogHandler *handler)
void CreateImage(const ImageInfo &info)
void WriteImage(const UInt32Image &image)
void WriteSamples(const UInt8Image::sample *buffer, int startRow, int rowCount, int channel)
void WriteImage(const UInt8Image &image)
void WriteImage(const Image &image)
Utility functions, data and constants for XISF support.
Definition: XISF.h:207
static bool CompressionNeedsItemSize(block_compression codec)
static const char * CompressionCodecId(block_compression codec)
static bool IsInternalPropertyId(const IsoString &id)
Definition: XISF.h:605
static bool CompressionUsesByteShuffle(block_compression codec)
static const char * ChecksumAlgorithmId(block_checksum algorithm)
static block_compression CompressionCodecNoShuffle(block_compression codec)
~XISF()=delete
constexpr static bool DefaultWarningsAreErrors
Definition: XISF.h:375
constexpr static block_checksum DefaultChecksum
Definition: XISF.h:290
static const char * ImageTypeId(image_type type)
XISF(const XISF &)=delete
constexpr static bool DefaultIgnoreFITSKeywords
Definition: XISF.h:343
constexpr static int DefaultCompressionLevel
Definition: XISF.h:302
static const char * SampleFormatId(const GenericImage< P > &image)
Definition: XISF.h:434
static const char * ColorSpaceId(color_space colorSpace)
constexpr static block_compression DefaultCompression
Definition: XISF.h:295
static color_space ColorSpaceFromId(const String &id)
constexpr static bool DefaultIgnoreProperties
Definition: XISF.h:360
static const char * SampleFormatId(int bitsPerSample, bool floatSample, bool complexSample)
static size_type ChecksumLength(block_checksum algorithm)
static bool IsReservedImagePropertyId(const IsoString &id)
Definition: XISF.h:642
constexpr static double DefaultOutputLowerBound
Definition: XISF.h:324
static image_type ImageTypeFromId(const String &id)
constexpr static bool DefaultFixNonFinite
Definition: XISF.h:319
static block_checksum ChecksumAlgorithmFromId(const String &id)
static const char * PropertyTypeId(property_type type)
constexpr static int DefaultVerbosity
Definition: XISF.h:312
constexpr static bool DefaultAutoMetadata
Definition: XISF.h:365
static property_type PropertyTypeFromId(const String &id)
static int CompressionLevelForMethod(block_compression codec, int level)
constexpr static double DefaultOutputUpperBound
Definition: XISF.h:329
static const char * ColorSpaceId(const AbstractImage &image)
Definition: XISF.h:464
constexpr static bool DefaultIgnoreEmbeddedData
Definition: XISF.h:355
static Compression * NewCompression(block_compression codec, size_type itemSize=1)
constexpr static fsize_type DefaultBlockAlignSize
Definition: XISF.h:275
static bool GetSampleFormatFromId(int &bitsPerSample, bool &floatSample, bool &complexSample, const String &id)
constexpr static bool DefaultNoWarnings
Definition: XISF.h:370
constexpr static bool DefaultStoreFITSKeywords
Definition: XISF.h:336
static bool IsValidPropertyId(const IsoString &id)
Definition: XISF.h:587
static block_compression CompressionCodecFromId(const String &id)
static IsoString InternalPropertyId(const IsoString &id)
Definition: XISF.h:618
static void EnsurePTLUTInitialized()
constexpr static bool DefaultImportFITSKeywords
Definition: XISF.h:350
static CryptographicHash * NewCryptographicHash(block_checksum algorithm)
constexpr static fsize_type DefaultMaxBlockInlineSize
Definition: XISF.h:280
XISF()=delete
XML document parsing and generation
Definition: XML.h:2745
int64 fsize_type
Definition: Defs.h:1185
unsigned short uint16
Definition: Defs.h:654
unsigned char uint8
Definition: Defs.h:642
unsigned int uint32
Definition: Defs.h:666
size_t size_type
Definition: Defs.h:609
PCL root namespace.
Definition: AbstractImage.h:77
XISF monolithic file signature
Definition: XISF.h:766
XISFFileSignature(uint32 length)
Definition: XISF.h:791
XISFFileSignature(const XISFFileSignature &)=default