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

itkBMPImageIO.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkBMPImageIO.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-10-03 16:09:47 $
00007   Version:   $1.0$
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 __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 #include "itkRGBPixel.h"
00028 
00029 namespace itk
00030 {
00031 
00039 class ITK_EXPORT BMPImageIO : public ImageIOBase
00040 {
00041 public:
00043   typedef BMPImageIO              Self;
00044   typedef ImageIOBase             Superclass;
00045   typedef SmartPointer<Self>      Pointer;
00046   typedef RGBPixel<unsigned char> RGBPixelType;
00047 
00049   itkNewMacro(Self);
00050 
00052   itkTypeMacro(BMPImageIO, Superclass);
00053 
00054   /*-------- This part of the interfaces deals with reading data. ----- */
00055 
00058   virtual bool CanReadFile(const char*);
00059 
00061   virtual void ReadImageInformation();
00062 
00064   virtual void Read(void* buffer);
00065 
00066   /*-------- This part of the interfaces deals with writing data. ----- */
00067 
00070   virtual bool CanWriteFile(const char*);
00071 
00073   virtual void WriteImageInformation();
00074 
00077   virtual void Write(const void* buffer);
00078 
00079 
00080   BMPImageIO();
00081   ~BMPImageIO();
00082   void PrintSelf(std::ostream& os, Indent indent) const;
00083   
00084 private:
00085   BMPImageIO(const Self&); //purposely not implemented
00086   void operator=(const Self&); //purposely not implemented
00087 
00088   void SwapBytesIfNecessary(void* buffer, unsigned long numberOfPixels);
00089 
00091   void Write32BitsInteger(unsigned int   value);
00092   void Write16BitsInteger(unsigned short value);
00094 
00095   std::ifstream             m_Ifstream;
00096   std::ofstream             m_Ofstream;
00097   long                      m_BitMapOffset;
00098   bool                      m_FileLowerLeft;
00099   short                     m_Depth;
00100   bool                      m_Allow8BitBMP;
00101   unsigned short            m_NumberOfColors;
00102   unsigned int              m_ColorTableSize;
00103   long                      m_BMPCompression;
00104   unsigned long             m_BMPDataSize;
00105   std::vector<RGBPixelType> m_ColorPalette;
00106  
00107 };
00108 
00109 } // end namespace itk
00110 
00111 #endif // __itkBMPImageIO_h
00112 

Generated at Mon Jul 12 2010 17:57:37 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000