ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkDCMTKImageIO.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 #ifndef itkDCMTKImageIO_h
19 #define itkDCMTKImageIO_h
20 #include "ITKIODCMTKExport.h"
21 
22 
23 #include <fstream>
24 #include <stdio.h>
25 #include "itkImageIOBase.h"
26 
27 class DicomImage;
28 
29 namespace itk
30 {
39 class ITKIODCMTK_EXPORT DCMTKImageIO:public ImageIOBase
40 {
41 public:
43  typedef DCMTKImageIO Self;
46 
48  itkNewMacro(Self);
49 
51  itkTypeMacro(DCMTKImageIO, ImageIOBase);
52 
57  enum LogLevel
58  {
59  TRACE_LOG_LEVEL = 0,
66  };
67 
69  void SetDicomImagePointer( DicomImage* UserProvided)
70  {
71  m_DImage = UserProvided;
72  m_DicomImageSetByUser = true;
73  }
74 
75  /*-------- This part of the interfaces deals with reading data. ----- */
76 
79  virtual bool CanReadFile(const char *) ITK_OVERRIDE;
80 
82  virtual void ReadImageInformation() ITK_OVERRIDE;
83 
85  virtual void Read(void *buffer) ITK_OVERRIDE;
86 
87  /*-------- This part of the interfaces deals with writing data. ----- */
88 
91  virtual bool CanWriteFile(const char *) ITK_OVERRIDE;
92 
94  virtual void WriteImageInformation() ITK_OVERRIDE;
95 
98  virtual void Write(const void *buffer) ITK_OVERRIDE;
99 
101  void SetLogLevel(LogLevel level);
102 
104  LogLevel GetLogLevel() const;
105 
106  DCMTKImageIO();
107  ~DCMTKImageIO();
108  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
109 
110 private:
111  DCMTKImageIO(const Self &) ITK_DELETE_FUNCTION;
112  void operator=(const Self &) ITK_DELETE_FUNCTION;
113 
114  void OpenDicomImage();
115 
116  /*----- internal helpers --------------------------------------------*/
117  bool m_UseJPEGCodec;
118  bool m_UseJPLSCodec;
119  bool m_UseRLECodec;
120 
121  DicomImage* m_DImage;
122 
123  bool m_DicomImageSetByUser;
124 
125  double m_RescaleSlope;
126  double m_RescaleIntercept;
127  std::string m_LastFileName;
128 };
129 } // end namespace itk
130 
131 #endif // itkDCMTKImageIO_h
Light weight base class for most itk classes.
Abstract superclass defines image IO interface.
ImageIOBase Superclass
void SetDicomImagePointer(DicomImage *UserProvided)
SmartPointer< Self > Pointer
Control indentation during Print() invocation.
Definition: itkIndent.h:49
DCMTKImageIO Self
Read DICOM image file format.