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 =========================================================================*/
29 #ifndef vtkTIFFReader_h
30 #define vtkTIFFReader_h
31 
32 #include "vtkImageReader2.h"
33 
34 class VTKIOIMAGE_EXPORT vtkTIFFReader : public vtkImageReader2
35 {
36 public:
37  static vtkTIFFReader *New();
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
44  int CanReadFile(const char* fname) override;
45 
51  const char* GetFileExtensions() override
52  {
53  return ".tif .tiff";
54  }
55 
60  const char* GetDescriptiveName() override
61  {
62  return "TIFF";
63  }
64 
77  void SetOrientationType(unsigned int orientationType);
78  vtkGetMacro(OrientationType, unsigned int)
79 
80  //@{
84  vtkGetMacro(OrientationTypeSpecifiedFlag, bool)
86 
88 
91  vtkSetMacro(OriginSpecifiedFlag, bool)
92  vtkGetMacro(OriginSpecifiedFlag, bool)
93  vtkBooleanMacro(OriginSpecifiedFlag, bool)
95 
97 
100  vtkSetMacro(SpacingSpecifiedFlag, bool)
101  vtkGetMacro(SpacingSpecifiedFlag, bool)
102  vtkBooleanMacro(SpacingSpecifiedFlag, bool)
104 
105 protected:
106  vtkTIFFReader();
107  ~vtkTIFFReader() override;
108 
109  enum { NOFORMAT, RGB, GRAYSCALE, PALETTE_RGB, PALETTE_GRAYSCALE, OTHER };
110 
111  void ExecuteInformation() override;
112  void ExecuteDataWithInformation(vtkDataObject *out, vtkInformation *outInfo) override;
113 
114 private:
115  vtkTIFFReader(const vtkTIFFReader&) = delete;
116  void operator=(const vtkTIFFReader&) = delete;
117 
121  template<typename T>
122  int EvaluateImageAt(T* out, T* in);
123 
127  void GetColor(int index,
128  unsigned short *r, unsigned short *g, unsigned short *b);
129 
130  // To support Zeiss images
131  void ReadTwoSamplesPerPixelImage(void *out,
132  unsigned int vtkNotUsed(width),
133  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  class vtkTIFFReaderInternal;
178 
179  unsigned short *ColorRed;
180  unsigned short *ColorGreen;
181  unsigned short *ColorBlue;
182  int TotalColors;
183  unsigned int ImageFormat;
184  vtkTIFFReaderInternal *InternalImage;
185  int OutputExtent[6];
186  vtkIdType OutputIncrements[3];
187  unsigned int OrientationType;
188  bool OrientationTypeSpecifiedFlag;
189  bool OriginSpecifiedFlag;
190  bool SpacingSpecifiedFlag;
191 };
192 
193 #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:60
read TIFF files
Definition: vtkTIFFReader.h:34
int vtkIdType
Definition: vtkType.h:347
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.
general representation of visualization data
Definition: vtkDataObject.h:64