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