SimpleITK  
sitkImageReaderBase.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 sitkImageReaderBase_h
19 #define sitkImageReaderBase_h
20 
21 #include "sitkProcessObject.h"
22 #include "sitkPixelIDValues.h"
23 #include "sitkPathType.h"
24 #include "sitkIO.h"
25 
26 namespace itk
27 {
28 
29 // Forward declaration for pointer
30 class ImageIOBase;
31 
32 template <class T>
33 class SmartPointer;
34 
35 namespace simple
36 {
37 
43 {
44 public:
46 
47  ~ImageReaderBase() override;
48 
50 
51 
60  SITK_RETURN_SELF_TYPE_HEADER
61  SetOutputPixelType(PixelIDValueEnum pixelID);
63  GetOutputPixelType() const;
64  /* @} */
65 
66  virtual Image
67  Execute() = 0;
68 
69  std::string
70  ToString() const override;
71 
74  virtual std::vector<std::string>
75  GetRegisteredImageIOs() const;
76 
82  virtual SITK_RETURN_SELF_TYPE_HEADER
83  SetLoadPrivateTags(bool loadPrivateTags);
84  virtual bool
85  GetLoadPrivateTags() const;
86  virtual void
87  LoadPrivateTagsOn();
88  virtual void
89  LoadPrivateTagsOff();
90  /* @} */
91 
92 
106  virtual SITK_RETURN_SELF_TYPE_HEADER
107  SetImageIO(const std::string & imageio);
108  virtual std::string
109  GetImageIO() const;
110  /* @} */
111 
120  static std::string
121  GetImageIOFromFileName(const PathType & fileName);
122 
123 protected:
125  GetImageIOBase(const PathType & fileName);
126 
127  void
128  GetPixelIDFromImageIO(const PathType & fileName, PixelIDValueType & outPixelType, unsigned int & outDimensions);
129  void
130  GetPixelIDFromImageIO(const itk::ImageIOBase * iobase, PixelIDValueType & outPixelType, unsigned int & outDimensions);
131 
132  unsigned int
133  GetDimensionFromImageIO(const PathType & filename, unsigned int i);
134  unsigned int
135  GetDimensionFromImageIO(const itk::ImageIOBase * iobase, unsigned int i);
136 
137 
138 private:
140  ExecuteInternalReadScalar(int componentType);
141 
143  ExecuteInternalReadVector(int componentType);
144 
146  ExecuteInternalReadComplex(int componentType);
147 
148 
151 
152  std::string m_ImageIOName;
153 };
154 } // namespace simple
155 } // namespace itk
156 
157 
158 #endif // sitkImageReaderBase_h
itk::simple::Image
The Image class for SimpleITK.
Definition: sitkImage.h:76
itk::ImageIOBase
SITKIO_EXPORT
#define SITKIO_EXPORT
Definition: sitkIO.h:33
itk::SmartPointer
Definition: sitkImage.h:38
sitkPathType.h
itk::simple::PixelIDValueEnum
PixelIDValueEnum
Enumerated values of pixelIDs.
Definition: sitkPixelIDValues.h:100
itk::simple::ioutils::GetRegisteredImageIOs
SITKIO_HIDDEN std::vector< std::string > GetRegisteredImageIOs()
itk::simple::ImageReaderBase::m_ImageIOName
std::string m_ImageIOName
Set/Get The output PixelType of the image.
Definition: sitkImageReaderBase.h:152
itk::simple::ImageReaderBase::m_OutputPixelType
PixelIDValueEnum m_OutputPixelType
Set/Get The output PixelType of the image.
Definition: sitkImageReaderBase.h:149
sitkProcessObject.h
sitkPixelIDValues.h
itk::simple::ImageReaderBase
An abstract base class for image readers.
Definition: sitkImageReaderBase.h:42
itk
itk::simple::ImageReaderBase::m_LoadPrivateTags
bool m_LoadPrivateTags
Set/Get The output PixelType of the image.
Definition: sitkImageReaderBase.h:150
itk::simple::ProcessObject
Base class for SimpleITK classes based on ProcessObject.
Definition: sitkProcessObject.h:54
sitkIO.h
itk::simple::PathType
std::string PathType
Definition: sitkPathType.h:25
itk::simple::PixelIDValueType
int PixelIDValueType
Definition: sitkPixelIDValues.h:30