VTK
dox/IO/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 "vtkImageReader2.h"
00035 
00036 //BTX
00037 class vtkTIFFReaderInternal;
00038 //ETX
00039 
00040 class VTK_IO_EXPORT vtkTIFFReader : public vtkImageReader2
00041 {
00042 public:
00043   static vtkTIFFReader *New();
00044   vtkTypeMacro(vtkTIFFReader,vtkImageReader2);
00045   virtual void PrintSelf(ostream& os, vtkIndent indent);
00046 
00048   virtual int CanReadFile(const char* fname);
00049 
00051 
00053   virtual const char* GetFileExtensions()
00054     {
00055     return ".tif .tiff";
00056     }
00058 
00060 
00062   virtual const char* GetDescriptiveName()
00063     {
00064     return "TIFF";
00065     }
00067 
00069   void InitializeColors();
00070 
00072   virtual void ReadVolume(void* buffer);
00073 
00075   virtual void ReadTiles(void* buffer);
00076 
00078 
00088   void SetOrientationType( unsigned int orientationType );
00089   vtkGetMacro( OrientationType, unsigned int );
00091 
00093 
00094   vtkGetMacro( OrientationTypeSpecifiedFlag, bool );
00096 
00098 
00099   vtkSetMacro( OriginSpecifiedFlag, bool );
00100   vtkGetMacro( OriginSpecifiedFlag, bool );
00101   vtkBooleanMacro( OriginSpecifiedFlag, bool );
00103 
00105  */
00106   vtkSetMacro( SpacingSpecifiedFlag, bool );
00107   vtkGetMacro( SpacingSpecifiedFlag, bool );
00108   vtkBooleanMacro( SpacingSpecifiedFlag, bool );
00110 
00112 
00113   void ReadImageInternal( void *, void *outPtr,
00114                           int *outExt, unsigned int size );
00116 
00117 protected:
00118   vtkTIFFReader();
00119   ~vtkTIFFReader();
00120 
00121   enum { NOFORMAT, RGB, GRAYSCALE, PALETTE_RGB, PALETTE_GRAYSCALE, OTHER };
00122 
00123   vtkTIFFReaderInternal *GetInternalImage() { return this->InternalImage; }
00124 
00125   int EvaluateImageAt( void*, void* );
00126 
00127   void GetColor( int index,
00128                  unsigned short *r, unsigned short *g, unsigned short *b );
00129 
00130   void ReadGenericImage( void *out,
00131                          unsigned int vtkNotUsed(width),
00132                          unsigned int height );
00133 
00134   // To support Zeiss images
00135   void ReadTwoSamplesPerPixelImage( void *out,
00136                          unsigned int vtkNotUsed(width),
00137                          unsigned int height );
00138 
00139   unsigned int  GetFormat();
00140   virtual void ExecuteInformation();
00141   virtual void ExecuteData(vtkDataObject *out);
00142 
00143 private:
00144   vtkTIFFReader(const vtkTIFFReader&);  // Not implemented.
00145   void operator=(const vtkTIFFReader&);  // Not implemented.
00146 
00147   unsigned short *ColorRed;
00148   unsigned short *ColorGreen;
00149   unsigned short *ColorBlue;
00150   int TotalColors;
00151   unsigned int ImageFormat;
00152   vtkTIFFReaderInternal *InternalImage;
00153   int *OutputExtent;
00154   vtkIdType *OutputIncrements;
00155   unsigned int OrientationType;
00156   bool OrientationTypeSpecifiedFlag;
00157   bool OriginSpecifiedFlag;
00158   bool SpacingSpecifiedFlag;
00159 };
00160 #endif