ITK  4.9.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 {
72 class InternalHeader;
73 class ITKIOGDCM_EXPORT GDCMImageIO:public ImageIOBase
74 {
75 public:
77  typedef GDCMImageIO Self;
80 
82  itkNewMacro(Self);
83 
85  itkTypeMacro(GDCMImageIO, Superclass);
86 
87  /*-------- This part of the interface deals with reading data. ------ */
88 
91  virtual bool CanReadFile(const char *) ITK_OVERRIDE;
92 
94  virtual void ReadImageInformation() ITK_OVERRIDE;
95 
97  virtual void Read(void *buffer) ITK_OVERRIDE;
98 
102  itkGetEnumMacro(InternalComponentType, IOComponentType);
103  itkSetEnumMacro(InternalComponentType, IOComponentType);
105 
106  /*-------- This part of the interfaces deals with writing data. ----- */
107 
110  virtual bool CanWriteFile(const char *) ITK_OVERRIDE;
111 
114  virtual void WriteImageInformation() ITK_OVERRIDE;
115 
118  virtual void Write(const void *buffer) ITK_OVERRIDE;
119 
123  itkGetConstMacro(RescaleSlope, double);
124  itkGetConstMacro(RescaleIntercept, double);
126 
131  itkGetStringMacro(UIDPrefix);
132  itkSetStringMacro(UIDPrefix);
134 
136  itkGetStringMacro(StudyInstanceUID);
137  itkGetStringMacro(SeriesInstanceUID);
138  itkGetStringMacro(FrameOfReferenceInstanceUID);
140 
143  itkSetMacro(KeepOriginalUID, bool);
144  itkGetConstMacro(KeepOriginalUID, bool);
145  itkBooleanMacro(KeepOriginalUID);
147 
151  itkSetMacro(LoadPrivateTags, bool);
152  itkGetConstMacro(LoadPrivateTags, bool);
153  itkBooleanMacro(LoadPrivateTags);
155 
156 #if defined( ITKIO_DEPRECATED_GDCM1_API )
157 
163  void GetPatientName(char *name);
164 
165  void GetPatientID(char *id);
166 
167  void GetPatientSex(char *sex);
168 
169  void GetPatientAge(char *age);
170 
171  void GetStudyID(char *id);
172 
173  void GetPatientDOB(char *dob);
174 
175  void GetStudyDescription(char *desc);
176 
177  void GetBodyPart(char *part);
178 
179  void GetNumberOfSeriesInStudy(char *series);
180 
181  void GetNumberOfStudyRelatedSeries(char *series);
182 
183  void GetStudyDate(char *date);
184 
185  void GetModality(char *modality);
186 
187  void GetManufacturer(char *manu);
188 
189  void GetInstitution(char *ins);
190 
191  void GetModel(char *model);
192 
193  void GetScanOptions(char *options);
194 #endif
195 
199  bool GetValueFromTag(const std::string & tag, std::string & value);
200 
207  static bool GetLabelFromTag(const std::string & tag,
208  std::string & labelId);
209 
210 #if defined( ITKIO_DEPRECATED_GDCM1_API )
211 
218  virtual void SetMaxSizeLoadEntry( const long ) {}
219 
225  virtual void SetLoadSequences( const bool ) {}
226  virtual bool GetLoadSequences () const { return true; }
227  virtual void LoadSequencesOn () {}
228  virtual void LoadSequencesOff () {}
230 
239  static void SetLoadSequencesDefault(bool) {}
240  static void LoadSequencesDefaultOn() {}
241  static void LoadSequencesDefaultOff() {}
242  static bool GetLoadSequencesDefault() { return true; }
244 
253  static void SetLoadPrivateTagsDefault(bool) {}
254  static void LoadPrivateTagsDefaultOn() {}
255  static void LoadPrivateTagsDefaultOff() {}
256  static bool GetLoadPrivateTagsDefault() { return true; }
257 #endif
258 
259 
261  typedef enum { JPEG = 0, JPEG2000, JPEGLS, RLE } TCompressionType;
262  itkSetEnumMacro(CompressionType, TCompressionType);
263  itkGetEnumMacro(CompressionType, TCompressionType);
265 
266 protected:
267  GDCMImageIO();
268  ~GDCMImageIO();
269  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
270 
271  void InternalReadImageInformation();
272 
275 
276  std::string m_UIDPrefix;
277  std::string m_StudyInstanceUID;
278  std::string m_SeriesInstanceUID;
280 
282 
284 
285 private:
286  GDCMImageIO(const Self &) ITK_DELETE_FUNCTION;
287  void operator=(const Self &) ITK_DELETE_FUNCTION;
288 
289 #if defined( ITKIO_DEPRECATED_GDCM1_API )
290  std::string m_PatientName;
291  std::string m_PatientID;
292  std::string m_PatientDOB;
293  std::string m_StudyID;
294  std::string m_StudyDescription;
295  std::string m_BodyPart;
298  std::string m_PatientSex;
299  std::string m_PatientAge;
300  std::string m_StudyDate;
301  std::string m_Modality;
302  std::string m_Manufacturer;
303  std::string m_Institution;
304  std::string m_Model;
305  std::string m_ScanOptions;
306 #endif
307 
312 
314  InternalHeader * m_DICOMHeader;
315 };
316 } // end namespace itk
317 
318 #endif // itkGDCMImageIO_h
std::string m_FrameOfReferenceInstanceUID
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. Currently GDCM 2.4.6 (git SHA 1efe9e28) is used.
static void SetLoadSequencesDefault(bool)
std::string m_UIDPrefix
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
std::string m_StudyInstanceUID
static void LoadSequencesDefaultOff()
std::string m_SeriesInstanceUID
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:57
std::string m_Modality
static void LoadPrivateTagsDefaultOff()
static void SetLoadPrivateTagsDefault(bool)
std::string m_Model
virtual void SetMaxSizeLoadEntry(const long)
GDCMImageIO Self