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
#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
00031
00032
00033
00034
00035
00036
00037
class TIFFReaderInternal;
00038
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
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
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
00094
enum {
00095 NoCompression,
00096 PackBits,
00097 JPEG,
00098 Deflate,
00099 LZW
00100 };
00101
00102
00103
00104
00105
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&);
00135
void operator=(
const Self&);
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 }
00147
00148
#endif // __itkTIFFImageIO_h
00149