ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkGDCMImageIO.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 /*=========================================================================
19  *
20  * Portions of this file are subject to the VTK Toolkit Version 3 copyright.
21  *
22  * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23  *
24  * For complete copyright, license and disclaimer of warranty information
25  * please refer to the NOTICE file at the top of the ITK source tree.
26  *
27  *=========================================================================*/
28 #ifndef itkGDCMImageIO_h
29 #define itkGDCMImageIO_h
30 
31 #define ITKIO_DEPRECATED_GDCM1_API
32 
33 #include "itkImageIOBase.h"
34 #include "ITKIOGDCMExport.h"
35 #include <fstream>
36 #include <string>
37 
38 namespace itk
39 {
77 class InternalHeader;
78 class ITKIOGDCM_EXPORT GDCMImageIO:public ImageIOBase
79 {
80 public:
82  typedef GDCMImageIO Self;
85 
87  itkNewMacro(Self);
88 
90  itkTypeMacro(GDCMImageIO, Superclass);
91 
92  /*-------- This part of the interface deals with reading data. ------ */
93 
96  virtual bool CanReadFile(const char *) ITK_OVERRIDE;
97 
99  virtual void ReadImageInformation() ITK_OVERRIDE;
100 
102  virtual void Read(void *buffer) ITK_OVERRIDE;
103 
107  itkGetEnumMacro(InternalComponentType, IOComponentType);
108  itkSetEnumMacro(InternalComponentType, IOComponentType);
110 
111  /*-------- This part of the interfaces deals with writing data. ----- */
112 
115  virtual bool CanWriteFile(const char *) ITK_OVERRIDE;
116 
119  virtual void WriteImageInformation() ITK_OVERRIDE;
120 
123  virtual void Write(const void *buffer) ITK_OVERRIDE;
124 
128  itkGetConstMacro(RescaleSlope, double);
129  itkGetConstMacro(RescaleIntercept, double);
131 
136  itkGetStringMacro(UIDPrefix);
137  itkSetStringMacro(UIDPrefix);
139 
141  itkGetStringMacro(StudyInstanceUID);
142  itkGetStringMacro(SeriesInstanceUID);
143  itkGetStringMacro(FrameOfReferenceInstanceUID);
145 
148  itkSetMacro(KeepOriginalUID, bool);
149  itkGetConstMacro(KeepOriginalUID, bool);
150  itkBooleanMacro(KeepOriginalUID);
152 
156  itkSetMacro(LoadPrivateTags, bool);
157  itkGetConstMacro(LoadPrivateTags, bool);
158  itkBooleanMacro(LoadPrivateTags);
160 
161 #if defined( ITKIO_DEPRECATED_GDCM1_API )
162 
168  void GetPatientName(char *name);
169 
170  void GetPatientID(char *id);
171 
172  void GetPatientSex(char *sex);
173 
174  void GetPatientAge(char *age);
175 
176  void GetStudyID(char *id);
177 
178  void GetPatientDOB(char *dob);
179 
180  void GetStudyDescription(char *desc);
181 
182  void GetBodyPart(char *part);
183 
184  void GetNumberOfSeriesInStudy(char *series);
185 
186  void GetNumberOfStudyRelatedSeries(char *series);
187 
188  void GetStudyDate(char *date);
189 
190  void GetModality(char *modality);
191 
192  void GetManufacturer(char *manu);
193 
194  void GetInstitution(char *ins);
195 
196  void GetModel(char *model);
197 
198  void GetScanOptions(char *options);
199 #endif
200 
204  bool GetValueFromTag(const std::string & tag, std::string & value);
205 
212  static bool GetLabelFromTag(const std::string & tag,
213  std::string & labelId);
214 
215 #if defined( ITKIO_DEPRECATED_GDCM1_API )
216 
223  virtual void SetMaxSizeLoadEntry( const long ) {}
224 
230  virtual void SetLoadSequences( const bool ) {}
231  virtual bool GetLoadSequences () const { return true; }
232  virtual void LoadSequencesOn () {}
233  virtual void LoadSequencesOff () {}
235 
244  static void SetLoadSequencesDefault(bool) {}
245  static void LoadSequencesDefaultOn() {}
246  static void LoadSequencesDefaultOff() {}
247  static bool GetLoadSequencesDefault() { return true; }
249 
258  static void SetLoadPrivateTagsDefault(bool) {}
259  static void LoadPrivateTagsDefaultOn() {}
260  static void LoadPrivateTagsDefaultOff() {}
261  static bool GetLoadPrivateTagsDefault() { return true; }
262 #endif
263 
264 
266  typedef enum { JPEG = 0, JPEG2000, JPEGLS, RLE } TCompressionType;
267  itkSetEnumMacro(CompressionType, TCompressionType);
268  itkGetEnumMacro(CompressionType, TCompressionType);
270 
271 protected:
272  GDCMImageIO();
273  ~GDCMImageIO() ITK_OVERRIDE;
274  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
275 
276  void InternalReadImageInformation();
277 
278  double m_RescaleSlope;
279  double m_RescaleIntercept;
280 
281  std::string m_UIDPrefix;
282  std::string m_StudyInstanceUID;
283  std::string m_SeriesInstanceUID;
284  std::string m_FrameOfReferenceInstanceUID;
285 
286  bool m_KeepOriginalUID;
287 
288  bool m_LoadPrivateTags;
289 
290 private:
291  ITK_DISALLOW_COPY_AND_ASSIGN(GDCMImageIO);
292 
293 #if defined( ITKIO_DEPRECATED_GDCM1_API )
294  std::string m_PatientName;
295  std::string m_PatientID;
296  std::string m_PatientDOB;
297  std::string m_StudyID;
298  std::string m_StudyDescription;
299  std::string m_BodyPart;
302  std::string m_PatientSex;
303  std::string m_PatientAge;
304  std::string m_StudyDate;
305  std::string m_Modality;
306  std::string m_Manufacturer;
307  std::string m_Institution;
308  std::string m_Model;
309  std::string m_ScanOptions;
310 #endif
311 
316 
318  InternalHeader * m_DICOMHeader;
319 };
320 } // end namespace itk
321 
322 #endif // itkGDCMImageIO_h
virtual void SetLoadSequences(const bool)
Light weight base class for most itk classes.
std::string m_PatientDOB
std::string m_ScanOptions
Abstract superclass defines image IO interface.
static bool GetLoadSequencesDefault()
ImageIO class for reading and writing DICOM V3.0 and ACR/NEMA 1&amp;2 uncompressed images. This class is only an adaptor to the GDCM library.
static void SetLoadSequencesDefault(bool)
std::string m_BodyPart
std::string m_PatientID
std::string m_PatientName
static void LoadPrivateTagsDefaultOn()
unsigned int m_GlobalNumberOfDimensions
virtual void LoadSequencesOff()
std::string m_StudyID
std::string m_NumberOfSeriesInStudy
SmartPointer< Self > Pointer
std::string m_StudyDescription
static bool GetLoadPrivateTagsDefault()
virtual void LoadSequencesOn()
ImageIOBase::IOComponentType m_InternalComponentType
ImageIOBase Superclass
std::string m_Manufacturer
static void LoadSequencesDefaultOn()
TCompressionType m_CompressionType
static void LoadSequencesDefaultOff()
std::string m_NumberOfStudyRelatedSeries
std::string m_StudyDate
std::string m_PatientSex
Control indentation during Print() invocation.
Definition: itkIndent.h:49
std::string m_Institution
InternalHeader * m_DICOMHeader
std::string m_PatientAge
virtual bool GetLoadSequences() const
Base class for most ITK classes.
Definition: itkObject.h:59
std::string m_Modality
static void LoadPrivateTagsDefaultOff()
static void SetLoadPrivateTagsDefault(bool)
std::string m_Model
virtual void SetMaxSizeLoadEntry(const long)
GDCMImageIO Self