ITK  5.4.0
Insight Toolkit
itkCropImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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 {
43 template <typename TInputImage, typename TOutputImage>
44 class ITK_TEMPLATE_EXPORT CropImageFilter : public ExtractImageFilter<TInputImage, TOutputImage>
45 {
46 public:
47  ITK_DISALLOW_COPY_AND_MOVE(CropImageFilter);
48 
54 
56  itkNewMacro(Self);
57 
59  itkOverrideGetNameOfClassMacro(CropImageFilter);
60 
62  using typename Superclass::OutputImageRegionType;
63  using typename Superclass::InputImageRegionType;
64 
66  using typename Superclass::OutputImagePixelType;
67  using typename Superclass::InputImagePixelType;
68 
70  using typename Superclass::OutputImageIndexType;
71  using typename Superclass::InputImageIndexType;
72  using typename Superclass::OutputImageSizeType;
73  using typename Superclass::InputImageSizeType;
74  using SizeType = 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);
87  void
89  {
90  this->SetUpperBoundaryCropSize(s);
91  this->SetLowerBoundaryCropSize(s);
92  }
93 
94 #ifdef ITK_USE_CONCEPT_CHECKING
95  // Begin concept checking
98  // End concept checking
99 #endif
100 
101 protected:
103  {
104  this->SetDirectionCollapseToSubmatrix();
105  m_UpperBoundaryCropSize.Fill(0);
106  m_LowerBoundaryCropSize.Fill(0);
107  }
108 
109  ~CropImageFilter() override = default;
110  void
111  PrintSelf(std::ostream & os, Indent indent) const override;
112 
113  void
114  GenerateOutputInformation() override;
115 
116  void
117  VerifyInputInformation() ITKv5_CONST override;
118 
119 private:
120  SizeType m_UpperBoundaryCropSize{};
121  SizeType m_LowerBoundaryCropSize{};
122 };
123 } // end namespace itk
124 
125 #ifndef ITK_MANUAL_INSTANTIATION
126 # include "itkCropImageFilter.hxx"
127 #endif
128 
129 #endif
itkExtractImageFilter.h
itk::CropImageFilter::SetBoundaryCropSize
void SetBoundaryCropSize(const SizeType &s)
Definition: itkCropImageFilter.h:88
itk::InPlaceImageFilter
Base class for filters that take an image as input and overwrite that image as the output.
Definition: itkInPlaceImageFilter.h:77
itk::CropImageFilter::CropImageFilter
CropImageFilter()
Definition: itkCropImageFilter.h:102
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::Concept::SameDimension
Definition: itkConceptChecking.h:694
itk::CropImageFilter
Decrease the image size by cropping the image by an itk::Size at both the upper and lower bounds of t...
Definition: itkCropImageFilter.h:44
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::CropImageFilter::SizeType
InputImageSizeType SizeType
Definition: itkCropImageFilter.h:74
itk::Concept::Convertible
Definition: itkConceptChecking.h:216
itk::ExtractImageFilter
Decrease the image size by cropping the image to the selected region bounds.
Definition: itkExtractImageFilter.h:118
itk::InPlaceImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkInPlaceImageFilter.h:102
itk::InPlaceImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkInPlaceImageFilter.h:101