GDCM 2.0.17
|
00001 /*========================================================================= 00002 00003 Program: GDCM (Grassroots DICOM). A DICOM library 00004 Module: $URL$ 00005 00006 Copyright (c) 2006-2010 Mathieu Malaterre 00007 All rights reserved. 00008 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 #ifndef ITKGDCMIMAGEIO2_H 00016 #define ITKGDCMIMAGEIO2_H 00017 00018 #include "itkImageIOBase.h" 00019 00020 namespace itk 00021 { 00022 00034 #ifndef ITK_EXPORT 00035 /* I could not figure out where/what was the API in ITK to achieve that, 00036 * instead duplicate code here */ 00037 #if defined(WIN32) && defined(ITK_BUILD_SHARED_LIBS) 00038 #if defined(itkgdcm2_EXPORTS) 00039 #define ITK_GDCM_EXPORT __declspec( dllexport ) 00040 #else 00041 #define ITK_GDCM_EXPORT __declspec( dllimport ) 00042 #endif 00043 #else 00044 #define ITK_GDCM_EXPORT 00045 #endif 00046 #else 00047 #define ITK_GDCM_EXPORT ITK_EXPORT 00048 #endif 00049 00050 class ITK_GDCM_EXPORT GDCMImageIO2 : public ImageIOBase 00051 { 00052 public: 00054 typedef GDCMImageIO2 Self; 00055 typedef ImageIOBase Superclass; 00056 typedef SmartPointer<Self> Pointer; 00057 00059 itkNewMacro(Self); 00060 00062 itkTypeMacro(GDCMImageIO2, Superclass); 00063 00064 /*-------- This part of the interface deals with reading data. ------ */ 00065 00068 virtual bool CanReadFile(const char*); 00069 00071 virtual void ReadImageInformation(); 00072 00074 virtual void Read(void* buffer); 00075 00076 /*-------- This part of the interfaces deals with writing data. ----- */ 00077 00080 virtual bool CanWriteFile(const char*); 00081 00084 virtual void WriteImageInformation(); 00085 00088 virtual void Write(const void* buffer); 00089 00093 itkGetMacro(RescaleSlope, double); 00094 itkGetMacro(RescaleIntercept, double); 00095 00100 itkGetStringMacro(UIDPrefix); 00101 itkSetStringMacro(UIDPrefix); 00102 00104 itkGetStringMacro(StudyInstanceUID); 00105 itkGetStringMacro(SeriesInstanceUID); 00106 itkGetStringMacro(FrameOfReferenceInstanceUID); 00107 00110 itkSetMacro(KeepOriginalUID,bool); 00111 itkGetMacro(KeepOriginalUID,bool); 00112 itkBooleanMacro(KeepOriginalUID); 00113 00117 void GetPatientName(char* name); 00118 void GetPatientID(char* id); 00119 void GetPatientSex(char* sex); 00120 void GetPatientAge(char* age); 00121 void GetStudyID(char* id); 00122 void GetPatientDOB(char* dob); 00123 void GetStudyDescription(char* desc); 00124 void GetBodyPart(char* part); 00125 void GetNumberOfSeriesInStudy(char* series); 00126 void GetNumberOfStudyRelatedSeries(char* series); 00127 void GetStudyDate(char* date); 00128 void GetModality(char* modality); 00129 void GetManufacturer(char* manu); 00130 void GetInstitution(char* ins); 00131 void GetModel(char* model); 00132 void GetScanOptions(char *options); 00133 00139 bool GetValueFromTag(const std::string & tag, std::string & value); 00140 00147 static bool GetLabelFromTag( const std::string & tag, 00148 std::string & labelId ); 00149 00156 itkSetMacro(MaxSizeLoadEntry, long); 00157 00162 itkSetMacro(LoadSequences, bool); 00163 itkGetMacro(LoadSequences, bool); 00164 itkBooleanMacro(LoadSequences); 00165 00170 itkSetMacro(LoadPrivateTags, bool); 00171 itkGetMacro(LoadPrivateTags, bool); 00172 itkBooleanMacro(LoadPrivateTags); 00173 00180 static void SetLoadSequencesDefault(bool ) {} 00181 static void LoadSequencesDefaultOn() {} 00182 static void LoadSequencesDefaultOff() {} 00183 static bool GetLoadSequencesDefault() { return true; } 00184 00191 static void SetLoadPrivateTagsDefault(bool ) {} 00192 static void LoadPrivateTagsDefaultOn() {} 00193 static void LoadPrivateTagsDefaultOff() {} 00194 static bool GetLoadPrivateTagsDefault() { return true; } 00195 00197 typedef enum { JPEG = 0, JPEG2000 } TCompressionType; 00198 itkSetEnumMacro(CompressionType,TCompressionType); 00199 itkGetEnumMacro(CompressionType,TCompressionType); 00200 00201 protected: 00202 GDCMImageIO2(); 00203 ~GDCMImageIO2(); 00204 void PrintSelf(std::ostream& os, Indent indent) const; 00205 00206 void InternalReadImageInformation(std::ifstream&); 00207 bool OpenGDCMFileForReading(std::ifstream&, const char*); 00208 bool OpenGDCMFileForWriting(std::ofstream&, const char*); 00209 00210 double m_RescaleSlope; 00211 double m_RescaleIntercept; 00212 00213 std::string m_UIDPrefix; 00214 std::string m_StudyInstanceUID; 00215 std::string m_SeriesInstanceUID; 00216 std::string m_FrameOfReferenceInstanceUID; 00217 bool m_KeepOriginalUID; 00218 00219 00220 private: 00221 GDCMImageIO2(const Self&); //purposely not implemented 00222 void operator=(const Self&); //purposely not implemented 00223 00226 unsigned int m_GlobalNumberOfDimensions; 00227 TCompressionType m_CompressionType; 00228 00229 // LEGACY, REMOVE ME 00230 bool m_LoadSequences; 00231 bool m_LoadPrivateTags; 00232 long m_MaxSizeLoadEntry; 00233 00234 }; 00235 00236 } // end namespace itk 00237 00238 #endif // ITKGDCMIMAGEIO2_H