VTK
dox/IO/Image/vtkTIFFReader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkTIFFReader.h,v
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 "vtkIOImageModule.h" // For export macro
00035 #include "vtkImageReader2.h"
00036 
00037 //BTX
00038 class vtkTIFFReaderInternal;
00039 //ETX
00040 
00041 class VTKIOIMAGE_EXPORT vtkTIFFReader : public vtkImageReader2
00042 {
00043 public:
00044   static vtkTIFFReader *New();
00045   vtkTypeMacro(vtkTIFFReader,vtkImageReader2);
00046   virtual void PrintSelf(ostream& os, vtkIndent indent);
00047 
00049   virtual int CanReadFile(const char* fname);
00050 
00052 
00054   virtual const char* GetFileExtensions()
00055     {
00056     return ".tif .tiff";
00057     }
00059 
00061 
00063   virtual const char* GetDescriptiveName()
00064     {
00065     return "TIFF";
00066     }
00068 
00070   void InitializeColors();
00071 
00073   virtual void ReadVolume(void* buffer);
00074 
00076   virtual void ReadTiles(void* buffer);
00077 
00079 
00089   void SetOrientationType( unsigned int orientationType );
00090   vtkGetMacro( OrientationType, unsigned int );
00092 
00094 
00095   vtkGetMacro( OrientationTypeSpecifiedFlag, bool );
00097 
00099 
00100   vtkSetMacro( OriginSpecifiedFlag, bool );
00101   vtkGetMacro( OriginSpecifiedFlag, bool );
00102   vtkBooleanMacro( OriginSpecifiedFlag, bool );
00104 
00106  */
00107   vtkSetMacro( SpacingSpecifiedFlag, bool );
00108   vtkGetMacro( SpacingSpecifiedFlag, bool );
00109   vtkBooleanMacro( SpacingSpecifiedFlag, bool );
00111 
00113 
00114   void ReadImageInternal( void *, void *outPtr,
00115                           int *outExt, unsigned int size );
00117 
00118 protected:
00119   vtkTIFFReader();
00120   ~vtkTIFFReader();
00121 
00122   enum { NOFORMAT, RGB, GRAYSCALE, PALETTE_RGB, PALETTE_GRAYSCALE, OTHER };
00123 
00124   vtkTIFFReaderInternal *GetInternalImage() { return this->InternalImage; }
00125 
00126   int EvaluateImageAt( void*, void* );
00127 
00128   void GetColor( int index,
00129                  unsigned short *r, unsigned short *g, unsigned short *b );
00130 
00131   void ReadGenericImage( void *out,
00132                          unsigned int vtkNotUsed(width),
00133                          unsigned int height );
00134 
00135   // To support Zeiss images
00136   void ReadTwoSamplesPerPixelImage( void *out,
00137                          unsigned int vtkNotUsed(width),
00138                          unsigned int height );
00139 
00140   unsigned int  GetFormat();
00141   virtual void ExecuteInformation();
00142   virtual void ExecuteDataWithInformation(vtkDataObject *out, vtkInformation *outInfo);
00143 
00144 private:
00145   vtkTIFFReader(const vtkTIFFReader&);  // Not implemented.
00146   void operator=(const vtkTIFFReader&);  // Not implemented.
00147 
00148   unsigned short *ColorRed;
00149   unsigned short *ColorGreen;
00150   unsigned short *ColorBlue;
00151   int TotalColors;
00152   unsigned int ImageFormat;
00153   vtkTIFFReaderInternal *InternalImage;
00154   int OutputExtent[6];
00155   vtkIdType OutputIncrements[3];
00156   unsigned int OrientationType;
00157   bool OrientationTypeSpecifiedFlag;
00158   bool OriginSpecifiedFlag;
00159   bool SpacingSpecifiedFlag;
00160 };
00161 #endif