ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkExtractImageFilter.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 __itkExtractImageFilter_h
19 #define __itkExtractImageFilter_h
20 
21 #include "itkInPlaceImageFilter.h"
22 #include "itkSmartPointer.h"
24 
25 namespace itk
26 {
89 template< class TInputImage, class TOutputImage >
90 class ITK_EXPORT ExtractImageFilter:
91  public InPlaceImageFilter< TInputImage, TOutputImage >
92 {
93 public:
99 
101  itkNewMacro(Self);
102 
105 
107  typedef TInputImage InputImageType;
108  typedef TOutputImage OutputImageType;
109 
111  typedef typename TOutputImage::RegionType OutputImageRegionType;
112  typedef typename TInputImage::RegionType InputImageRegionType;
113 
115  typedef typename TOutputImage::PixelType OutputImagePixelType;
116  typedef typename TInputImage::PixelType InputImagePixelType;
117 
119  typedef typename TOutputImage::IndexType OutputImageIndexType;
120  typedef typename TInputImage::IndexType InputImageIndexType;
121  typedef typename TOutputImage::SizeType OutputImageSizeType;
122  typedef typename TInputImage::SizeType InputImageSizeType;
123 
125  DIRECTIONCOLLAPSETOUNKOWN=0,
126  DIRECTIONCOLLAPSETOIDENTITY=1,
127  DIRECTIONCOLLAPSETOSUBMATRIX=2,
128  DIRECTIONCOLLAPSETOGUESS=3
129  } DIRECTIONCOLLAPSESTRATEGY;
130 
131 
156  void SetDirectionCollapseToStrategy(const DIRECTIONCOLLAPSESTRATEGY choosenStrategy)
157  {
158  switch(choosenStrategy)
159  {
160  case DIRECTIONCOLLAPSETOGUESS:
161  case DIRECTIONCOLLAPSETOIDENTITY:
162  case DIRECTIONCOLLAPSETOSUBMATRIX:
163  break;
164  case DIRECTIONCOLLAPSETOUNKOWN:
165  default:
166  itkExceptionMacro( << "Invalid Strategy Chosen for itk::ExtractImageFilter" );
167  }
169 
170  this->m_DirectionCollapseStrategy=choosenStrategy;
171  this->Modified();
172  }
173 
182  DIRECTIONCOLLAPSESTRATEGY GetDirectionCollapseToStrategy() const
183  {
184  return this->m_DirectionCollapseStrategy;
185  }
186 
188  void SetDirectionCollapseToGuess()
189  {
190  this->SetDirectionCollapseToStrategy(DIRECTIONCOLLAPSETOGUESS);
191  }
192 
194  void SetDirectionCollapseToIdentity()
195  {
196  this->SetDirectionCollapseToStrategy(DIRECTIONCOLLAPSETOIDENTITY);
197  }
198 
200  void SetDirectionCollapseToSubmatrix()
201  {
202  this->SetDirectionCollapseToStrategy(DIRECTIONCOLLAPSETOSUBMATRIX);
203  }
204 
205 
207  itkStaticConstMacro(InputImageDimension, unsigned int,
208  TInputImage::ImageDimension);
209  itkStaticConstMacro(OutputImageDimension, unsigned int,
210  TOutputImage::ImageDimension);
212 
214  itkGetStaticConstMacro(InputImageDimension),
215  itkGetStaticConstMacro(OutputImageDimension) > ExtractImageFilterRegionCopierType;
216 
222  void SetExtractionRegion(InputImageRegionType extractRegion);
223  itkGetConstMacro(ExtractionRegion, InputImageRegionType);
225 
226 #ifdef ITK_USE_CONCEPT_CHECKING
227 
228  itkConceptMacro( InputCovertibleToOutputCheck,
230 
232 #endif
233 
234 protected:
237  void PrintSelf(std::ostream & os, Indent indent) const;
238 
247  virtual void GenerateOutputInformation();
248 
259  virtual void CallCopyOutputRegionToInputRegion(InputImageRegionType & destRegion,
260  const OutputImageRegionType & srcRegion);
261 
271  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
272  ThreadIdType threadId);
273 
277  void GenerateData();
278 
280 
282 
283 private:
284  ExtractImageFilter(const Self &); //purposely not implemented
285  void operator=(const Self &); //purposely not implemented
286 
288 };
289 } // end namespace itk
290 
291 #ifndef ITK_MANUAL_INSTANTIATION
292 #include "itkExtractImageFilter.hxx"
293 #endif
294 
295 #endif
296