00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
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
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
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&);
00095 void operator=(const Self&);
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
00118 size_t m_InputPosition;
00119 };
00120
00121 }
00122
00123 #endif // __itkDicomImageIO_h