VTK  9.7.1
vtkBMPReader.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
34 #ifndef vtkBMPReader_h
35 #define vtkBMPReader_h
36 
37 #include "vtkIOImageModule.h" // For export macro
38 #include "vtkImageReader.h"
39 VTK_ABI_NAMESPACE_BEGIN
40 class vtkLookupTable;
41 
42 class VTKIOIMAGE_EXPORT vtkBMPReader : public vtkImageReader
43 {
44 public:
45  static vtkBMPReader* New();
46  vtkTypeMacro(vtkBMPReader, vtkImageReader);
47 
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
51 
54  vtkGetMacro(Depth, int);
56 
58 
63  int CanReadFile(VTK_FILEPATH const char* fname) override;
64  int CanReadFile(vtkResourceStream* stream) override;
66 
72  const char* GetFileExtensions() override { return ".bmp"; }
73 
77  const char* GetDescriptiveName() override { return "Windows BMP"; }
78 
80 
85  vtkSetMacro(Allow8BitBMP, vtkTypeBool);
86  vtkGetMacro(Allow8BitBMP, vtkTypeBool);
87  vtkBooleanMacro(Allow8BitBMP, vtkTypeBool);
89 
90  vtkGetObjectMacro(LookupTable, vtkLookupTable);
91 
93 
96  vtkGetMacro(Colors, unsigned char*);
98 
99 protected:
100  vtkBMPReader();
101  ~vtkBMPReader() override;
102 
103  unsigned char* Colors = nullptr;
104  short Depth = 0;
105  bool Validated = false;
106  vtkTypeBool Allow8BitBMP = false;
108 
109  void ComputeDataIncrements() override;
110  void ExecuteInformation() override;
111  void ExecuteDataWithInformation(vtkDataObject* out, vtkInformation* outInfo) override;
112 
113 private:
114  vtkBMPReader(const vtkBMPReader&) = delete;
115  void operator=(const vtkBMPReader&) = delete;
116 
117  bool ReadAndCheckHeader(
118  vtkResourceStream* stream, bool quiet, vtkTypeInt32& offset, vtkTypeInt32& infoSize) const;
119 };
120 VTK_ABI_NAMESPACE_END
121 #endif
Abstract class used for custom streams.
Store vtkAlgorithm input/output information.
read Windows BMP files
Definition: vtkBMPReader.h:42
virtual void ComputeDataIncrements()
map scalar values into colors via a lookup table
vtkLookupTable * LookupTable
Definition: vtkBMPReader.h:107
static vtkImageReader * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int vtkTypeBool
Definition: vtkABI.h:64
const char * GetDescriptiveName() override
Return a descriptive name for the file format that might be useful in a GUI.
Definition: vtkBMPReader.h:77
a simple class to control print indentation
Definition: vtkIndent.h:28
Superclass of transformable binary file readers.
virtual void ExecuteInformation()
int CanReadFile(const char *) override
vtkImageReader itself can read raw binary files.
void ExecuteDataWithInformation(vtkDataObject *data, vtkInformation *outInfo) override
This is a convenience method that is implemented in many subclasses instead of RequestData.
#define VTK_FILEPATH
const char * GetFileExtensions() override
Get the file extensions for this format.
Definition: vtkBMPReader.h:72
general representation of visualization data
Definition: vtkDataObject.h:55