VTK  9.3.1
vtkTIFFReader.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
17 #ifndef vtkTIFFReader_h
18 #define vtkTIFFReader_h
19 
20 #include "vtkImageReader2.h"
21 
22 VTK_ABI_NAMESPACE_BEGIN
23 class VTKIOIMAGE_EXPORT vtkTIFFReader : public vtkImageReader2
24 {
25 public:
26  static vtkTIFFReader* New();
28  void PrintSelf(ostream& os, vtkIndent indent) override;
29 
33  int CanReadFile(VTK_FILEPATH const char* fname) override;
34 
40  const char* GetFileExtensions() override { return ".tif .tiff"; }
41 
46  const char* GetDescriptiveName() override { return "TIFF"; }
47 
60  void SetOrientationType(unsigned int orientationType);
61  vtkGetMacro(OrientationType, unsigned int);
62 
64 
67  vtkGetMacro(OrientationTypeSpecifiedFlag, bool);
69 
71 
74  vtkSetMacro(OriginSpecifiedFlag, bool);
75  vtkGetMacro(OriginSpecifiedFlag, bool);
76  vtkBooleanMacro(OriginSpecifiedFlag, bool);
78 
80 
83  vtkSetMacro(SpacingSpecifiedFlag, bool);
84  vtkGetMacro(SpacingSpecifiedFlag, bool);
85  vtkBooleanMacro(SpacingSpecifiedFlag, bool);
87 
89 
93  vtkSetMacro(IgnoreColorMap, bool);
94  vtkGetMacro(IgnoreColorMap, bool);
95  vtkBooleanMacro(IgnoreColorMap, bool);
97 protected:
98  vtkTIFFReader();
99  ~vtkTIFFReader() override;
100 
101  enum
102  {
108  OTHER
109  };
110 
111  void ExecuteInformation() override;
112  void ExecuteDataWithInformation(vtkDataObject* out, vtkInformation* outInfo) override;
113 
116 
117 private:
118  vtkTIFFReader(const vtkTIFFReader&) = delete;
119  void operator=(const vtkTIFFReader&) = delete;
120 
124  template <typename T>
125  int EvaluateImageAt(T* out, T* in);
126 
130  void GetColor(int index, unsigned short* r, unsigned short* g, unsigned short* b);
131 
132  // To support Zeiss images
133  void ReadTwoSamplesPerPixelImage(void* out, unsigned int vtkNotUsed(width), unsigned int height);
134 
135  unsigned int GetFormat();
136 
140  void Initialize();
141 
145  template <typename T>
146  void ReadImageInternal(T* buffer);
147 
151  template <typename T>
152  void ReadVolume(T* buffer);
153 
157  void ReadTiles(void* buffer);
158 
162  template <typename T>
163  void ReadGenericImage(T* out, unsigned int width, unsigned int height);
164 
168  template <typename T>
169  void Process(T* outPtr, int outExtent[6], vtkIdType outIncr[3]);
170 
174  template <typename T>
175  void Process2(T* outPtr, int* outExt);
176 
177  unsigned short* ColorRed;
178  unsigned short* ColorGreen;
179  unsigned short* ColorBlue;
180  int TotalColors;
181  unsigned int ImageFormat;
182  int OutputExtent[6];
183  vtkIdType OutputIncrements[3];
184  unsigned int OrientationType;
185  bool OrientationTypeSpecifiedFlag;
186  bool OriginSpecifiedFlag;
187  bool SpacingSpecifiedFlag;
188  bool IgnoreColorMap;
189 };
190 
191 VTK_ABI_NAMESPACE_END
192 #endif
static vtkImageReader2 * New()
Store vtkAlgorithm input/output information.
const char * GetDescriptiveName() override
Return a descriptive name for the file format that might be useful in a GUI.
Definition: vtkTIFFReader.h:46
virtual int CanReadFile(VTK_FILEPATH const char *vtkNotUsed(fname))
Return non zero if the reader can read the given file name.
read TIFF files
Definition: vtkTIFFReader.h:23
int vtkIdType
Definition: vtkType.h:315
DatabaseFormatType GetFormat(const Ioss::GroupingEntity *entity)
Given any GroupingEntity pointer, returns the format that the associated database is in...
void ExecuteDataWithInformation(vtkDataObject *data, vtkInformation *outInfo) override
This is a convenience method that is implemented in many subclasses instead of RequestData.
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void ExecuteInformation()
Superclass of binary file readers.
vtkTIFFReaderInternal * InternalImage
#define VTK_FILEPATH
const char * GetFileExtensions() override
Get the file extensions for this format.
Definition: vtkTIFFReader.h:40
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
general representation of visualization data
Definition: vtkDataObject.h:54