ITK  6.0.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
22
23namespace itk
24{
43template <typename TInputImage, typename TOutputImage>
44class ITK_TEMPLATE_EXPORT CropImageFilter : public ExtractImageFilter<TInputImage, TOutputImage>
45{
46public:
47 ITK_DISALLOW_COPY_AND_MOVE(CropImageFilter);
48
54
56 itkNewMacro(Self);
57
59 itkOverrideGetNameOfClassMacro(CropImageFilter);
60
64
68
70 using typename Superclass::OutputImageIndexType;
71 using typename Superclass::InputImageIndexType;
72 using typename Superclass::OutputImageSizeType;
73 using 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);
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
101protected:
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
115
116 void
117 VerifyInputInformation() const override;
118
119private:
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
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)
void GenerateOutputInformation() override
InputImageSizeType SizeType
~CropImageFilter() override=default
void VerifyInputInformation() const override
Verifies that the input images occupy the same physical space and the each index is at the same physi...
void PrintSelf(std::ostream &os, Indent indent) const override
Decrease the image size by cropping the image to the selected region bounds.
typename TInputImage::SizeType InputImageSizeType
typename OutputImageType::PixelType OutputImagePixelType
typename OutputImageType::RegionType OutputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:50
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....