GDCM  2.2.0
itkGDCMImageIO2.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: GDCM (Grassroots DICOM). A DICOM library
4 
5  Copyright (c) 2006-2011 Mathieu Malaterre
6  All rights reserved.
7  See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 #ifndef ITKGDCMIMAGEIO2_H
15 #define ITKGDCMIMAGEIO2_H
16 
17 #include "itkImageIOBase.h"
18 
19 namespace itk
20 {
21 
33 #ifndef ITK_EXPORT
34 /* I could not figure out where/what was the API in ITK to achieve that,
35  * instead duplicate code here */
36 #if defined(WIN32) && defined(ITK_BUILD_SHARED_LIBS)
37  #if defined(itkgdcm2_EXPORTS)
38  #define ITK_GDCM_EXPORT __declspec( dllexport )
39  #else
40  #define ITK_GDCM_EXPORT __declspec( dllimport )
41  #endif
42 #else
43  #define ITK_GDCM_EXPORT
44 #endif
45 #else
46  #define ITK_GDCM_EXPORT ITK_EXPORT
47 #endif
48 
49 class ITK_GDCM_EXPORT GDCMImageIO2 : public ImageIOBase
50 {
51 public:
53  typedef GDCMImageIO2 Self;
54  typedef ImageIOBase Superclass;
55  typedef SmartPointer<Self> Pointer;
56 
58  itkNewMacro(Self);
59 
61  itkTypeMacro(GDCMImageIO2, Superclass);
62 
63  /*-------- This part of the interface deals with reading data. ------ */
64 
67  virtual bool CanReadFile(const char*);
68 
70  virtual void ReadImageInformation();
71 
73  virtual void Read(void* buffer);
74 
75  /*-------- This part of the interfaces deals with writing data. ----- */
76 
79  virtual bool CanWriteFile(const char*);
80 
83  virtual void WriteImageInformation();
84 
87  virtual void Write(const void* buffer);
88 
92  itkGetMacro(RescaleSlope, double);
93  itkGetMacro(RescaleIntercept, double);
94 
99  itkGetStringMacro(UIDPrefix);
100  itkSetStringMacro(UIDPrefix);
101 
103  itkGetStringMacro(StudyInstanceUID);
104  itkGetStringMacro(SeriesInstanceUID);
105  itkGetStringMacro(FrameOfReferenceInstanceUID);
106 
109  itkSetMacro(KeepOriginalUID,bool);
110  itkGetMacro(KeepOriginalUID,bool);
111  itkBooleanMacro(KeepOriginalUID);
112 
116  void GetPatientName(char* name);
117  void GetPatientID(char* id);
118  void GetPatientSex(char* sex);
119  void GetPatientAge(char* age);
120  void GetStudyID(char* id);
121  void GetPatientDOB(char* dob);
122  void GetStudyDescription(char* desc);
123  void GetBodyPart(char* part);
124  void GetNumberOfSeriesInStudy(char* series);
125  void GetNumberOfStudyRelatedSeries(char* series);
126  void GetStudyDate(char* date);
127  void GetModality(char* modality);
128  void GetManufacturer(char* manu);
129  void GetInstitution(char* ins);
130  void GetModel(char* model);
131  void GetScanOptions(char *options);
132 
138  bool GetValueFromTag(const std::string & tag, std::string & value);
139 
146  static bool GetLabelFromTag( const std::string & tag,
147  std::string & labelId );
148 
155  itkSetMacro(MaxSizeLoadEntry, long);
156 
161  itkSetMacro(LoadSequences, bool);
162  itkGetMacro(LoadSequences, bool);
163  itkBooleanMacro(LoadSequences);
164 
169  itkSetMacro(LoadPrivateTags, bool);
170  itkGetMacro(LoadPrivateTags, bool);
171  itkBooleanMacro(LoadPrivateTags);
172 
179  static void SetLoadSequencesDefault(bool ) {}
180  static void LoadSequencesDefaultOn() {}
181  static void LoadSequencesDefaultOff() {}
182  static bool GetLoadSequencesDefault() { return true; }
183 
190  static void SetLoadPrivateTagsDefault(bool ) {}
191  static void LoadPrivateTagsDefaultOn() {}
192  static void LoadPrivateTagsDefaultOff() {}
193  static bool GetLoadPrivateTagsDefault() { return true; }
194 
196  typedef enum { JPEG = 0, JPEG2000 } TCompressionType;
197  itkSetEnumMacro(CompressionType,TCompressionType);
198  itkGetEnumMacro(CompressionType,TCompressionType);
199 
200 protected:
201  GDCMImageIO2();
202  ~GDCMImageIO2();
203  void PrintSelf(std::ostream& os, Indent indent) const;
204 
205  void InternalReadImageInformation(std::ifstream&);
206  bool OpenGDCMFileForReading(std::ifstream&, const char*);
207  bool OpenGDCMFileForWriting(std::ofstream&, const char*);
208 
211 
212  std::string m_UIDPrefix;
213  std::string m_StudyInstanceUID;
214  std::string m_SeriesInstanceUID;
217 
218 
219 private:
220  GDCMImageIO2(const Self&); //purposely not implemented
221  void operator=(const Self&); //purposely not implemented
222 
225  unsigned int m_GlobalNumberOfDimensions;
226  TCompressionType m_CompressionType;
227 
228 // LEGACY, REMOVE ME
229  bool m_LoadSequences;
230  bool m_LoadPrivateTags;
231  long m_MaxSizeLoadEntry;
232 
233 };
234 
235 } // end namespace itk
236 
237 #endif // ITKGDCMIMAGEIO2_H

Generated on Wed Jun 13 2012 20:40:37 for GDCM by doxygen 1.8.1
SourceForge.net Logo