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 const std::type_info& GetPixelType() const;
00069
00071 virtual
void Read(
void* buffer);
00072
00076 virtual
unsigned int GetComponentSize() const;
00077
00078
00079
00082 virtual
bool CanWriteFile(const
char*);
00083
00085 virtual
void WriteImageInformation();
00086
00089 virtual
void Write(const
void* buffer);
00090
00091
00092 protected:
00093 DicomImageIO();
00094 ~DicomImageIO();
00095
void PrintSelf(std::ostream& os,
Indent indent) const;
00096
00097 private:
00098 DicomImageIO(const
Self&);
00099
void operator=(const Self&);
00100
00101
void SwapBytesIfNecessary(
void* buffer,
unsigned long numberOfPixels);
00102
00105
bool CheckTagTable(std::ifstream & inputStream,
00106 std::
list <
Tag> &TableOfTags) const;
00107
00110
bool GoToTheEndOfHeader(std::ifstream & inputStream,
00111
long int& i,
Tag & tagcurrent) const;
00112
00115
bool GoToTag(std::ifstream & inputStream,
int balise1,
int balise2,
00116
long int & i,
long int & max,
Tag & tagcurrent) const;
00117
00119
bool IfEqual(
unsigned char * tag,
int tagvalue1,
int tagvalue2) const;
00120
00121
00122 size_t m_InputPosition;
00123 };
00124
00125 }
00126
00127 #endif