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/01/08 00:39:04 $
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 const std::type_info& GetPixelType() const;
00069 
00071   virtual void Read(void* buffer);
00072 
00076   virtual unsigned int GetComponentSize() const;
00077   
00078   /*-------- This part of the interfaces deals with writing data. ----- */
00079 
00082   virtual bool CanWriteFile(const char*);
00083 
00085   virtual void WriteImageInformation();
00086   
00089   virtual void Write(const void* buffer);
00090 
00091 
00092 protected:
00093   DicomImageIO();
00094   ~DicomImageIO();
00095   void PrintSelf(std::ostream& os, Indent indent) const;
00096   
00097 private:
00098   DicomImageIO(const Self&); //purposely not implemented
00099   void operator=(const Self&); //purposely not implemented
00100 
00101   void SwapBytesIfNecessary(void* buffer, unsigned long numberOfPixels);
00102  
00105   bool CheckTagTable(std::ifstream & inputStream,
00106                      std::list <Tag> &TableOfTags) const;
00107 
00110   bool GoToTheEndOfHeader(std::ifstream & inputStream,
00111                           long int& i,Tag & tagcurrent) const;
00112 
00115   bool GoToTag(std::ifstream & inputStream, int balise1, int balise2,
00116                long int & i, long int & max, Tag & tagcurrent) const;
00117 
00119   bool IfEqual(unsigned char * tag, int tagvalue1, int tagvalue2) const;
00120   
00121   // Position after ReadImageInformation.
00122   size_t   m_InputPosition;
00123 };
00124 
00125 } // end namespace itk
00126 
00127 #endif // __itkDicomImageIO_h

Generated at Sun Jan 25 13:19:32 2004 for ITK by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-2000