ITK  5.2.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  * 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 {
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  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
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::ExtractImageFilter::OutputImageSizeType
typename TOutputImage::SizeType OutputImageSizeType
Definition: itkExtractImageFilter.h:150
itk::ExtractImageFilter::InputImagePixelType
typename TInputImage::PixelType InputImagePixelType
Definition: itkExtractImageFilter.h:145
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::InPlaceImageFilter::OutputImageRegionType
typename Superclass::OutputImageRegionType OutputImageRegionType
Definition: itkInPlaceImageFilter.h:94
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::Concept::SameDimension
Definition: itkConceptChecking.h:694
itk::ExtractImageFilter::InputImageIndexType
typename TInputImage::IndexType InputImageIndexType
Definition: itkExtractImageFilter.h:149
itk::ExtractImageFilter::InputImageRegionType
typename TInputImage::RegionType InputImageRegionType
Definition: itkExtractImageFilter.h:141
itk::ExtractImageFilter::OutputImagePixelType
typename TOutputImage::PixelType OutputImagePixelType
Definition: itkExtractImageFilter.h:144
itk::ExtractImageFilter::OutputImageRegionType
typename TOutputImage::RegionType OutputImageRegionType
Definition: itkExtractImageFilter.h:140
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::InPlaceImageFilter::OutputImagePixelType
typename Superclass::OutputImagePixelType OutputImagePixelType
Definition: itkInPlaceImageFilter.h:95
itk::ExtractImageFilter::OutputImageIndexType
typename TOutputImage::IndexType OutputImageIndexType
Definition: itkExtractImageFilter.h:148
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk::CropImageFilter::InputImageSizeType
typename Superclass::InputImageSizeType InputImageSizeType
Definition: itkCropImageFilter.h:73
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
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