VTK  9.6.1
vtkHDRReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
14
15#ifndef vtkHDRReader_h
16#define vtkHDRReader_h
17
18#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_6_0
19#include "vtkIOImageModule.h" // For export macro
20#include "vtkImageReader.h"
21#include <string> // for std::string
22#include <vector> // for std::vector
23
24VTK_ABI_NAMESPACE_BEGIN
25class VTKIOIMAGE_EXPORT vtkHDRReader : public vtkImageReader
26{
27public:
28 static vtkHDRReader* New();
30
31 void PrintSelf(ostream& os, vtkIndent indent) override;
32
38
40
43 vtkGetMacro(Format, int);
45
47
51 vtkGetMacro(Gamma, double);
53
55
59 vtkGetMacro(Exposure, double);
61
63
67 vtkGetMacro(PixelAspect, double);
69
73 int CanReadFile(VTK_FILEPATH const char* fname) override;
74
80 const char* GetFileExtensions() override { return ".hdr .pic"; }
81
85 const char* GetDescriptiveName() override { return "Radiance HDR"; }
86
87protected:
89 ~vtkHDRReader() override;
90
91 std::string ProgramType;
93 double Gamma;
94 double Exposure;
96
100 bool FlippedX = false;
101
105 bool SwappedAxis = false;
106
107 void ExecuteInformation() override;
109 bool HDRReaderUpdateSlice(float* outPtr, int* outExt);
110 void HDRReaderUpdate(vtkImageData* data, float* outPtr);
111
116 VTK_DEPRECATED_IN_9_6_0("Do not use, use Streams instead")
117 bool HasError(istream* is);
118
119 int GetWidth() const;
120 int GetHeight() const;
121
127
128 void ConvertAllDataFromRGBToXYZ(float* outPtr, int size);
129
130 void FillOutPtrRLE(int* outExt, float*& outPtr, std::vector<unsigned char>& lineBuffer);
131 void FillOutPtrNoRLE(int* outExt, float*& outPtr, std::vector<unsigned char>& lineBuffer);
132
136 void RGBE2Float(unsigned char rgbe[4], float& r, float& g, float& b);
137
143 static void XYZ2RGB(const float convertMatrix[3][3], double gamma, float& r, float& g, float& b);
144
145private:
146 vtkHDRReader(const vtkHDRReader&) = delete;
147 void operator=(const vtkHDRReader&) = delete;
148
153 bool ReadAllFileNoRLE(vtkResourceStream* stream, float* outPtr, int decrPtr, int* outExt);
154
159 bool ReadLineRLE(vtkResourceStream* stream, unsigned char* lineBufferPtr);
160};
161VTK_ABI_NAMESPACE_END
162#endif
general representation of visualization data
const char * GetDescriptiveName() override
Return a descriptive name for the file format that might be useful in a GUI.
FormatType Format
~vtkHDRReader() override
void FillOutPtrNoRLE(int *outExt, float *&outPtr, std::vector< unsigned char > &lineBuffer)
bool FlippedX
If true, the X axis has been flipped.
int CanReadFile(const char *fname) override
Is the given file a HDR file?
void FillOutPtrRLE(int *outExt, float *&outPtr, std::vector< unsigned char > &lineBuffer)
void ConvertAllDataFromRGBToXYZ(float *outPtr, int size)
double PixelAspect
void ExecuteDataWithInformation(vtkDataObject *out, vtkInformation *outInfo) override
This is a convenience method that is implemented in many subclasses instead of RequestData.
static vtkHDRReader * New()
static void XYZ2RGB(const float convertMatrix[3][3], double gamma, float &r, float &g, float &b)
Conversion from xyz to rgb float using the 3x3 convert matrix.
bool HDRReaderUpdateSlice(float *outPtr, int *outExt)
void RGBE2Float(unsigned char rgbe[4], float &r, float &g, float &b)
Standard conversion from rgbe to float pixels.
void HDRReaderUpdate(vtkImageData *data, float *outPtr)
bool SwappedAxis
If true, the Y axis is the X, and the height and width has been swapped.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int GetWidth() const
void ExecuteInformation() override
bool ReadHeaderData()
Read the header data and fill attributes of HDRReader, as well as DataExtent.
int GetHeight() const
const char * GetFileExtensions() override
Get the file extensions for this format.
std::string ProgramType
double Exposure
bool HasError(istream *is)
If the stream has an error, close the file and return true.
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:29
Store vtkAlgorithm input/output information.
Abstract class used for custom streams.
#define VTK_DEPRECATED_IN_9_6_0(reason)
#define VTK_FILEPATH