ITK  5.0.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:
94  ITK_DISALLOW_COPY_AND_ASSIGN(ExtractImageFilter);
95 
101 
103  itkNewMacro(Self);
104 
106  itkTypeMacro(ExtractImageFilter, InPlaceImageFilter);
107 
109  using InputImageType = TInputImage;
110  using OutputImageType = TOutputImage;
111 
115 
117  using OutputImagePixelType = typename TOutputImage::PixelType;
118  using InputImagePixelType = typename TInputImage::PixelType;
119 
125 
127  DIRECTIONCOLLAPSETOUNKOWN=0,
128  DIRECTIONCOLLAPSETOIDENTITY=1,
129  DIRECTIONCOLLAPSETOSUBMATRIX=2,
130  DIRECTIONCOLLAPSETOGUESS=3
131  } DIRECTIONCOLLAPSESTRATEGY;
132 
133 
159  {
160  switch(choosenStrategy)
161  {
162  case DIRECTIONCOLLAPSETOGUESS:
163  case DIRECTIONCOLLAPSETOIDENTITY:
164  case DIRECTIONCOLLAPSETOSUBMATRIX:
165  break;
166  case DIRECTIONCOLLAPSETOUNKOWN:
167  default:
168  itkExceptionMacro( << "Invalid Strategy Chosen for itk::ExtractImageFilter" );
169  }
171 
172  this->m_DirectionCollapseStrategy=choosenStrategy;
173  this->Modified();
174  }
175 
185  {
186  return this->m_DirectionCollapseStrategy;
187  }
188 
191  {
192  this->SetDirectionCollapseToStrategy(DIRECTIONCOLLAPSETOGUESS);
193  }
194 
197  {
198  this->SetDirectionCollapseToStrategy(DIRECTIONCOLLAPSETOIDENTITY);
199  }
200 
203  {
204  this->SetDirectionCollapseToStrategy(DIRECTIONCOLLAPSETOSUBMATRIX);
205  }
206 
207 
209  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
210  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
211 
213  Self::InputImageDimension,
214  Self::OutputImageDimension >;
215 
221  void SetExtractionRegion(InputImageRegionType extractRegion);
222  itkGetConstMacro(ExtractionRegion, InputImageRegionType);
224 
225 #ifdef ITK_USE_CONCEPT_CHECKING
226  // Begin concept checking
227  itkConceptMacro( InputCovertibleToOutputCheck,
229  // End concept checking
230 #endif
231 
232 protected:
234  ~ExtractImageFilter() override = default;
235  void PrintSelf(std::ostream & os, Indent indent) const override;
236 
245  void GenerateOutputInformation() override;
246 
257  void CallCopyOutputRegionToInputRegion(InputImageRegionType & destRegion,
258  const OutputImageRegionType & srcRegion) override;
259 
269  void DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
270 
273  void GenerateData() override;
274 
276 
278 
279 private:
281 };
282 } // end namespace itk
283 
284 #ifndef ITK_MANUAL_INSTANTIATION
285 #include "itkExtractImageFilter.hxx"
286 #endif
287 
288 #endif
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...
typename TInputImage::PixelType InputImagePixelType
typename TOutputImage::PixelType OutputImagePixelType
typename TInputImage::RegionType InputImageRegionType
DIRECTIONCOLLAPSESTRATEGY m_DirectionCollapseStrategy
typename TInputImage::SizeType InputImageSizeType
typename TOutputImage::RegionType OutputImageRegionType
enum itk::ExtractImageFilter::DirectionCollapseStrategyEnum DIRECTIONCOLLAPSESTRATEGY
void SetDirectionCollapseToStrategy(const DIRECTIONCOLLAPSESTRATEGY choosenStrategy)
typename TInputImage::IndexType InputImageIndexType
typename TOutputImage::SizeType OutputImageSizeType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename TOutputImage::IndexType OutputImageIndexType
OutputImageRegionType m_OutputImageRegion
Base class for filters that take an image as input and overwrite that image as the output...
InputImageRegionType m_ExtractionRegion
#define itkConceptMacro(name, concept)
DIRECTIONCOLLAPSESTRATEGY GetDirectionCollapseToStrategy() const