ITK  4.13.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:
92 
94  itkNewMacro(Self);
95 
98 
100  typedef TInputImage InputImageType;
101  typedef TOutputImage OutputImageType;
102 
104  typedef typename TOutputImage::RegionType OutputImageRegionType;
105  typedef typename TInputImage::RegionType InputImageRegionType;
106 
108  typedef typename TOutputImage::PixelType OutputImagePixelType;
109  typedef typename TInputImage::PixelType InputImagePixelType;
110 
116 
118  DIRECTIONCOLLAPSETOUNKOWN=0,
119  DIRECTIONCOLLAPSETOIDENTITY=1,
120  DIRECTIONCOLLAPSETOSUBMATRIX=2,
121  DIRECTIONCOLLAPSETOGUESS=3
122  } DIRECTIONCOLLAPSESTRATEGY;
123 
124 
150  {
151  switch(choosenStrategy)
152  {
153  case DIRECTIONCOLLAPSETOGUESS:
154  case DIRECTIONCOLLAPSETOIDENTITY:
155  case DIRECTIONCOLLAPSETOSUBMATRIX:
156  break;
157  case DIRECTIONCOLLAPSETOUNKOWN:
158  default:
159  itkExceptionMacro( << "Invalid Strategy Chosen for itk::ExtractSliceImageFilter" );
160  }
162 
163  this->m_DirectionCollaspeStrategy=choosenStrategy;
164  this->Modified();
165  }
166 
176  {
177  return this->m_DirectionCollaspeStrategy;
178  }
179 
182  {
183  this->SetDirectionCollapseToStrategy(DIRECTIONCOLLAPSETOGUESS);
184  }
185 
188  {
189  this->SetDirectionCollapseToStrategy(DIRECTIONCOLLAPSETOIDENTITY);
190  }
191 
194  {
195  this->SetDirectionCollapseToStrategy(DIRECTIONCOLLAPSETOSUBMATRIX);
196  }
197 
198 
200  itkStaticConstMacro(InputImageDimension, unsigned int,
201  TInputImage::ImageDimension);
202  itkStaticConstMacro(OutputImageDimension, unsigned int,
203  TOutputImage::ImageDimension);
205 
207  itkGetStaticConstMacro(InputImageDimension),
208  itkGetStaticConstMacro(OutputImageDimension) > ExtractSliceImageFilterRegionCopierType;
209 
215  void SetExtractionRegion(InputImageRegionType extractRegion);
216  itkGetConstMacro(ExtractionRegion, InputImageRegionType);
218 
220  using Superclass::SetInput;
221  virtual void SetInput(const TInputImage *image);
222  const TInputImage * GetInput() const;
224 
225 #ifdef ITK_USE_CONCEPT_CHECKING
226  // Begin concept checking
227  itkConceptMacro( InputCovertibleToOutputCheck,
229  // End concept checking
230 #endif
231 
232 protected:
234  ~ExtractSliceImageFilter() ITK_OVERRIDE {}
235  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
236 
245  virtual void GenerateOutputInformation() ITK_OVERRIDE;
246 
256  virtual void CallCopyOutputRegionToInputRegion(InputImageRegionType & destRegion,
257  const OutputImageRegionType & srcRegion);
258 
267  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
268  ThreadIdType threadId) ITK_OVERRIDE;
269 
270  InputImageRegionType m_ExtractionRegion;
271 
272  OutputImageRegionType m_OutputImageRegion;
273 
274 private:
275  ITK_DISALLOW_COPY_AND_ASSIGN(ExtractSliceImageFilter);
276 
277  DIRECTIONCOLLAPSESTRATEGY m_DirectionCollaspeStrategy;
278 };
279 } // end namespace Testing
280 } // end namespace itk
281 
282 #ifndef ITK_MANUAL_INSTANTIATION
283 #include "itkTestingExtractSliceImageFilter.hxx"
284 #endif
285 
286 #endif
A special variation of ImageRegionCopier for when the output image has fewer dimensions than the inpu...
Base class for all process objects that output image data.
ImageToImageFilterDetail::ExtractImageFilterRegionCopier< itkGetStaticConstMacro(InputImageDimension), itkGetStaticConstMacro(OutputImageDimension) > ExtractSliceImageFilterRegionCopierType
enum itk::Testing::ExtractSliceImageFilter::DirectionCollaspeStrategyEnum DIRECTIONCOLLAPSESTRATEGY
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
OutputImageType::RegionType OutputImageRegionType
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.