VTK  9.3.0
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#ifndef vtkHDRReader_h
15#define vtkHDRReader_h
16
17#include "vtkIOImageModule.h" // For export macro
18#include "vtkImageReader.h"
19#include <string> // for std::string
20#include <vector> // for std::vector
21
22VTK_ABI_NAMESPACE_BEGIN
23class VTKIOIMAGE_EXPORT vtkHDRReader : public vtkImageReader
24{
25public:
26 static vtkHDRReader* New();
28
29 void PrintSelf(ostream& os, vtkIndent indent) override;
30
32 {
33 FORMAT_32BIT_RLE_RGBE = 0,
34 FORMAT_32BIT_RLE_XYZE
35 };
36
38
41 vtkGetMacro(Format, int);
43
45
49 vtkGetMacro(Gamma, double);
51
53
57 vtkGetMacro(Exposure, double);
59
61
65 vtkGetMacro(PixelAspect, double);
67
71 int CanReadFile(VTK_FILEPATH const char* fname) override;
72
78 const char* GetFileExtensions() override { return ".hdr .pic"; }
79
83 const char* GetDescriptiveName() override { return "Radiance HDR"; }
84
85protected:
87 ~vtkHDRReader() override;
88
89 std::string ProgramType;
91 double Gamma;
92 double Exposure;
94
98 bool FlippedX = false;
99
103 bool SwappedAxis = false;
104
105 void ExecuteInformation() override;
107 bool HDRReaderUpdateSlice(float* outPtr, int* outExt);
108 void HDRReaderUpdate(vtkImageData* data, float* outPtr);
109
114 bool HasError(istream* is);
115
116 int GetWidth() const;
117 int GetHeight() const;
118
124
125 void ConvertAllDataFromRGBToXYZ(float* outPtr, int size);
126
127 void FillOutPtrRLE(int* outExt, float*& outPtr, std::vector<unsigned char>& lineBuffer);
128 void FillOutPtrNoRLE(int* outExt, float*& outPtr, std::vector<unsigned char>& lineBuffer);
129
134 bool ReadAllFileNoRLE(istream* is, float* outPtr, int decrPtr, int* outExt);
135
140 bool ReadLineRLE(istream* is, unsigned char* lineBufferPtr);
141
145 void RGBE2Float(unsigned char rgbe[4], float& r, float& g, float& b);
146
152 static void XYZ2RGB(const float convertMatrix[3][3], float& r, float& g, float& b);
153
154private:
155 vtkHDRReader(const vtkHDRReader&) = delete;
156 void operator=(const vtkHDRReader&) = delete;
157};
158VTK_ABI_NAMESPACE_END
159#endif
general representation of visualization data
read Radiance HDR files
int CanReadFile(VTK_FILEPATH const char *fname) override
Is the given file a HDR file?
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)
static void XYZ2RGB(const float convertMatrix[3][3], float &r, float &g, float &b)
Conversion from xyz to rgb float using the 3x3 convert matrix.
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.
bool ReadLineRLE(istream *is, unsigned char *lineBufferPtr)
Read a line of the file from is into lineBuffer with RLE encoding.
static vtkHDRReader * New()
bool ReadAllFileNoRLE(istream *is, float *outPtr, int decrPtr, int *outExt)
Read the file from is into outPtr with no RLE encoding.
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)
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
Superclass of transformable binary file readers.
a simple class to control print indentation
Definition vtkIndent.h:29
Store vtkAlgorithm input/output information.
#define VTK_FILEPATH