ITK  4.8.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 {
85 class InternalHeader;
86 class ITKIOGDCM_EXPORT GDCMImageIO:public ImageIOBase
87 {
88 public:
90  typedef GDCMImageIO Self;
93 
95  itkNewMacro(Self);
96 
98  itkTypeMacro(GDCMImageIO, Superclass);
99 
100  /*-------- This part of the interface deals with reading data. ------ */
101 
104  virtual bool CanReadFile(const char *) ITK_OVERRIDE;
105 
107  virtual void ReadImageInformation() ITK_OVERRIDE;
108 
110  virtual void Read(void *buffer) ITK_OVERRIDE;
111 
115  itkGetEnumMacro(InternalComponentType, IOComponentType);
116  itkSetEnumMacro(InternalComponentType, IOComponentType);
118 
119  /*-------- This part of the interfaces deals with writing data. ----- */
120 
123  virtual bool CanWriteFile(const char *) ITK_OVERRIDE;
124 
127  virtual void WriteImageInformation() ITK_OVERRIDE;
128 
131  virtual void Write(const void *buffer) ITK_OVERRIDE;
132 
136  itkGetConstMacro(RescaleSlope, double);
137  itkGetConstMacro(RescaleIntercept, double);
139 
144  itkGetStringMacro(UIDPrefix);
145  itkSetStringMacro(UIDPrefix);
147 
149  itkGetStringMacro(StudyInstanceUID);
150  itkGetStringMacro(SeriesInstanceUID);
151  itkGetStringMacro(FrameOfReferenceInstanceUID);
153 
156  itkSetMacro(KeepOriginalUID, bool);
157  itkGetConstMacro(KeepOriginalUID, bool);
158  itkBooleanMacro(KeepOriginalUID);
160 
164  itkSetMacro(LoadPrivateTags, bool);
165  itkGetConstMacro(LoadPrivateTags, bool);
166  itkBooleanMacro(LoadPrivateTags);
168 
169 #if defined( ITKIO_DEPRECATED_GDCM1_API )
170 
176  void GetPatientName(char *name);
177 
178  void GetPatientID(char *id);
179 
180  void GetPatientSex(char *sex);
181 
182  void GetPatientAge(char *age);
183 
184  void GetStudyID(char *id);
185 
186  void GetPatientDOB(char *dob);
187 
188  void GetStudyDescription(char *desc);
189 
190  void GetBodyPart(char *part);
191 
192  void GetNumberOfSeriesInStudy(char *series);
193 
194  void GetNumberOfStudyRelatedSeries(char *series);
195 
196  void GetStudyDate(char *date);
197 
198  void GetModality(char *modality);
199 
200  void GetManufacturer(char *manu);
201 
202  void GetInstitution(char *ins);
203 
204  void GetModel(char *model);
205 
206  void GetScanOptions(char *options);
207 #endif
208 
212  bool GetValueFromTag(const std::string & tag, std::string & value);
213 
220  static bool GetLabelFromTag(const std::string & tag,
221  std::string & labelId);
222 
223 #if defined( ITKIO_DEPRECATED_GDCM1_API )
224 
231  virtual void SetMaxSizeLoadEntry( const long ) {}
232 
238  virtual void SetLoadSequences( const bool ) {}
239  virtual bool GetLoadSequences () const { return true; }
240  virtual void LoadSequencesOn () {}
241  virtual void LoadSequencesOff () {}
243 
252  static void SetLoadSequencesDefault(bool) {}
253  static void LoadSequencesDefaultOn() {}
254  static void LoadSequencesDefaultOff() {}
255  static bool GetLoadSequencesDefault() { return true; }
257 
266  static void SetLoadPrivateTagsDefault(bool) {}
267  static void LoadPrivateTagsDefaultOn() {}
268  static void LoadPrivateTagsDefaultOff() {}
269  static bool GetLoadPrivateTagsDefault() { return true; }
270 #endif
271 
272 
274  typedef enum { JPEG = 0, JPEG2000, JPEGLS, RLE } TCompressionType;
275  itkSetEnumMacro(CompressionType, TCompressionType);
276  itkGetEnumMacro(CompressionType, TCompressionType);
278 
279 protected:
280  GDCMImageIO();
281  ~GDCMImageIO();
282  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
283 
284  void InternalReadImageInformation();
285 
288 
289  std::string m_UIDPrefix;
290  std::string m_StudyInstanceUID;
291  std::string m_SeriesInstanceUID;
293 
295 
297 
298 private:
299  GDCMImageIO(const Self &); //purposely not implemented
300  void operator=(const Self &); //purposely not implemented
301 
302 #if defined( ITKIO_DEPRECATED_GDCM1_API )
303  std::string m_PatientName;
304  std::string m_PatientID;
305  std::string m_PatientDOB;
306  std::string m_StudyID;
307  std::string m_StudyDescription;
308  std::string m_BodyPart;
311  std::string m_PatientSex;
312  std::string m_PatientAge;
313  std::string m_StudyDate;
314  std::string m_Modality;
315  std::string m_Manufacturer;
316  std::string m_Institution;
317  std::string m_Model;
318  std::string m_ScanOptions;
319 #endif
320 
325 
327  InternalHeader * m_DICOMHeader;
328 };
329 } // end namespace itk
330 
331 #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 o...
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