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: 2006/12/18 19:38:22 $
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  
00090   std::ifstream   m_Ifstream;
00091   std::ofstream   m_Ofstream;
00092   long            m_BitMapOffset;
00093   bool            m_FileLowerLeft;
00094   short           m_Depth;
00095   bool            m_Allow8BitBMP;
00096   unsigned short  m_NumberOfColors;
00097   long            m_BMPCompression;
00098   unsigned long   m_BMPDataSize;
00099   std::vector<RGBPixelType> m_ColorPalette;
00100  
00101 };
00102 
00103 } // end namespace itk
00104 
00105 #endif // __itkBMPImageIO_h
00106 

Generated at Sun Mar 11 23:38:46 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000