PCL
|
Implementation of a PixInsight file format instance. More...
#include <FileFormatImplementation.h>
Public Member Functions | |
FileFormatImplementation (const FileFormatImplementation &x)=delete | |
FileFormatImplementation (const MetaFileFormat *m) | |
virtual | ~FileFormatImplementation () noexcept(false) |
virtual bool | CanReadIncrementally () const |
virtual bool | CanWriteIncrementally () const |
virtual void | Close () |
virtual void | CloseImage () |
virtual void | Create (const String &filePath, int numberOfImages, const IsoString &hints) |
virtual void | CreateImage (const ImageInfo &info) |
virtual String | FilePath () const |
virtual void * | FormatSpecificData () const |
virtual String | ImageFormatInfo () const |
virtual PropertyDescriptionArray | ImagePropertyDescriptions () |
virtual bool | IsOpen () const |
const MetaFileFormat * | Meta () const |
virtual ImageDescriptionArray | Open (const String &filePath, const IsoString &hints) |
FileFormatImplementation & | operator= (const FileFormatImplementation &)=delete |
virtual PropertyDescriptionArray | PropertyDescriptions () |
virtual bool | QueryOptions (Array< ImageOptions > &options, Array< void * > &formatOptions) |
virtual ColorFilterArray | ReadColorFilterArray () |
virtual DisplayFunction | ReadDisplayFunction () |
virtual FITSKeywordArray | ReadFITSKeywords () |
virtual ICCProfile | ReadICCProfile () |
virtual void | ReadImage (pcl::DImage &image) |
virtual void | ReadImage (pcl::Image &image) |
virtual void | ReadImage (UInt16Image &image) |
virtual void | ReadImage (UInt32Image &image) |
virtual void | ReadImage (UInt8Image &image) |
virtual Variant | ReadImageProperty (const IsoString &property) |
virtual Variant | ReadProperty (const IsoString &property) |
virtual RGBColorSystem | ReadRGBWorkingSpace () |
virtual void | ReadSamples (pcl::DImage::sample *buffer, int startRow, int rowCount, int channel) |
virtual void | ReadSamples (pcl::Image::sample *buffer, int startRow, int rowCount, int channel) |
virtual void | ReadSamples (UInt16Image::sample *buffer, int startRow, int rowCount, int channel) |
virtual void | ReadSamples (UInt32Image::sample *buffer, int startRow, int rowCount, int channel) |
virtual void | ReadSamples (UInt8Image::sample *buffer, int startRow, int rowCount, int channel) |
virtual UInt8Image | ReadThumbnail () |
virtual int | SelectedImageIndex () const |
virtual void | SelectImage (int index) |
virtual void | SetFormatSpecificData (const void *data) |
virtual void | SetId (const IsoString &id) |
virtual void | SetOptions (const ImageOptions &options) |
virtual bool | WasInexactRead () const |
virtual bool | WasLossyWrite () const |
virtual void | WriteColorFilterArray (const ColorFilterArray &cfa) |
virtual void | WriteDisplayFunction (const DisplayFunction &df) |
virtual void | WriteFITSKeywords (const FITSKeywordArray &keywords) |
virtual void | WriteICCProfile (const ICCProfile &icc) |
virtual void | WriteImage (const pcl::DImage &image) |
virtual void | WriteImage (const pcl::Image &image) |
virtual void | WriteImage (const UInt16Image &image) |
virtual void | WriteImage (const UInt32Image &image) |
virtual void | WriteImage (const UInt8Image &image) |
virtual void | WriteImageProperty (const IsoString &property, const Variant &value) |
virtual void | WriteProperty (const IsoString &property, const Variant &value) |
virtual void | WriteRGBWorkingSpace (const RGBColorSystem &rgbws) |
virtual void | WriteSamples (const pcl::DImage::sample *buffer, int startRow, int rowCount, int channel) |
virtual void | WriteSamples (const pcl::Image::sample *buffer, int startRow, int rowCount, int channel) |
virtual void | WriteSamples (const UInt16Image::sample *buffer, int startRow, int rowCount, int channel) |
virtual void | WriteSamples (const UInt32Image::sample *buffer, int startRow, int rowCount, int channel) |
virtual void | WriteSamples (const UInt8Image::sample *buffer, int startRow, int rowCount, int channel) |
virtual void | WriteThumbnail (const pcl::UInt8Image &image) |
In the PixInsight/PCL framework, an image file format is formally defined as a descendant of the MetaFileFormat class. FileFormatImplementation defines the behavior and functionality of a file format instance, which usually (although not necessarily) identifies an image file encoded in the corresponding file format.
Note that MetaFileFormat and FileFormatImplementation describe and implement, respectively, an installable image file format in a PixInsight module. All installed file formats can be accessed and instantiated by means of the FileFormat and FileFormatInstance classes, respectively, through intermodule communication mechanisms.
Definition at line 97 of file FileFormatImplementation.h.
pcl::FileFormatImplementation::FileFormatImplementation | ( | const MetaFileFormat * | m | ) |
Constructs a file format instance.
m | Pointer to a metaformat that identifies the file format class that this file instance belongs to. |
|
virtualnoexcept |
Virtual destructor.
|
delete |
Copy constructor. This constructor is disabled because file format instances represent unique objects (e.g., files or I/O streams).
|
inlinevirtual |
Returns true iff this instance can perform incremental read operations.
The default implementation returns true. Do not confuse this member function with MetaFileFormat::CanReadIncrementally(), which tells the PixInsight core application if a given file format has the capability of performing incremental file reads in general. The value returned by this function refers specifically to the file format instance (e.g., a particular file) represented by this object.
Definition at line 393 of file FileFormatImplementation.h.
|
inlinevirtual |
Returns true iff this instance can perform incremental write operations.
The default implementation returns true. Do not confuse this member function with MetaFileFormat::CanWriteIncrementally(), which tells the PixInsight core application if a given file format has the capability of performing incremental file writes in general. The value returned by this function refers specifically to the file format instance (e.g., a particular file) represented by this object.
Definition at line 731 of file FileFormatImplementation.h.
|
virtual |
|
virtual |
Closes the image that has been created by a previous call to CreateImage().
|
virtual |
Creates an image file for writing.
filePath | Path to a file that will be created. If a file exists at the same path, it will be overwritten and its current contents will be lost. The PixInsight core application always passes full file paths to existing files. However, other modules that may call this member function (through intermodule communication) may not behave in the same way. A module must be prepared to receive relative file path specifications, and even invalid paths, in this argument. |
numberOfImages | This is the number of images that will be written to the file after creation. It can be zero if an empty file is being created, and also less than zero if the number of images is unknown or cannot be defined at the point of creation. Although the PixInsight core application will always pass the exact number of images that will be written, other modules that can call this member function (through intermodule communication) might not behave so accurately. Therefore, format modules should be flexible enough as to not depend on an accurate count of images passed here. For a format that does not support empty files or multiple images stored in a single file, a reimplementation of this member function should throw an Error exception if this value is zero or not equal to one, respectively. |
hints | A string containing a (possibly empty) list of hints intended to modify the way an image file is generated and/or the way image data are to be encoded and written. A format module can simply ignore all of these hints, or just look for one or more hints that it recognizes and supports, ignoring others. When two or more hints are specified, they must be separated by space characters (0x20). Many standard file formats support some hints. For example, the standard JPEG format recognizes the "quality" hint to force generation of a JPEG image with a given quality level in the range 1 to 100, irrespective of the current JPEG format settings. |
In the event of error, a reimplementation of this member function should throw a PCL exception. Thrown exceptions will be caught and processed by internal PCL code.
|
virtual |
Creates a new image with the geometry and color space as specified by an ImageInfo structure. The newly created image will be written by subsequent incremental write operations.
The sample data type and other format-independent and format-specific image parameters have been specified by previous calls to SetOptions() and SetFormatSpecificData().
|
virtual |
|
virtual |
Returns a format-specific data block for the current image in this file, or nullptr if no such data have been retrieved.
See SetFormatSpecificData() for a description of format specific data functionality in PCL.
|
inlinevirtual |
Provides a human-readable summary of format-specific properties for the current image in this file.
The returned string should include format-specific information, not generic image information. For example, don't include image dimensions, color space, and other things that the PixInsight core application already knows.
Definition at line 234 of file FileFormatImplementation.h.
|
virtual |
Returns a description of all data properties associated with the current image in this file. For each data property, the returned array provides information on the unique identifier of a property and its data type.
Returns an empty array if there are no properties stored for the current image in this file.
This member function will never be called if the underlying file format does not support data properties for individual images. See FileFormat::CanStoreImageProperties().
|
virtual |
Returns true iff this file is currently open.
|
inline |
Returns a pointer to the metaformat of this file format instance.
The metaformat defines the format class this instance belongs to.
Definition at line 135 of file FileFormatImplementation.h.
|
virtual |
Opens an image file for reading and/or information retrieval.
filePath | File path to a file that will be opened. The core PixInsight application always passes full file paths to existing files. However, other modules that may call this member function (through intermodule communication) may not behave in the same way. A module must be prepared to receive relative file path specifications, and even paths to files that don't exist, in this argument. |
hints | A string containing a (possibly empty) list of hints intended to modify the way an image file is opened and/or the way image data are to be read and decoded. A format module can simply ignore all of these hints, or just look for one or more hints that it recognizes and supports, ignoring others. When two or more hints are specified, they must be separated by space characters (0x20). Most standard file formats support hints. For example, the standard DSLR_RAW format recognizes the "raw" hint to force reading pure raw data (no deBayerization, no black pedestal subtraction, no white balancing) irrespective of the current DSLR RAW format settings. |
This function must return a dynamic array of ImageDescription structures that describes the image(s) stored in the opened image file. Each ImageDescription structure contains ImageInfo and ImageOptions objects that describe both basic image parameters (as geometry and color space) and format-independent image options (pixel format, embedded data, etc).
In the event of error, a reimplementation of this member function should throw a PCL exception. Thrown exceptions will be caught and processed by internal PCL code.
|
delete |
Copy assignment. This operator is disabled because file format instances represent unique objects (e.g., files or I/O streams).
|
virtual |
Returns a description of all data properties associated with this file. For each data property, the returned array provides information on the unique identifier of a property and its data type.
Returns an empty array if there are no properties stored for this file.
This member function will never be called if the underlying file format does not support data properties. See FileFormat::CanStoreProperties().
|
inlinevirtual |
Query image options and format-specific data before creating a new image file. Returns true if the file creation operation can continue; false if it should be aborted.
[out] | options | Reference to a dynamic array of ImageOptions objects. On output, each of these objects must provide a general description of an image stored in a file instance of this file format. A file format module is responsible for setting the appropriate values in the passed structures, which will be used to generate a new file through a subsequent call to Create(). Formats that can store multiple images per file can receive more than one ImageOptions structure stored in this array. Formats that don't support multiple images can safely ignore all structures but the first one in this array. |
[out] | formatOptions | Reference to a dynamic array of format-specific data blocks. Each void pointer in this array can be either zero or point to valid format-specific data for the format of this instance. This array can be empty if no format-specific data is being set. See the SetFormatSpecificData() member function for more information on format-specific data blocks. |
If the PixInsight application calls this function, it does so just before calling Create(). Typically, this happens as part of a File > Save As
operation. Other modules can also invoke this function through intermodule communication. Format modules should open a dialog box to let the user modify some working options, as appropriate; then they should return true unless the user cancels the dialog.
Definition at line 506 of file FileFormatImplementation.h.
|
virtual |
Extraction of the color filter array (CFA) for the current image in this file. If no CFA is defined for the current image, this function should return an empty CFA (see ColorFilterArray's default constructor).
This member function will never be called if the underlying file format does not support storage of color filter arrays. See FileFormat::CanStoreColorFilterArrays().
|
virtual |
Extraction of the display function associated with the current image in this file. If no display function is defined for the current image, this function should return an identity display function (see DisplayFunction's default constructor).
This member function will never be called if the underlying file format does not support storage of display functions. See FileFormat::CanStoreDisplayFunctions().
|
virtual |
Extraction of the list of embedded FITS keywords for the current image in this file. If the current image embeds no FITS keywords, this function should return an empty array.
|
virtual |
Extraction of the ICC color profile associated with the current image in this file. If no ICC color profile is defined for the current image, this function should return a null (empty) ICCProfile object.
This member function will never be called if the underlying file format does not support storage of ICC color profiles. See FileFormat::CanStoreICCProfiles().
|
virtual |
Reads the current image in 64-bit floating point format.
|
virtual |
Reads the current image in 32-bit floating point format.
|
virtual |
Reads the current image in 16-bit unsigned integer format.
|
virtual |
Reads the current image in 32-bit unsigned integer format.
|
virtual |
Reads the current image in 8-bit unsigned integer format.
|
virtual |
Extraction of a data property of the current image with the specified unique identifier.
If no property with the specified identifier exists associated with the current image in this file, an invalid Variant object should be returned.
This member function will never be called if the underlying file format does not support data properties for individual images. See FileFormat::CanStoreImageProperties().
Extraction of a data property with the specified unique identifier.
If no property with the specified identifier exists associated with this file, an invalid Variant object should be returned.
This member function will never be called if the underlying file format does not support data properties. See FileFormat::CanStoreProperties().
|
virtual |
Extraction of the RGB working space associated with the current image in this file. If no RGBWS is defined for the current image, this function should return a default RGBColorSystem object (see RGBColorSystem::sRGB).
This member function will never be called if the underlying file format does not support storage of RGB working spaces. See FileFormat::CanStoreRGBWS().
|
virtual |
Incremental read in 64-bit floating point sample format.
This is an overloaded member function for the DImage type; see ReadSamples( Image::sample*, int, int, int, int ) for a full description.
|
virtual |
Incremental read in 32-bit floating point sample format.
[out] | buffer | Address of the destination sample buffer. |
startRow | First pixel row to read. | |
rowCount | Number of pixel rows to read. | |
channel | Channel index to read. |
Incremental read operations allow the PixInsight core application and other modules to load images by successive row strips.
To implement incremental reading, MetaFileFormat::CanReadIncrementally() must be reimplemented to return true in the metaformat class for this file instance; otherwise this member function will never be called. Furthermore, the FileFormatImplementation::CanReadIncrementally() member function must return true for the format instance represented by this object.
|
virtual |
Incremental read in 16-bit unsigned integer sample format.
This is an overloaded member function for the UInt16Image type; see ReadSamples( Image::sample*, int, int, int, int ) for a full description.
|
virtual |
Incremental read in 32-bit unsigned integer sample format.
This is an overloaded member function for the UInt32Image type; see ReadSamples( Image::sample*, int, int, int, int ) for a full description.
|
virtual |
Incremental read in 8-bit unsigned integer sample format.
This is an overloaded member function for the UInt8Image type; see ReadSamples( Image::sample*, int, int, int, int ) for a full description.
|
virtual |
Extraction of the embedded thumbnail for the current image in this file. If the current image does not embed a thumbnail image, this function should return an empty 8-bit integer image.
|
virtual |
Returns the current zero-based image index in this file.
This member function will only be called for file formats that support multiple images stored in a single file. It will never be called if the MetaFileFormat::SupportsMultipleImages() member function has not been reimplemented to return true in the metaformat class for this instance.
|
virtual |
Selects the image at the specified zero-based index in this file.
This member function will only be called for file formats that support multiple images stored in a single file. It will never be called if the MetaFileFormat::SupportsMultipleImages() member function has not been reimplemented to return true in the metaformat class for this instance.
|
virtual |
Specifies a format-specific data block for the next image that will be written or created in this file.
Format-specific data are arbitrary data blocks; the PixInsight core application knows nothing about them except that it passes them among instances, even instances of different file formats.
Format-specific data are used by file formats that need working parameters that must persist across different file instances. In such cases, derived classes should implement suitable mechanisms to identify and validate their own data.
For example, file formats that use variable compression schemes usually reimplement this member function, along with FormatSpecificData(), to keep track of a compression ratio, along with other private data items.
To implement format-specific data support, MetaFileFormat::UsesFormatSpecificData() must be reimplemented to return true in the metaformat class for this file instance; otherwise this member function will never be called.
Before calling this function, the PixInsight core application will call MetaFileFormat::ValidateFormatSpecificData() for the same data block. If the validation routine returns false, this function will not be called for the data block that failed the validation test.
|
inlinevirtual |
Specifies an identifier for the next image that will be written or created in this file.
Definition at line 563 of file FileFormatImplementation.h.
|
inlinevirtual |
Specifies a set of format-independent image options for the next image that will be written or created in this file.
Definition at line 574 of file FileFormatImplementation.h.
|
inlinevirtual |
Returns true iff the last file read operation was inexact.
The PixInsight application invokes this function just after successful completion of a call to ReadImage() or Read(). If a file format instance reads (or might read) source images inexactly, (e.g., by applying a rounding function to source sample values), then this function must be reimplemented to return true, as appropriate.
Definition at line 465 of file FileFormatImplementation.h.
|
inlinevirtual |
Returns true iff the last file write operation in this file was lossy.
The PixInsight core application invokes this function just after successful completion of a call to WriteImage() or Write(). If a file format instance writes (or might write) lossy image data (e.g., by applying some lossy compression scheme), then this function must be reimplemented to return true, as appropriate.
Definition at line 803 of file FileFormatImplementation.h.
|
virtual |
Specifies a color filter array (CFA) that will be embedded in the next image written or created in this file.
|
virtual |
Specifies a display function that will be embedded in the next image written or created in this file.
|
virtual |
Specifies a set of FITS keywords to be embedded in the next image written or created in this file.
|
virtual |
Specifies an ICC profile to be embedded in the next image written or created in this file.
|
virtual |
Writes a 64-bit floating point image to this file.
|
virtual |
Writes a 32-bit floating point image to this file.
|
virtual |
Writes a 16-bit unsigned integer image to this file.
|
virtual |
Writes a 32-bit unsigned integer image to this file.
|
virtual |
Writes an 8-bit unsigned integer image to this file.
|
virtual |
Specifies a data property to be embedded in the next image written or created in this file.
property | Unique identifier of the data property. |
value | Property value. |
This member function will never be called if the underlying file format does not support data properties for individual images. See FileFormat::CanStoreImageProperties().
|
virtual |
Specifies a data property to be embedded in this file.
property | Unique identifier of the data property. |
value | Property value. |
This member function will never be called if the underlying file format does not support data properties. See FileFormat::CanStoreProperties().
|
virtual |
Specifies the parameters of an RGB working space that will be embedded in the next image written or created in this file.
|
virtual |
Incremental write of a 64-bit floating point image.
This is an overloaded member function for the DImage type; see WriteSamples( const Image::sample*, int, int, int ) for a full description.
|
virtual |
Incremental write of 32-bit floating point pixel samples.
buffer | Address of the source sample buffer. |
startRow | First pixel row to write. |
rowCount | Number of pixel rows to write. |
channel | Channel index to write. |
Incremental write operations allow the PixInsight core application and other modules to generate images by successive row strips.
To implement incremental writing, MetaFileFormat::CanWriteIncrementally() must be reimplemented to return true in the metaformat class for this file instance; otherwise this member function will never be called. Furthermore, the FileFormatImplementation::CanWriteIncrementally() member function must return true for the format instance represented by this object.
|
virtual |
Incremental write of a 16-bit unsigned integer image.
This is an overloaded member function for the UInt16Image type; see WriteSamples( const Image::sample*, int, int, int ) for a full description.
|
virtual |
Incremental write of a 32-bit unsigned integer image.
This is an overloaded member function for the UInt32Image type; see WriteSamples( const Image::sample*, int, int, int ) for a full description.
|
virtual |
Incremental write of an 8-bit unsigned integer image.
This is an overloaded member function for the UInt8Image type; see WriteSamples( const Image::sample*, int, int, int ) for a full description.
|
virtual |
Specifies a thumbnail image to be embedded in the next image written or created in this file.