Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkTIFFImageIO_h
00018 #define __itkTIFFImageIO_h
00019
00020 #include "itkImageIOBase.h"
00021 #include <fstream>
00022
00023 namespace itk
00024 {
00025
00026
00027 class TIFFReaderInternal;
00028
00029
00030
00038 class ITK_EXPORT TIFFImageIO : public ImageIOBase
00039 {
00040 public:
00042 typedef TIFFImageIO Self;
00043 typedef ImageIOBase Superclass;
00044 typedef SmartPointer<Self> Pointer;
00045
00047 itkNewMacro(Self);
00048
00050 itkTypeMacro(TIFFImageIO, ImageIOBase);
00051
00052
00053
00056 virtual bool CanReadFile(const char*);
00057
00059 virtual void ReadImageInformation();
00060
00062 virtual void Read(void* buffer);
00063
00065 virtual void ReadVolume(void* buffer);
00066
00068 virtual void ReadTiles(void* buffer);
00069
00070
00071
00074 virtual bool CanWriteFile(const char*);
00075
00078 virtual void WriteImageInformation();
00079
00082 virtual void Write(const void* buffer);
00083
00084 enum { NOFORMAT, RGB_, GRAYSCALE, PALETTE_RGB, PALETTE_GRAYSCALE, OTHER };
00085
00086
00087 enum
00088 {
00089 NoCompression,
00090 PackBits,
00091 JPEG,
00092 Deflate,
00093 LZW
00094 };
00095
00096
00097
00098
00099
00100 void SetCompressionToNoCompression() { this->SetCompression(NoCompression); }
00101 void SetCompressionToPackBits() { this->SetCompression(PackBits); }
00102 void SetCompressionToJPEG() { this->SetCompression(JPEG); }
00103 void SetCompressionToDeflate() { this->SetCompression(Deflate); }
00104 void SetCompressionToLZW() { this->SetCompression(LZW); }
00105
00106 void SetCompression(int compression)
00107 {
00108 m_Compression = compression;
00109
00110
00111
00112
00113
00114 if (compression == NoCompression)
00115 {
00116 this->SetUseCompression(false);
00117 }
00118 else
00119 {
00120 this->SetUseCompression(true);
00121 }
00122 }
00123
00124
00125 protected:
00126 TIFFImageIO();
00127 ~TIFFImageIO();
00128 void PrintSelf(std::ostream& os, Indent indent) const;
00129
00130 void InternalWrite(const void* buffer);
00131
00132 void InitializeColors();
00133 void ReadGenericImage( void *out,
00134 unsigned int itkNotUsed(width),
00135 unsigned int height );
00136
00137
00138 void ReadTwoSamplesPerPixelImage( void *out,
00139 unsigned int itkNotUsed(width),
00140 unsigned int height );
00141
00142
00143 int EvaluateImageAt( void* out, void* in );
00144
00145 unsigned int GetFormat();
00146
00147 void GetColor( int index, unsigned short *red,
00148 unsigned short *green, unsigned short *blue );
00149
00150 bool CanFindTIFFTag(unsigned int t);
00151
00152 void *ReadRawByteFromTag( unsigned int t, short &value_count );
00153
00154 TIFFReaderInternal * m_InternalImage;
00155 int m_Compression;
00156 private:
00157 TIFFImageIO(const Self&);
00158 void operator=(const Self&);
00159
00160 unsigned short *m_ColorRed;
00161 unsigned short *m_ColorGreen;
00162 unsigned short *m_ColorBlue;
00163 int m_TotalColors;
00164 unsigned int m_ImageFormat;
00165 };
00166
00167 }
00168
00169 #endif // __itkTIFFImageIO_h
00170