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: 2003/02/23 22:38:08 $
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 namespace itk
00024 {
00025 
00032 class ITK_EXPORT DicomImageIO : public ImageIOBase
00033 {
00034 public:
00036   typedef DicomImageIO            Self;
00037   typedef ImageIOBase  Superclass;
00038   typedef SmartPointer<Self>  Pointer;
00039 
00040   //this structure is used to creat a table of tags
00041   typedef struct Bal
00042   {
00043     unsigned char Subtag1 [2]; 
00044     unsigned char Subtag2 [2];
00045     int count;
00046   } Tag;
00047   
00049   itkNewMacro(Self);
00050 
00052   itkTypeMacro(DicomImageIO, 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 const std::type_info& GetPixelType() const;
00065 
00067   virtual void Read(void* buffer);
00068 
00072   virtual unsigned int GetComponentSize() const;
00073   
00074   /*-------- This part of the interfaces deals with writing data. ----- */
00075 
00078   virtual bool CanWriteFile(const char*);
00079 
00081   virtual void WriteImageInformation();
00082   
00085   virtual void Write(const void* buffer);
00086 
00087 
00088 protected:
00089   DicomImageIO();
00090   ~DicomImageIO();
00091   void PrintSelf(std::ostream& os, Indent indent) const;
00092   
00093 private:
00094   DicomImageIO(const Self&); //purposely not implemented
00095   void operator=(const Self&); //purposely not implemented
00096 
00097   void SwapBytesIfNecessary(void* buffer, unsigned long numberOfPixels);
00098  
00101   bool CheckTagTable(std::ifstream & inputStream,
00102                      std::list <Tag> &TableOfTags) const;
00103 
00106   bool GoToTheEndOfHeader(std::ifstream & inputStream,
00107                           long int& i,Tag & tagcurrent) const;
00108 
00111   bool GoToTag(std::ifstream & inputStream, int balise1, int balise2,
00112                long int & i, long int & max, Tag & tagcurrent) const;
00113 
00115   bool IfEqual(unsigned char * tag, int tagvalue1, int tagvalue2) const;
00116   
00117   // Position after ReadImageInformation.
00118   size_t   m_InputPosition;
00119 };
00120 
00121 } // end namespace itk
00122 
00123 #endif // __itkDicomImageIO_h

Generated at Fri May 21 01:14:39 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000