ITK  4.13.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< typename TInputImage, typename TOutputImage >
90 class ITK_TEMPLATE_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 
123 
125  DIRECTIONCOLLAPSETOUNKOWN=0,
126  DIRECTIONCOLLAPSETOIDENTITY=1,
127  DIRECTIONCOLLAPSETOSUBMATRIX=2,
128  DIRECTIONCOLLAPSETOGUESS=3
129  } DIRECTIONCOLLAPSESTRATEGY;
130 
131 
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 
183  {
184  return this->m_DirectionCollapseStrategy;
185  }
186 
189  {
190  this->SetDirectionCollapseToStrategy(DIRECTIONCOLLAPSETOGUESS);
191  }
192 
195  {
196  this->SetDirectionCollapseToStrategy(DIRECTIONCOLLAPSETOIDENTITY);
197  }
198 
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  // Begin concept checking
228  itkConceptMacro( InputCovertibleToOutputCheck,
230  // End concept checking
231 #endif
232 
233 protected:
235  ~ExtractImageFilter() ITK_OVERRIDE {}
236  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
237 
246  virtual void GenerateOutputInformation() ITK_OVERRIDE;
247 
258  virtual void CallCopyOutputRegionToInputRegion(InputImageRegionType & destRegion,
259  const OutputImageRegionType & srcRegion) ITK_OVERRIDE;
260 
270  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
271  ThreadIdType threadId) ITK_OVERRIDE;
272 
276  void GenerateData() ITK_OVERRIDE;
277 
278  InputImageRegionType m_ExtractionRegion;
279 
280  OutputImageRegionType m_OutputImageRegion;
281 
282 private:
283  ITK_DISALLOW_COPY_AND_ASSIGN(ExtractImageFilter);
284 
285  DIRECTIONCOLLAPSESTRATEGY m_DirectionCollapseStrategy;
286 };
287 } // end namespace itk
288 
289 #ifndef ITK_MANUAL_INSTANTIATION
290 #include "itkExtractImageFilter.hxx"
291 #endif
292 
293 #endif
TOutputImage::SizeType OutputImageSizeType
Decrease the image size by cropping the image to the selected region bounds.
A special variation of ImageRegionCopier for when the output image has fewer dimensions than the inpu...
TInputImage::IndexType InputImageIndexType
InPlaceImageFilter< TInputImage, TOutputImage > Superclass
ImageToImageFilterDetail::ExtractImageFilterRegionCopier< itkGetStaticConstMacro(InputImageDimension), itkGetStaticConstMacro(OutputImageDimension) > ExtractImageFilterRegionCopierType
SmartPointer< Self > Pointer
SmartPointer< const Self > ConstPointer
TOutputImage::IndexType OutputImageIndexType
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
TInputImage::PixelType InputImagePixelType
enum itk::ExtractImageFilter::DirectionCollapseStrategyEnum DIRECTIONCOLLAPSESTRATEGY
void SetDirectionCollapseToStrategy(const DIRECTIONCOLLAPSESTRATEGY choosenStrategy)
TOutputImage::RegionType OutputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for filters that take an image as input and overwrite that image as the output...
TInputImage::SizeType InputImageSizeType
TOutputImage::PixelType OutputImagePixelType
#define itkConceptMacro(name, concept)
DIRECTIONCOLLAPSESTRATEGY GetDirectionCollapseToStrategy() const
TInputImage::RegionType InputImageRegionType