VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/IO/Image/vtkTIFFReader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkTIFFReader.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00031 #ifndef vtkTIFFReader_h
00032 #define vtkTIFFReader_h
00033 
00034 #include "vtkImageReader2.h"
00035 
00036 class VTKIOIMAGE_EXPORT vtkTIFFReader : public vtkImageReader2
00037 {
00038 public:
00039   static vtkTIFFReader *New();
00040   vtkTypeMacro(vtkTIFFReader, vtkImageReader2)
00041   virtual void PrintSelf(ostream& os, vtkIndent indent);
00042 
00044   virtual int CanReadFile(const char* fname);
00045 
00047 
00049   virtual const char* GetFileExtensions()
00050     {
00051     return ".tif .tiff";
00052     }
00054 
00056 
00058   virtual const char* GetDescriptiveName()
00059     {
00060     return "TIFF";
00061     }
00063 
00065 
00075   void SetOrientationType(unsigned int orientationType);
00076   vtkGetMacro(OrientationType, unsigned int)
00078 
00080 
00081   vtkGetMacro(OrientationTypeSpecifiedFlag, bool)
00083 
00085 
00086   vtkSetMacro(OriginSpecifiedFlag, bool)
00087   vtkGetMacro(OriginSpecifiedFlag, bool)
00088   vtkBooleanMacro(OriginSpecifiedFlag, bool)
00090 
00092 
00093   vtkSetMacro(SpacingSpecifiedFlag, bool)
00094   vtkGetMacro(SpacingSpecifiedFlag, bool)
00095   vtkBooleanMacro(SpacingSpecifiedFlag, bool)
00097 
00098 protected:
00099   vtkTIFFReader();
00100   ~vtkTIFFReader();
00101 
00102   enum { NOFORMAT, RGB, GRAYSCALE, PALETTE_RGB, PALETTE_GRAYSCALE, OTHER };
00103 
00104   virtual void ExecuteInformation();
00105   virtual void ExecuteDataWithInformation(vtkDataObject *out, vtkInformation *outInfo);
00106 
00107 private:
00108   vtkTIFFReader(const vtkTIFFReader&);  // Not implemented.
00109   void operator=(const vtkTIFFReader&);  // Not implemented.
00110 
00112 
00113   template<typename T>
00114   int EvaluateImageAt(T* out, T* in);
00116 
00118 
00119   void GetColor(int index,
00120                 unsigned short *r, unsigned short *g, unsigned short *b);
00122 
00123   // To support Zeiss images
00124   void ReadTwoSamplesPerPixelImage(void *out,
00125                                    unsigned int vtkNotUsed(width),
00126                                    unsigned int height);
00127 
00128   unsigned int GetFormat();
00129 
00131   void Initialize();
00132 
00134 
00135   template<typename T>
00136   void ReadImageInternal(T* buffer);
00138 
00140 
00141   template<typename T>
00142   void ReadVolume(T* buffer);
00144 
00146   void ReadTiles(void* buffer);
00147 
00149 
00150   template<typename T>
00151   void ReadGenericImage(T* out, unsigned int width, unsigned int height);
00153 
00155 
00157   template <typename T>
00158   void Process(T *outPtr, int outExtent[6], vtkIdType outIncr[3]);
00160 
00162 
00163   template <typename T>
00164   void Process2(T *outPtr, int *outExt);
00166 
00167   class vtkTIFFReaderInternal;
00168 
00169   unsigned short *ColorRed;
00170   unsigned short *ColorGreen;
00171   unsigned short *ColorBlue;
00172   int TotalColors;
00173   unsigned int ImageFormat;
00174   vtkTIFFReaderInternal *InternalImage;
00175   int OutputExtent[6];
00176   vtkIdType OutputIncrements[3];
00177   unsigned int OrientationType;
00178   bool OrientationTypeSpecifiedFlag;
00179   bool OriginSpecifiedFlag;
00180   bool SpacingSpecifiedFlag;
00181 };
00182 
00183 #endif