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

itkDicomImageIO.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkDicomImageIO.h,v $
00005   Language:  C++
00006   Date:      $Date: 2004/05/14 15:12:37 $
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 __itkDicomImageIO_h
00018 #define __itkDicomImageIO_h
00019 
00020 #ifdef _MSC_VER
00021 #pragma warning ( disable : 4786 )
00022 #endif
00023 
00024 #include <fstream>
00025 #include "itkImageIOBase.h"
00026 
00027 namespace itk
00028 {
00029 
00036 class ITK_EXPORT DicomImageIO : public ImageIOBase
00037 {
00038 public:
00040   typedef DicomImageIO            Self;
00041   typedef ImageIOBase  Superclass;
00042   typedef SmartPointer<Self>  Pointer;
00043 
00044   //this structure is used to creat a table of tags
00045   typedef struct Bal
00046   {
00047     unsigned char Subtag1 [2]; 
00048     unsigned char Subtag2 [2];
00049     int count;
00050   } Tag;
00051   
00053   itkNewMacro(Self);
00054 
00056   itkTypeMacro(DicomImageIO, Superclass);
00057 
00058   /*-------- This part of the interfaces deals with reading data. ----- */
00059 
00062   virtual bool CanReadFile(const char*) ;
00063 
00065   virtual void ReadImageInformation();
00066 
00068   virtual void Read(void* buffer);
00069 
00070   /*-------- This part of the interfaces deals with writing data. ----- */
00071 
00074   virtual bool CanWriteFile(const char*);
00075 
00077   virtual void WriteImageInformation();
00078   
00081   virtual void Write(const void* buffer);
00082 
00083 
00084 protected:
00085   DicomImageIO();
00086   ~DicomImageIO();
00087   void PrintSelf(std::ostream& os, Indent indent) const;
00088   
00089 private:
00090   DicomImageIO(const Self&); //purposely not implemented
00091   void operator=(const Self&); //purposely not implemented
00092 
00093   void SwapBytesIfNecessary(void* buffer, unsigned long numberOfPixels);
00094  
00097   bool CheckTagTable(std::ifstream & inputStream,
00098                      std::list <Tag> &TableOfTags) const;
00099 
00102   bool GoToTheEndOfHeader(std::ifstream & inputStream,
00103                           long int& i,Tag & tagcurrent) const;
00104 
00107   bool GoToTag(std::ifstream & inputStream, int balise1, int balise2,
00108                long int & i, long int & max, Tag & tagcurrent) const;
00109 
00111   bool IfEqual(unsigned char * tag, int tagvalue1, int tagvalue2) const;
00112   
00113   // Position after ReadImageInformation.
00114   size_t   m_InputPosition;
00115 };
00116 
00117 } // end namespace itk
00118 
00119 #endif // __itkDicomImageIO_h

Generated at Tue Mar 29 23:50:15 2005 for ITK by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2000