VTK  9.1.0
vtkHDRReader.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkHDRReader.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
132#ifndef vtkHDRReader_h
133#define vtkHDRReader_h
134
135#include "vtkIOImageModule.h" // For export macro
136#include "vtkImageReader.h"
137#include <string> // for std::string
138#include <vector> // for std::vector
139
140class VTKIOIMAGE_EXPORT vtkHDRReader : public vtkImageReader
141{
142public:
143 static vtkHDRReader* New();
145
146 void PrintSelf(ostream& os, vtkIndent indent) override;
147
149 {
150 FORMAT_32BIT_RLE_RGBE = 0,
151 FORMAT_32BIT_RLE_XYZE
152 };
153
155
158 vtkGetMacro(Format, int);
160
162
166 vtkGetMacro(Gamma, double);
168
170
174 vtkGetMacro(Exposure, double);
176
178
182 vtkGetMacro(PixelAspect, double);
184
188 int CanReadFile(VTK_FILEPATH const char* fname) override;
189
195 const char* GetFileExtensions() override { return ".hdr .pic"; }
196
200 const char* GetDescriptiveName() override { return "Radiance HDR"; }
201
202protected:
204 ~vtkHDRReader() override;
205
208 double Gamma;
209 double Exposure;
211
215 bool FlippedX = false;
216
220 bool SwappedAxis = false;
221
222 void ExecuteInformation() override;
224 bool HDRReaderUpdateSlice(float* outPtr, int* outExt);
225 void HDRReaderUpdate(vtkImageData* data, float* outPtr);
226
231 bool HasError(istream* is);
232
233 int GetWidth() const;
234 int GetHeight() const;
235
241
242 void ConvertAllDataFromRGBToXYZ(float* outPtr, int size);
243
244 void FillOutPtrRLE(int* outExt, float*& outPtr, std::vector<unsigned char>& lineBuffer);
245 void FillOutPtrNoRLE(int* outExt, float*& outPtr, std::vector<unsigned char>& lineBuffer);
246
251 bool ReadAllFileNoRLE(istream* is, float* outPtr, int decrPtr, int* outExt);
252
257 bool ReadLineRLE(istream* is, unsigned char* lineBufferPtr);
258
262 void RGBE2Float(unsigned char rgbe[4], float& r, float& g, float& b);
263
269 static void XYZ2RGB(const float convertMatrix[3][3], float& r, float& g, float& b);
270
271private:
272 vtkHDRReader(const vtkHDRReader&) = delete;
273 void operator=(const vtkHDRReader&) = delete;
274};
275#endif
general representation of visualization data
read Radiance HDR files
Definition: vtkHDRReader.h:141
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.
Definition: vtkHDRReader.h:200
FormatType Format
Definition: vtkHDRReader.h:207
~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
Definition: vtkHDRReader.h:210
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.
Definition: vtkHDRReader.h:195
std::string ProgramType
Definition: vtkHDRReader.h:206
double Exposure
Definition: vtkHDRReader.h:209
bool HasError(istream *is)
If the stream has an error, close the file and return true.
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
Superclass of transformable binary file readers.
a simple class to control print indentation
Definition: vtkIndent.h:113
Store vtkAlgorithm input/output information.
@ size
Definition: vtkX3D.h:259
@ data
Definition: vtkX3D.h:321
@ string
Definition: vtkX3D.h:496
#define VTK_FILEPATH