SimpleITK  1.3.0.dev466
sitkImageReaderBase.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 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  virtual ~ImageReaderBase();
46 
48 
49 
58  SITK_RETURN_SELF_TYPE_HEADER SetOutputPixelType( PixelIDValueEnum pixelID );
59  PixelIDValueEnum GetOutputPixelType( void ) const;
60  /* @} */
61 
62  virtual Image Execute() = 0;
63 
64  virtual std::string ToString() const;
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( void ) const;
97  /* @} */
98 
99 
100  protected:
101 
102  itk::SmartPointer<ImageIOBase> GetImageIOBase(const std::string &fileName);
103 
104  void GetPixelIDFromImageIO( const std::string &fileName,
105  PixelIDValueType &outPixelType,
106  unsigned int & outDimensions );
107  void GetPixelIDFromImageIO( const itk::ImageIOBase* iobase,
108  PixelIDValueType &outPixelType,
109  unsigned int & outDimensions );
110 
111  unsigned int GetDimensionFromImageIO( const std::string &fileName, unsigned int i );
112  unsigned int GetDimensionFromImageIO( const itk::ImageIOBase* iobase, unsigned int i );
113 
114 
115  private:
116 
117  PixelIDValueType ExecuteInternalReadScalar( int componentType );
118 
119  PixelIDValueType ExecuteInternalReadVector( int componentType );
120 
121  PixelIDValueType ExecuteInternalReadComplex( int componentType );
122 
123 
126 
127  std::string m_ImageIOName;
128 
129  };
130  }
131 }
132 
133 
134 #endif // sitkImageReaderBase_h
An abract base class for image readers.
PixelIDValueEnum
Enumerated values of pixelIDs.
#define SITKIO_EXPORT
Definition: sitkIO.h:33
The Image class for SimpleITK.
Definition: sitkImage.h:78
SITKIO_HIDDEN std::vector< std::string > GetRegisteredImageIOs()
Base class for SimpleITK classes based on ProcessObject.