VTK  9.5.20251113
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
124#ifndef vtkHDRReader_h
125#define vtkHDRReader_h
126
127#include "vtkIOImageModule.h" // For export macro
128#include "vtkImageReader.h"
129#include <string> // for std::string
130#include <vector> // for std::vector
131
132VTK_ABI_NAMESPACE_BEGIN
133class VTKIOIMAGE_EXPORT vtkHDRReader : public vtkImageReader
134{
135public:
136 static vtkHDRReader* New();
138
139 void PrintSelf(ostream& os, vtkIndent indent) override;
140
142 {
143 FORMAT_32BIT_RLE_RGBE = 0,
144 FORMAT_32BIT_RLE_XYZE
145 };
146
148
151 vtkGetMacro(Format, int);
153
155
159 vtkGetMacro(Gamma, double);
161
163
167 vtkGetMacro(Exposure, double);
169
171
175 vtkGetMacro(PixelAspect, double);
177
181 int CanReadFile(VTK_FILEPATH const char* fname) override;
182
188 const char* GetFileExtensions() override { return ".hdr .pic"; }
189
193 const char* GetDescriptiveName() override { return "Radiance HDR"; }
194
195protected:
197 ~vtkHDRReader() override;
198
199 std::string ProgramType;
201 double Gamma;
202 double Exposure;
204
208 bool FlippedX = false;
209
213 bool SwappedAxis = false;
214
215 void ExecuteInformation() override;
217 bool HDRReaderUpdateSlice(float* outPtr, int* outExt);
218 void HDRReaderUpdate(vtkImageData* data, float* outPtr);
219
224 bool HasError(istream* is);
225
226 int GetWidth() const;
227 int GetHeight() const;
228
234
235 void ConvertAllDataFromRGBToXYZ(float* outPtr, int size);
236
237 void FillOutPtrRLE(int* outExt, float*& outPtr, std::vector<unsigned char>& lineBuffer);
238 void FillOutPtrNoRLE(int* outExt, float*& outPtr, std::vector<unsigned char>& lineBuffer);
239
244 bool ReadAllFileNoRLE(istream* is, float* outPtr, int decrPtr, int* outExt);
245
250 bool ReadLineRLE(istream* is, unsigned char* lineBufferPtr);
251
255 void RGBE2Float(unsigned char rgbe[4], float& r, float& g, float& b);
256
262 static void XYZ2RGB(const float convertMatrix[3][3], double gamma, float& r, float& g, float& b);
263
264private:
265 vtkHDRReader(const vtkHDRReader&) = delete;
266 void operator=(const vtkHDRReader&) = delete;
267};
268VTK_ABI_NAMESPACE_END
269#endif
general representation of visualization data
read Radiance HDR files
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)
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.
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.
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)
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
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:108
Store vtkAlgorithm input/output information.
#define VTK_FILEPATH