ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkTestingExtractSliceImageFilter.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 itkTestingExtractSliceImageFilter_h
19 #define itkTestingExtractSliceImageFilter_h
20 
21 #include "itkSmartPointer.h"
22 #include "itkImageSource.h"
24 
25 namespace itk
26 {
27 namespace Testing
28 {
82 template< typename TInputImage, typename TOutputImage >
83 class ITK_TEMPLATE_EXPORT ExtractSliceImageFilter:
84  public ImageSource< TOutputImage >
85 {
86 public:
87  ITK_DISALLOW_COPY_AND_ASSIGN(ExtractSliceImageFilter);
88 
94 
96  itkNewMacro(Self);
97 
99  itkTypeMacro(ExtractSliceImageFilter, ImageSource);
100 
102  using InputImageType = TInputImage;
103  using OutputImageType = TOutputImage;
104 
108 
110  using OutputImagePixelType = typename TOutputImage::PixelType;
111  using InputImagePixelType = typename TInputImage::PixelType;
112 
118 
120  DIRECTIONCOLLAPSETOUNKOWN=0,
121  DIRECTIONCOLLAPSETOIDENTITY=1,
122  DIRECTIONCOLLAPSETOSUBMATRIX=2,
123  DIRECTIONCOLLAPSETOGUESS=3
124  } DIRECTIONCOLLAPSESTRATEGY;
125 
126 
152  {
153  switch(choosenStrategy)
154  {
155  case DIRECTIONCOLLAPSETOGUESS:
156  case DIRECTIONCOLLAPSETOIDENTITY:
157  case DIRECTIONCOLLAPSETOSUBMATRIX:
158  break;
159  case DIRECTIONCOLLAPSETOUNKOWN:
160  default:
161  itkExceptionMacro( << "Invalid Strategy Chosen for itk::ExtractSliceImageFilter" );
162  }
164 
165  this->m_DirectionCollaspeStrategy=choosenStrategy;
166  this->Modified();
167  }
168 
178  {
179  return this->m_DirectionCollaspeStrategy;
180  }
181 
184  {
185  this->SetDirectionCollapseToStrategy(DIRECTIONCOLLAPSETOGUESS);
186  }
187 
190  {
191  this->SetDirectionCollapseToStrategy(DIRECTIONCOLLAPSETOIDENTITY);
192  }
193 
196  {
197  this->SetDirectionCollapseToStrategy(DIRECTIONCOLLAPSETOSUBMATRIX);
198  }
199 
200 
202  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
203  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
204 
206  Self::InputImageDimension,
207  Self::OutputImageDimension >;
208 
214  void SetExtractionRegion(InputImageRegionType extractRegion);
215  itkGetConstMacro(ExtractionRegion, InputImageRegionType);
217 
219  using Superclass::SetInput;
220  virtual void SetInput(const TInputImage *image);
221  const TInputImage * GetInput() const;
223 
224 #ifdef ITK_USE_CONCEPT_CHECKING
225  // Begin concept checking
226  itkConceptMacro( InputCovertibleToOutputCheck,
228  // End concept checking
229 #endif
230 
231 protected:
233  ~ExtractSliceImageFilter() override = default;
234  void PrintSelf(std::ostream & os, Indent indent) const override;
235 
244  void GenerateOutputInformation() override;
245 
255  virtual void CallCopyOutputRegionToInputRegion(InputImageRegionType & destRegion,
256  const OutputImageRegionType & srcRegion);
257 
266  void DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
267 
269 
271 
272 private:
274 };
275 } // end namespace Testing
276 } // end namespace itk
277 
278 #ifndef ITK_MANUAL_INSTANTIATION
279 #include "itkTestingExtractSliceImageFilter.hxx"
280 #endif
281 
282 #endif
A special variation of ImageRegionCopier for when the output image has fewer dimensions than the inpu...
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
typename OutputImageType::PixelType OutputImagePixelType
enum itk::Testing::ExtractSliceImageFilter::DirectionCollaspeStrategyEnum DIRECTIONCOLLAPSESTRATEGY
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
#define itkConceptMacro(name, concept)
DIRECTIONCOLLAPSESTRATEGY GetDirectionCollapseToStrategy() const
void SetDirectionCollapseToStrategy(const DIRECTIONCOLLAPSESTRATEGY choosenStrategy)
Decrease the image size by cropping the image to the selected region bounds.