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
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
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
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&);
00091 void operator=(const Self&);
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
00107 size_t m_InputPosition;
00108 };
00109
00110 }
00111
00112 #endif // __itkDicomImageIO_h