ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkCropImageFilter.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 itkCropImageFilter_h
19 #define itkCropImageFilter_h
20 
21 #include "itkExtractImageFilter.h"
22 
23 namespace itk
24 {
42 template< typename TInputImage, typename TOutputImage >
43 class ITK_TEMPLATE_EXPORT CropImageFilter:
44  public ExtractImageFilter< TInputImage, TOutputImage >
45 {
46 public:
52 
54  itkNewMacro(Self);
55 
58 
62 
66 
68  typedef typename Superclass::OutputImageIndexType OutputImageIndexType;
69  typedef typename Superclass::InputImageIndexType InputImageIndexType;
70  typedef typename Superclass::OutputImageSizeType OutputImageSizeType;
73 
75  itkStaticConstMacro(InputImageDimension, unsigned int,
76  Superclass::InputImageDimension);
77  itkStaticConstMacro(OutputImageDimension, unsigned int,
78  Superclass::OutputImageDimension);
80 
82  itkSetMacro(UpperBoundaryCropSize, SizeType);
83  itkGetConstMacro(UpperBoundaryCropSize, SizeType);
84  itkSetMacro(LowerBoundaryCropSize, SizeType);
85  itkGetConstMacro(LowerBoundaryCropSize, SizeType);
87 
88  void SetBoundaryCropSize(const SizeType & s)
89  {
90  this->SetUpperBoundaryCropSize(s);
91  this->SetLowerBoundaryCropSize(s);
92  }
93 
94 #ifdef ITK_USE_CONCEPT_CHECKING
95  // Begin concept checking
96  itkConceptMacro( InputConvertibleToOutputCheck,
98  itkConceptMacro( SameDimensionCheck,
100  // End concept checking
101 #endif
102 
103 protected:
105  {
106  this->SetDirectionCollapseToSubmatrix();
107  m_UpperBoundaryCropSize.Fill(0);
108  m_LowerBoundaryCropSize.Fill(0);
109  }
110 
111  ~CropImageFilter() ITK_OVERRIDE {}
112  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
113 
114  void GenerateOutputInformation() ITK_OVERRIDE;
115 
116 private:
117  ITK_DISALLOW_COPY_AND_ASSIGN(CropImageFilter);
118 
119  SizeType m_UpperBoundaryCropSize;
120  SizeType m_LowerBoundaryCropSize;
121 };
122 } // end namespace itk
123 
124 #ifndef ITK_MANUAL_INSTANTIATION
125 #include "itkCropImageFilter.hxx"
126 #endif
127 
128 #endif
SmartPointer< Self > Pointer
Superclass::OutputImagePixelType OutputImagePixelType
ExtractImageFilter< TInputImage, TOutputImage > Superclass
Decrease the image size by cropping the image to the selected region bounds.
Superclass::OutputImagePixelType OutputImagePixelType
Superclass::OutputImageRegionType OutputImageRegionType
SmartPointer< const Self > ConstPointer
Superclass::InputImageIndexType InputImageIndexType
Superclass::InputImageRegionType InputImageRegionType
Superclass::OutputImageIndexType OutputImageIndexType
Superclass::OutputImageSizeType OutputImageSizeType
Decrease the image size by cropping the image by an itk::Size at both the upper and lower bounds of t...
Superclass::InputImagePixelType InputImagePixelType
void SetBoundaryCropSize(const SizeType &s)
InputImageSizeType SizeType
InputImageType::RegionType InputImageRegionType
Superclass::OutputImageRegionType OutputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
TInputImage::SizeType InputImageSizeType
#define itkConceptMacro(name, concept)
Superclass::InputImageSizeType InputImageSizeType
InputImageType::PixelType InputImagePixelType