00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __itkGDCMImageIO_h
00021 #define __itkGDCMImageIO_h
00022
00023 #include "itkImageIOBase.h"
00024 #include <fstream>
00025 #include <string>
00026
00027 namespace itk
00028 {
00029
00056 class InternalHeader;
00057 class ITK_EXPORT GDCMImageIO : public ImageIOBase
00058 {
00059 public:
00061 typedef GDCMImageIO Self;
00062 typedef ImageIOBase Superclass;
00063 typedef SmartPointer<Self> Pointer;
00064
00066 itkNewMacro(Self);
00067
00069 itkTypeMacro(GDCMImageIO, Superclass);
00070
00071
00072
00075 virtual bool CanReadFile(const char*);
00076
00078 virtual void ReadImageInformation();
00079
00081 virtual void Read(void* buffer);
00082
00083
00084
00087 virtual bool CanWriteFile(const char*);
00088
00091 virtual void WriteImageInformation();
00092
00095 virtual void Write(const void* buffer);
00096
00100 itkGetMacro(RescaleSlope, double);
00101 itkGetMacro(RescaleIntercept, double);
00103
00108 itkGetStringMacro(UIDPrefix);
00109 itkSetStringMacro(UIDPrefix);
00111
00113 itkGetStringMacro(StudyInstanceUID);
00114 itkGetStringMacro(SeriesInstanceUID);
00115 itkGetStringMacro(FrameOfReferenceInstanceUID);
00117
00120 itkSetMacro(KeepOriginalUID,bool);
00121 itkGetMacro(KeepOriginalUID,bool);
00122 itkBooleanMacro(KeepOriginalUID);
00124
00128 void GetPatientName(char* name);
00129 void GetPatientID(char* id);
00130 void GetPatientSex(char* sex);
00131 void GetPatientAge(char* age);
00132 void GetStudyID(char* id);
00133 void GetPatientDOB(char* dob);
00134 void GetStudyDescription(char* desc);
00135 void GetBodyPart(char* part);
00136 void GetNumberOfSeriesInStudy(char* series);
00137 void GetNumberOfStudyRelatedSeries(char* series);
00138 void GetStudyDate(char* date);
00139 void GetModality(char* modality);
00140 void GetManufacturer(char* manu);
00141 void GetInstitution(char* ins);
00142 void GetModel(char* model);
00143 void GetScanOptions(char *options);
00145
00149 bool GetValueFromTag(const std::string & tag, std::string & value);
00150
00157 static bool GetLabelFromTag( const std::string & tag,
00158 std::string & labelId );
00159
00166 itkSetMacro(MaxSizeLoadEntry, long);
00167
00172 itkSetMacro(LoadSequences, bool);
00173 itkGetMacro(LoadSequences, bool);
00174 itkBooleanMacro(LoadSequences);
00176
00181 itkSetMacro(LoadPrivateTags, bool);
00182 itkGetMacro(LoadPrivateTags, bool);
00183 itkBooleanMacro(LoadPrivateTags);
00185
00192 static void SetLoadSequencesDefault(bool b)
00193 { m_LoadSequencesDefault = b; }
00194 static void LoadSequencesDefaultOn()
00195 { m_LoadSequencesDefault = true; }
00196 static void LoadSequencesDefaultOff()
00197 { m_LoadSequencesDefault = false; }
00198 static bool GetLoadSequencesDefault()
00199 { return m_LoadSequencesDefault; }
00201
00208 static void SetLoadPrivateTagsDefault(bool b)
00209 { m_LoadPrivateTagsDefault = b; }
00210 static void LoadPrivateTagsDefaultOn()
00211 { m_LoadPrivateTagsDefault = true; }
00212 static void LoadPrivateTagsDefaultOff()
00213 { m_LoadPrivateTagsDefault = false; }
00214 static bool GetLoadPrivateTagsDefault()
00215 { return m_LoadPrivateTagsDefault; }
00217
00218
00219
00220 protected:
00221 GDCMImageIO();
00222 ~GDCMImageIO();
00223 void PrintSelf(std::ostream& os, Indent indent) const;
00224
00225 bool OpenGDCMFileForReading(std::ifstream& os, const char* filename);
00226 bool OpenGDCMFileForWriting(std::ofstream& os, const char* filename);
00227 void InternalReadImageInformation(std::ifstream& file);
00228
00229 double m_RescaleSlope;
00230 double m_RescaleIntercept;
00231
00232 std::string m_UIDPrefix;
00233 std::string m_StudyInstanceUID;
00234 std::string m_SeriesInstanceUID;
00235 std::string m_FrameOfReferenceInstanceUID;
00236 bool m_KeepOriginalUID;
00237 long m_MaxSizeLoadEntry;
00238
00239 private:
00240 GDCMImageIO(const Self&);
00241 void operator=(const Self&);
00242
00243 std::string m_PatientName;
00244 std::string m_PatientID;
00245 std::string m_PatientDOB;
00246 std::string m_StudyID;
00247 std::string m_StudyDescription;
00248 std::string m_BodyPart;
00249 std::string m_NumberOfSeriesInStudy;
00250 std::string m_NumberOfStudyRelatedSeries;
00251 std::string m_PatientSex;
00252 std::string m_PatientAge;
00253 std::string m_StudyDate;
00254 std::string m_Modality;
00255 std::string m_Manufacturer;
00256 std::string m_Institution;
00257 std::string m_Model;
00258 std::string m_ScanOptions;
00259
00260 bool m_LoadSequences;
00261 bool m_LoadPrivateTags;
00262 static bool m_LoadSequencesDefault;
00263 static bool m_LoadPrivateTagsDefault;
00264
00267 unsigned int m_GlobalNumberOfDimensions;
00268
00269 ImageIOBase::IOComponentType m_InternalComponentType;
00270 InternalHeader *DICOMHeader;
00271 };
00272
00273 }
00274
00275 #endif // __itkGDCMImageIO_h
00276