ITK  5.0.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:
81  ITK_DISALLOW_COPY_AND_ASSIGN(GDCMImageIO);
82 
84  using Self = GDCMImageIO;
87 
89  itkNewMacro(Self);
90 
92  itkTypeMacro(GDCMImageIO, Superclass);
93 
94  /*-------- This part of the interface deals with reading data. ------ */
95 
98  bool CanReadFile(const char *) override;
99 
101  void ReadImageInformation() override;
102 
104  void Read(void *buffer) override;
105 
109  itkGetEnumMacro(InternalComponentType, IOComponentType);
110  itkSetEnumMacro(InternalComponentType, IOComponentType);
112 
113  /*-------- This part of the interfaces deals with writing data. ----- */
114 
117  bool CanWriteFile(const char *) override;
118 
121  void WriteImageInformation() override;
122 
125  void Write(const void *buffer) override;
126 
130  itkGetConstMacro(RescaleSlope, double);
131  itkGetConstMacro(RescaleIntercept, double);
133 
138  itkGetStringMacro(UIDPrefix);
139  itkSetStringMacro(UIDPrefix);
141 
143  itkGetStringMacro(StudyInstanceUID);
144  itkGetStringMacro(SeriesInstanceUID);
145  itkGetStringMacro(FrameOfReferenceInstanceUID);
147 
150  itkSetMacro(KeepOriginalUID, bool);
151  itkGetConstMacro(KeepOriginalUID, bool);
152  itkBooleanMacro(KeepOriginalUID);
154 
158  itkSetMacro(LoadPrivateTags, bool);
159  itkGetConstMacro(LoadPrivateTags, bool);
160  itkBooleanMacro(LoadPrivateTags);
162 
163 #if defined( ITKIO_DEPRECATED_GDCM1_API )
164 
170  void GetPatientName(char *name);
171 
172  void GetPatientID(char *id);
173 
174  void GetPatientSex(char *sex);
175 
176  void GetPatientAge(char *age);
177 
178  void GetStudyID(char *id);
179 
180  void GetPatientDOB(char *dob);
181 
182  void GetStudyDescription(char *desc);
183 
184  void GetBodyPart(char *part);
185 
186  void GetNumberOfSeriesInStudy(char *series);
187 
188  void GetNumberOfStudyRelatedSeries(char *series);
189 
190  void GetStudyDate(char *date);
191 
192  void GetModality(char *modality);
193 
194  void GetManufacturer(char *manu);
195 
196  void GetInstitution(char *ins);
197 
198  void GetModel(char *model);
199 
200  void GetScanOptions(char *options);
201 #endif
202 
206  bool GetValueFromTag(const std::string & tag, std::string & value);
207 
214  static bool GetLabelFromTag(const std::string & tag,
215  std::string & labelId);
216 
217 #if defined( ITKIO_DEPRECATED_GDCM1_API )
218 
225  virtual void SetMaxSizeLoadEntry( const long ) {}
226 
232  virtual void SetLoadSequences( const bool ) {}
233  virtual bool GetLoadSequences () const { return true; }
234  virtual void LoadSequencesOn () {}
235  virtual void LoadSequencesOff () {}
237 
246  static void SetLoadSequencesDefault(bool) {}
247  static void LoadSequencesDefaultOn() {}
248  static void LoadSequencesDefaultOff() {}
249  static bool GetLoadSequencesDefault() { return true; }
251 
260  static void SetLoadPrivateTagsDefault(bool) {}
261  static void LoadPrivateTagsDefaultOn() {}
262  static void LoadPrivateTagsDefaultOff() {}
263  static bool GetLoadPrivateTagsDefault() { return true; }
264 #endif
265 
266 
268  typedef enum { JPEG = 0, JPEG2000, JPEGLS, RLE } TCompressionType;
269  itkSetEnumMacro(CompressionType, TCompressionType);
270  itkGetEnumMacro(CompressionType, TCompressionType);
272 
273 protected:
274  GDCMImageIO();
275  ~GDCMImageIO() override;
276  void PrintSelf(std::ostream & os, Indent indent) const override;
277 
278  void InternalReadImageInformation();
279 
282 
283  std::string m_UIDPrefix;
284  std::string m_StudyInstanceUID;
285  std::string m_SeriesInstanceUID;
287 
289 
291 
292 private:
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
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.
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
std::string m_StudyDescription
static bool GetLoadPrivateTagsDefault()
virtual void LoadSequencesOn()
ImageIOBase::IOComponentType m_InternalComponentType
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:60
std::string m_Modality
static void LoadPrivateTagsDefaultOff()
static void SetLoadPrivateTagsDefault(bool)
std::string m_Model
virtual void SetMaxSizeLoadEntry(const long)