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
00036 class ITK_EXPORT BMPImageIO : public ImageIOBase
00037 {
00038 public:
00040 typedef BMPImageIO Self;
00041 typedef ImageIOBase Superclass;
00042 typedef SmartPointer<Self> Pointer;
00043
00045 itkNewMacro(Self);
00046
00048 itkTypeMacro(BMPImageIO, Superclass);
00049
00050
00051
00054 virtual bool CanReadFile(const char*) ;
00055
00057 virtual void ReadImageInformation();
00058
00060 virtual void Read(void* buffer);
00061
00062
00063
00066 virtual bool CanWriteFile(const char*);
00067
00069 virtual void WriteImageInformation();
00070
00073 virtual void Write(const void* buffer);
00074
00075
00076 BMPImageIO();
00077 ~BMPImageIO();
00078 void PrintSelf(std::ostream& os, Indent indent) const;
00079
00080 private:
00081 BMPImageIO(const Self&);
00082 void operator=(const Self&);
00083
00084 void SwapBytesIfNecessary(void* buffer, unsigned long numberOfPixels);
00085
00086 std::ifstream m_Ifstream;
00087 std::ofstream m_Ofstream;
00088 long m_BitMapOffset;
00089 bool m_FileLowerLeft;
00090 short m_Depth;
00091 bool m_Allow8BitBMP;
00092 };
00093
00094 }
00095
00096 #endif // __itkBMPImageIO_h