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=========================================================================*/
32#ifndef vtkHDRReader_h
33#define vtkHDRReader_h
34
35#include "vtkIOImageModule.h" // For export macro
36#include "vtkImageReader.h"
37#include <string> // for std::string
38#include <vector> // for std::vector
39
40class VTKIOIMAGE_EXPORT vtkHDRReader : public vtkImageReader
41{
42public:
43 static vtkHDRReader* New();
45
46 void PrintSelf(ostream& os, vtkIndent indent) override;
47
49 {
50 FORMAT_32BIT_RLE_RGBE = 0,
51 FORMAT_32BIT_RLE_XYZE
52 };
53
55
58 vtkGetMacro(Format, int);
60
62
66 vtkGetMacro(Gamma, double);
68
70
74 vtkGetMacro(Exposure, double);
76
78
82 vtkGetMacro(PixelAspect, double);
84
88 int CanReadFile(VTK_FILEPATH const char* fname) override;
89
95 const char* GetFileExtensions() override { return ".hdr .pic"; }
96
100 const char* GetDescriptiveName() override { return "Radiance HDR"; }
101
102protected:
104 ~vtkHDRReader() override;
105
108 double Gamma;
109 double Exposure;
111
115 bool FlippedX = false;
116
120 bool SwappedAxis = false;
121
122 void ExecuteInformation() override;
124 bool HDRReaderUpdateSlice(float* outPtr, int* outExt);
125 void HDRReaderUpdate(vtkImageData* data, float* outPtr);
126
131 bool HasError(istream* is);
132
133 int GetWidth() const;
134 int GetHeight() const;
135
141
142 void ConvertAllDataFromRGBToXYZ(float* outPtr, int size);
143
144 void FillOutPtrRLE(int* outExt, float*& outPtr, std::vector<unsigned char>& lineBuffer);
145 void FillOutPtrNoRLE(int* outExt, float*& outPtr, std::vector<unsigned char>& lineBuffer);
146
151 bool ReadAllFileNoRLE(istream* is, float* outPtr, int decrPtr, int* outExt);
152
157 bool ReadLineRLE(istream* is, unsigned char* lineBufferPtr);
158
162 void RGBE2Float(unsigned char rgbe[4], float& r, float& g, float& b);
163
169 static void XYZ2RGB(const float convertMatrix[3][3], float& r, float& g, float& b);
170
171private:
172 vtkHDRReader(const vtkHDRReader&) = delete;
173 void operator=(const vtkHDRReader&) = delete;
174};
175#endif
general representation of visualization data
Definition: vtkDataObject.h:69
read Radiance HDR files
Definition: vtkHDRReader.h:41
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:100
FormatType Format
Definition: vtkHDRReader.h:107
~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:110
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:95
std::string ProgramType
Definition: vtkHDRReader.h:106
double Exposure
Definition: vtkHDRReader.h:109
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:57
Superclass of transformable binary file readers.
a simple class to control print indentation
Definition: vtkIndent.h:43
Store vtkAlgorithm input/output information.
@ size
Definition: vtkX3D.h:259
@ data
Definition: vtkX3D.h:321
@ string
Definition: vtkX3D.h:496
#define VTK_FILEPATH