ITK  5.0.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:
47  ITK_DISALLOW_COPY_AND_ASSIGN(CropImageFilter);
48 
54 
56  itkNewMacro(Self);
57 
59  itkTypeMacro(CropImageFilter, ExtractImageFilter);
60 
64 
68 
70  using OutputImageIndexType = typename Superclass::OutputImageIndexType;
71  using InputImageIndexType = typename Superclass::InputImageIndexType;
72  using OutputImageSizeType = typename Superclass::OutputImageSizeType;
73  using InputImageSizeType = typename Superclass::InputImageSizeType;
75 
77  static constexpr unsigned int InputImageDimension = Superclass::InputImageDimension;
78  static constexpr unsigned int OutputImageDimension = Superclass::OutputImageDimension;
79 
81  itkSetMacro(UpperBoundaryCropSize, SizeType);
82  itkGetConstMacro(UpperBoundaryCropSize, SizeType);
83  itkSetMacro(LowerBoundaryCropSize, SizeType);
84  itkGetConstMacro(LowerBoundaryCropSize, SizeType);
86 
87  void SetBoundaryCropSize(const SizeType & s)
88  {
89  this->SetUpperBoundaryCropSize(s);
90  this->SetLowerBoundaryCropSize(s);
91  }
92 
93 #ifdef ITK_USE_CONCEPT_CHECKING
94  // Begin concept checking
95  itkConceptMacro( InputConvertibleToOutputCheck,
97  itkConceptMacro( SameDimensionCheck,
99  // End concept checking
100 #endif
101 
102 protected:
104  {
105  this->SetDirectionCollapseToSubmatrix();
106  m_UpperBoundaryCropSize.Fill(0);
107  m_LowerBoundaryCropSize.Fill(0);
108  }
109 
110  ~CropImageFilter() override = default;
111  void PrintSelf(std::ostream & os, Indent indent) const override;
112 
113  void GenerateOutputInformation() override;
114 
115 private:
118 };
119 } // end namespace itk
120 
121 #ifndef ITK_MANUAL_INSTANTIATION
122 #include "itkCropImageFilter.hxx"
123 #endif
124 
125 #endif
typename Superclass::OutputImagePixelType OutputImagePixelType
Decrease the image size by cropping the image to the selected region bounds.
typename TInputImage::PixelType InputImagePixelType
InputImageSizeType SizeType
typename TOutputImage::PixelType OutputImagePixelType
typename TInputImage::RegionType InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
typename Superclass::OutputImageRegionType OutputImageRegionType
typename Superclass::InputImageSizeType InputImageSizeType
typename TOutputImage::RegionType OutputImageRegionType
Decrease the image size by cropping the image by an itk::Size at both the upper and lower bounds of t...
void SetBoundaryCropSize(const SizeType &s)
typename InputImageType::PixelType InputImagePixelType
typename TInputImage::IndexType InputImageIndexType
typename TOutputImage::SizeType OutputImageSizeType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename TOutputImage::IndexType OutputImageIndexType
Base class for filters that take an image as input and overwrite that image as the output...
#define itkConceptMacro(name, concept)