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: 2002/10/16 19:19:53 $
00007   Version:   $1.0$
00008 
00009   Copyright (c) 2002 Insight 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 #include <fstream>
00021 #include "itkImageIOBase.h"
00022 
00023 //this structure is used to creat a table of Tag
00024 typedef struct Bal
00025 {
00026   char Balise1 [2]; 
00027   char Balise2 [2];
00028   int compt;
00029 } Tag;
00030 
00031 
00032 
00033 namespace itk
00034 {
00035 
00037 class ITK_EXPORT DicomImageIO : public ImageIOBase
00038 {
00039 public:
00041   typedef DicomImageIO            Self;
00042   typedef ImageIOBase  Superclass;
00043   typedef SmartPointer<Self>  Pointer;
00044   
00046   itkNewMacro(Self);
00047 
00049   itkTypeMacro(DicomImageIO, Superclass);
00050 
00051   /*-------- This part of the interfaces deals with reading data. ----- */
00052 
00055   virtual bool CanReadFile(const char*) ;
00056 
00058   virtual void ReadImageInformation();
00059   
00061   virtual const std::type_info& GetPixelType() const;
00062 
00064   virtual void Read(void* buffer);
00065 
00069   virtual unsigned int GetComponentSize() const;
00070   
00071   /*-------- This part of the interfaces deals with writing data. ----- */
00072 
00075   virtual bool CanWriteFile(const char*);
00076 
00078   virtual void WriteImageInformation();
00079   
00082   virtual void Write(const void* buffer);
00083 
00084 
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  
00096   bool CheckTagTable(std::ifstream & inputStream, std::list <Tag> &TableOfTags) const;
00099   bool GoToTheEndOfHeader(std::ifstream & inputStream,long int& i,Tag & tagcurrent) const;
00101   bool GoToTag(std::ifstream & inputStream,int balise1,int balise2,long int & i,
00102                                                      long int & max,Tag & tagcurrent) const;
00104   bool IfEqual(unsigned char * tag, int tagvalue1, int tagvalue2) const;
00105   
00106   // Position after ReadImageInformation.
00107   size_t m_InputPosition;
00108 };
00109 
00110 } // end namespace itk
00111 
00112 #endif // __itkDicomImageIO_h

Generated at Wed Mar 12 01:12:52 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000