ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkGiplImageIO.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkGiplImageIO_h
00019 #define __itkGiplImageIO_h
00020 
00021 
00022 #include <fstream>
00023 #include "itkImageIOBase.h"
00024 #include <stdio.h>
00025 
00026 namespace itk
00027 {
00028 class GiplImageIOInternals;
00029 
00038 class ITK_EXPORT GiplImageIO:public ImageIOBase
00039 {
00040 public:
00042   typedef GiplImageIO          Self;
00043   typedef ImageIOBase          Superclass;
00044   typedef SmartPointer< Self > Pointer;
00045 
00047   itkNewMacro(Self);
00048 
00050   itkTypeMacro(GiplImageIO, Superclass);
00051 
00052   /*-------- This part of the interfaces deals with reading data. ----- */
00053 
00056   virtual bool CanReadFile(const char *);
00057 
00059   virtual void ReadImageInformation();
00060 
00062   virtual void Read(void *buffer);
00063 
00064   /*-------- This part of the interfaces deals with writing data. ----- */
00065 
00068   virtual bool CanWriteFile(const char *);
00069 
00071   virtual void WriteImageInformation();
00072 
00075   virtual void Write(const void *buffer);
00076 
00077   GiplImageIO();
00078   ~GiplImageIO();
00079   void PrintSelf(std::ostream & os, Indent indent) const;
00080 
00081 private:
00082   GiplImageIO(const Self &);    //purposely not implemented
00083   void operator=(const Self &); //purposely not implemented
00084 
00085   void SwapBytesIfNecessary(void *buffer, SizeValueType numberOfPixels);
00086 
00087   bool CheckExtension(const char *);
00088 
00089   std::ifstream m_Ifstream;
00090   std::ofstream m_Ofstream;
00091   bool          m_IsCompressed;
00092 
00093   GiplImageIOInternals *m_Internal;
00094 };
00095 } // end namespace itk
00096 
00097 #endif // __itkGiplImageIO_h
00098