00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkBMPImageIO_h
00018 #define __itkBMPImageIO_h
00019
00020 #ifdef _MSC_VER
00021 #pragma warning ( disable : 4786 )
00022 #endif
00023
00024 #include <fstream>
00025 #include "itkImageIOBase.h"
00026 #include <stdio.h>
00027
00028 namespace itk
00029 {
00030
00038 class ITK_EXPORT BMPImageIO : public ImageIOBase
00039 {
00040 public:
00042 typedef BMPImageIO Self;
00043 typedef ImageIOBase Superclass;
00044 typedef SmartPointer<Self> Pointer;
00045
00047 itkNewMacro(Self);
00048
00050 itkTypeMacro(BMPImageIO, Superclass);
00051
00052
00053
00056 virtual bool CanReadFile(const char*) ;
00057
00059 virtual void ReadImageInformation();
00060
00062 virtual void Read(void* buffer);
00063
00064
00065
00068 virtual bool CanWriteFile(const char*);
00069
00071 virtual void WriteImageInformation();
00072
00075 virtual void Write(const void* buffer);
00076
00077
00078 BMPImageIO();
00079 ~BMPImageIO();
00080 void PrintSelf(std::ostream& os, Indent indent) const;
00081
00082 private:
00083 BMPImageIO(const Self&);
00084 void operator=(const Self&);
00085
00086 void SwapBytesIfNecessary(void* buffer, unsigned long numberOfPixels);
00087
00088 std::ifstream m_Ifstream;
00089 std::ofstream m_Ofstream;
00090 long m_BitMapOffset;
00091 bool m_FileLowerLeft;
00092 short m_Depth;
00093 bool m_Allow8BitBMP;
00094 };
00095
00096 }
00097
00098 #endif // __itkBMPImageIO_h