Tomato
itkImageFileReaderKW.h
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 itkImageFileReaderKW_h
19 #define itkImageFileReaderKW_h
20 #include "itkImageFileReaderException.h"
21 
22 #include "ITKIOImageBaseExport.h"
23 
24 #include "itkImageIOBase.h"
25 #include "itkImageSource.h"
26 #include "itkMacro.h"
27 #include "itkImageRegion.h"
28 #include "itkDefaultConvertPixelTraits.h"
29 #include "itkSimpleDataObjectDecorator.h"
30 
31 namespace itk
32 {
33 
73  template< typename TOutputImage,
74  typename ConvertPixelTraits = DefaultConvertPixelTraits<
75  typename TOutputImage::IOPixelType > >
76  class ITKIOImageBase_HIDDEN ImageFileReaderKW:public ImageSource< TOutputImage >
77  {
78  public:
81  typedef ImageSource< TOutputImage > Superclass;
82  typedef SmartPointer< Self > Pointer;
83 
85  itkNewMacro(Self);
86 
88  itkTypeMacro(ImageFileReaderKW, ImageSource);
89 
91  typedef typename TOutputImage::SizeType SizeType;
92 
94  typedef typename TOutputImage::IndexType IndexType;
95 
97  typedef typename TOutputImage::RegionType ImageRegionType;
98 
100  typedef typename TOutputImage::InternalPixelType OutputImagePixelType;
101 
103  itkSetGetDecoratedInputMacro(FileName, std::string);
104 
111  void SetImageIO(ImageIOBase *imageIO);
112  itkGetModifiableObjectMacro(ImageIO, ImageIOBase);
113 
115  itkSetMacro(UseStreaming, bool);
116  itkGetConstReferenceMacro(UseStreaming, bool);
117  itkBooleanMacro(UseStreaming);
118 
119  protected:
122  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
123 
125  void DoConvertBuffer(void *buffer, size_t numberOfPixels);
126 
132  void TestFileExistanceAndReadability();
133 
136  virtual void GenerateOutputInformation(void) ITK_OVERRIDE;
137 
143  virtual void EnlargeOutputRequestedRegion(DataObject *output) ITK_OVERRIDE;
144 
146  virtual void GenerateData() ITK_OVERRIDE;
147 
148  ImageIOBase::Pointer m_ImageIO;
149 
150  bool m_UserSpecifiedImageIO; // keep track whether the
151  // ImageIO is user specified
152 
153  bool m_UseStreaming;
154 
155  private:
156  ITK_DISALLOW_COPY_AND_ASSIGN(ImageFileReaderKW);
157 
158  std::string m_ExceptionMessage;
159 
160  // The region that the ImageIO class will return when we ask to
161  // produce the requested region.
162  ImageIORegion m_ActualIORegion;
163  };
164 } //namespace ITK
165 
166 #ifndef ITK_MANUAL_INSTANTIATION
167 #include "itkImageFileReaderKW.hxx"
168 #endif
169 
170 #ifdef ITK_IO_FACTORY_REGISTER_MANAGER
171 #include "itkImageIOFactoryRegisterManager.h"
172 #endif
173 
174 #endif // itkImageFileReaderKW_h
TOutputImage::InternalPixelType OutputImagePixelType
Definition: itkImageFileReaderKW.h:100
TOutputImage::RegionType ImageRegionType
Definition: itkImageFileReaderKW.h:97
TOutputImage::SizeType SizeType
Definition: itkImageFileReaderKW.h:91
Definition: itkImageFileReaderKW.h:31
Data source that reads image data from a single file.
Definition: itkImageFileReaderKW.h:76
TOutputImage::IndexType IndexType
Definition: itkImageFileReaderKW.h:94
ImageFileReaderKW Self
Definition: itkImageFileReaderKW.h:80