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 "sitkIO.h"
24 
25 namespace itk {
26 
27 // Forward declaration for pointer
28 class ImageIOBase;
29 
30 template<class T>
31 class SmartPointer;
32 
33  namespace simple {
34 
40  public ProcessObject
41  {
42  public:
44 
45  ~ImageReaderBase() override;
46 
48 
49 
58  SITK_RETURN_SELF_TYPE_HEADER SetOutputPixelType( PixelIDValueEnum pixelID );
59  PixelIDValueEnum GetOutputPixelType( ) const;
60  /* @} */
61 
62  virtual Image Execute() = 0;
63 
64  std::string ToString() const override;
65 
68  virtual std::vector<std::string> GetRegisteredImageIOs() const;
69 
75  virtual SITK_RETURN_SELF_TYPE_HEADER SetLoadPrivateTags(bool loadPrivateTags);
76  virtual bool GetLoadPrivateTags() const;
77  virtual void LoadPrivateTagsOn();
78  virtual void LoadPrivateTagsOff();
79  /* @} */
80 
81 
95  virtual SITK_RETURN_SELF_TYPE_HEADER SetImageIO(const std::string &imageio);
96  virtual std::string GetImageIO( ) const;
97  /* @} */
98 
107  static std::string GetImageIOFromFileName(const std::string &fileName);
108 
109  protected:
110 
111  itk::SmartPointer<ImageIOBase> GetImageIOBase(const std::string &fileName);
112 
113  void GetPixelIDFromImageIO( const std::string &fileName,
114  PixelIDValueType &outPixelType,
115  unsigned int & outDimensions );
116  void GetPixelIDFromImageIO( const itk::ImageIOBase* iobase,
117  PixelIDValueType &outPixelType,
118  unsigned int & outDimensions );
119 
120  unsigned int GetDimensionFromImageIO( const std::string &fileName, unsigned int i );
121  unsigned int GetDimensionFromImageIO( const itk::ImageIOBase* iobase, unsigned int i );
122 
123 
124  private:
125 
126  PixelIDValueType ExecuteInternalReadScalar( int componentType );
127 
128  PixelIDValueType ExecuteInternalReadVector( int componentType );
129 
130  PixelIDValueType ExecuteInternalReadComplex( int componentType );
131 
132 
135 
136  std::string m_ImageIOName;
137 
138  };
139  }
140 }
141 
142 
143 #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
itk::simple::PixelIDValueEnum
PixelIDValueEnum
Enumerated values of pixelIDs.
Definition: sitkPixelIDValues.h:91
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:136
itk::simple::ImageReaderBase::m_OutputPixelType
PixelIDValueEnum m_OutputPixelType
Set/Get The output PixelType of the image.
Definition: sitkImageReaderBase.h:133
sitkProcessObject.h
sitkPixelIDValues.h
itk::simple::ImageReaderBase
An abstract base class for image readers.
Definition: sitkImageReaderBase.h:39
itk
itk::simple::ImageReaderBase::m_LoadPrivateTags
bool m_LoadPrivateTags
Set/Get The output PixelType of the image.
Definition: sitkImageReaderBase.h:134
itk::simple::ProcessObject
Base class for SimpleITK classes based on ProcessObject.
Definition: sitkProcessObject.h:51
sitkIO.h
itk::simple::PixelIDValueType
int PixelIDValueType
Definition: sitkPixelIDValues.h:30