VTK
vtkTIFFReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTIFFReader.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 vtkTIFFReader_h
33 #define vtkTIFFReader_h
34 
35 #include "vtkImageReader2.h"
36 
37 class VTKIOIMAGE_EXPORT vtkTIFFReader : public vtkImageReader2
38 {
39 public:
40  static vtkTIFFReader *New();
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
47  int CanReadFile(const char* fname) override;
48 
54  const char* GetFileExtensions() override
55  {
56  return ".tif .tiff";
57  }
58 
63  const char* GetDescriptiveName() override
64  {
65  return "TIFF";
66  }
67 
80  void SetOrientationType(unsigned int orientationType);
81  vtkGetMacro(OrientationType, unsigned int)
82 
83  //@{
87  vtkGetMacro(OrientationTypeSpecifiedFlag, bool)
89 
91 
94  vtkSetMacro(OriginSpecifiedFlag, bool)
95  vtkGetMacro(OriginSpecifiedFlag, bool)
96  vtkBooleanMacro(OriginSpecifiedFlag, bool)
98 
100 
103  vtkSetMacro(SpacingSpecifiedFlag, bool)
104  vtkGetMacro(SpacingSpecifiedFlag, bool)
105  vtkBooleanMacro(SpacingSpecifiedFlag, bool)
107 
108 protected:
109  vtkTIFFReader();
110  ~vtkTIFFReader() override;
111 
112  enum { NOFORMAT, RGB, GRAYSCALE, PALETTE_RGB, PALETTE_GRAYSCALE, OTHER };
113 
114  void ExecuteInformation() override;
115  void ExecuteDataWithInformation(vtkDataObject *out, vtkInformation *outInfo) override;
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,
131  unsigned short *r, unsigned short *g, unsigned short *b);
132 
133  // To support Zeiss images
134  void ReadTwoSamplesPerPixelImage(void *out,
135  unsigned int vtkNotUsed(width),
136  unsigned int height);
137 
138  unsigned int GetFormat();
139 
143  void Initialize();
144 
148  template<typename T>
149  void ReadImageInternal(T* buffer);
150 
154  template<typename T>
155  void ReadVolume(T* buffer);
156 
160  void ReadTiles(void* buffer);
161 
165  template<typename T>
166  void ReadGenericImage(T* out, unsigned int width, unsigned int height);
167 
171  template <typename T>
172  void Process(T *outPtr, int outExtent[6], vtkIdType outIncr[3]);
173 
177  template <typename T>
178  void Process2(T *outPtr, int *outExt);
179 
180  class vtkTIFFReaderInternal;
181 
182  unsigned short *ColorRed;
183  unsigned short *ColorGreen;
184  unsigned short *ColorBlue;
185  int TotalColors;
186  unsigned int ImageFormat;
187  vtkTIFFReaderInternal *InternalImage;
188  int OutputExtent[6];
189  vtkIdType OutputIncrements[3];
190  unsigned int OrientationType;
191  bool OrientationTypeSpecifiedFlag;
192  bool OriginSpecifiedFlag;
193  bool SpacingSpecifiedFlag;
194 };
195 
196 #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:63
read TIFF files
Definition: vtkTIFFReader.h:37
int vtkIdType
Definition: vtkType.h:345
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:39
virtual void ExecuteInformation()
Superclass of binary file readers.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
general representation of visualization data
Definition: vtkDataObject.h:64