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 #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
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
00059
00062 virtual bool CanReadFile(const char*) ;
00063
00065 virtual void ReadImageInformation();
00066
00068 virtual void Read(void* buffer);
00069
00070
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&);
00091 void operator=(const Self&);
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
00114 size_t m_InputPosition;
00115 };
00116
00117 }
00118
00119 #endif // __itkDicomImageIO_h