Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkTIFFImageIO.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkTIFFImageIO.h,v $
00005   Language:  C++
00006   Date:      $Date: 2004/01/08 00:39:08 $
00007   Version:   $Revision: 1.2 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkTIFFImageIO_h
00018 #define __itkTIFFImageIO_h
00019 
00020 #ifdef _MSC_VER
00021 #pragma warning ( disable : 4786 )
00022 #endif
00023 
00024 #include <fstream>
00025 #include "itkImageIOBase.h"
00026 
00027 namespace itk
00028 {
00029 
00030 /* \brief ImageIO object for reading and writing TIFF images
00031  *
00032  * \ingroup IOFilters
00033  *
00034  */
00035 
00036 //BTX
00037 class TIFFReaderInternal;
00038 //ETX
00039 
00040 class ITK_EXPORT TIFFImageIO : public ImageIOBase
00041 {
00042 public:
00044   typedef TIFFImageIO            Self;
00045   typedef ImageIOBase  Superclass;
00046   typedef SmartPointer<Self>  Pointer;
00047   
00049   itkNewMacro(Self);
00050 
00052   itkTypeMacro(TIFFImageIO, ImageIOBase);
00053 
00054   /*-------- This part of the interface deals with reading data. ------ */
00055 
00058   virtual bool CanReadFile(const char*);
00059   
00061   virtual void ReadImageInformation();
00062   
00064   virtual const std::type_info& GetPixelType() const;
00065 
00067   virtual void Read(void* buffer);
00068 
00070   virtual void ReadVolume(void* buffer);
00071 
00075   virtual unsigned int GetComponentSize() const;
00076 
00077   /*-------- This part of the interfaces deals with writing data. ----- */
00078 
00081   virtual bool CanWriteFile(const char*);
00082 
00085   virtual void WriteImageInformation();
00086 
00089   virtual void Write(const void* buffer);
00090 
00091   enum { NOFORMAT, RGB_, GRAYSCALE, PALETTE_RGB, PALETTE_GRAYSCALE, OTHER };
00092 
00093   //BTX
00094   enum { // Compression types
00095     NoCompression,
00096     PackBits,
00097     JPEG,
00098     Deflate,
00099     LZW
00100   };
00101   //ETX
00102 
00103   // Description:
00104   // Set compression type. Sinze LZW compression is patented outside US, the
00105   // additional work steps have to be taken in order to use that compression.
00106   void SetCompressionToNoCompression() { this->SetCompression(NoCompression); }
00107   void SetCompressionToPackBits()      { this->SetCompression(PackBits); }
00108   void SetCompressionToJPEG()          { this->SetCompression(JPEG); }
00109   void SetCompressionToDeflate()       { this->SetCompression(Deflate); }
00110   void SetCompressionToLZW()           { this->SetCompression(LZW); }
00111 
00112   itkSetMacro(Compression,int);
00113 
00114 protected:
00115   TIFFImageIO();
00116   ~TIFFImageIO();
00117   void PrintSelf(std::ostream& os, Indent indent) const;
00118 
00119   void WriteSlice(std::string& fileName, const void* buffer);
00120 
00121   void InitializeColors();
00122   void ReadGenericImage( void *out, 
00123                          unsigned int itkNotUsed(width), 
00124                          unsigned int height );
00125   int EvaluateImageAt( void* out, void* in );
00126 
00127   unsigned int  GetFormat();
00128 
00129   void GetColor( int index, unsigned short *red, 
00130                                  unsigned short *green, unsigned short *blue );
00131 
00132 
00133 private:
00134   TIFFImageIO(const Self&); //purposely not implemented
00135   void operator=(const Self&); //purposely not implemented
00136 
00137   unsigned short *ColorRed;
00138   unsigned short *ColorGreen;
00139   unsigned short *ColorBlue;
00140   int TotalColors;
00141   unsigned int ImageFormat;
00142   TIFFReaderInternal * m_InternalImage;
00143   int m_Compression;
00144 };
00145 
00146 } // end namespace itk
00147 
00148 #endif // __itkTIFFImageIO_h
00149 

Generated at Sun Jan 25 13:19:46 2004 for ITK by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-2000