ITK  5.2.0
Insight Toolkit
itkGradientMagnitudeImageFilter.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 itkGradientMagnitudeImageFilter_h
19 #define itkGradientMagnitudeImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 
23 namespace itk
24 {
41 template <typename TInputImage, typename TOutputImage>
42 class ITK_TEMPLATE_EXPORT GradientMagnitudeImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
43 {
44 public:
45  ITK_DISALLOW_COPY_AND_MOVE(GradientMagnitudeImageFilter);
46 
52 
54  itkNewMacro(Self);
55 
58 
61  using OutputPixelType = typename TOutputImage::PixelType;
62  using InputPixelType = typename TInputImage::PixelType;
64 
67  static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
68 
70  using InputImageType = TInputImage;
71  using OutputImageType = TOutputImage;
72  using InputImagePointer = typename InputImageType::Pointer;
73  using OutputImagePointer = typename OutputImageType::Pointer;
74 
76  using OutputImageRegionType = typename Superclass::OutputImageRegionType;
77 
86  void
87  GenerateInputRequestedRegion() override;
88 
93  itkSetMacro(UseImageSpacing, bool);
94  itkGetConstMacro(UseImageSpacing, bool);
95  itkBooleanMacro(UseImageSpacing);
97 
98 #if !defined(ITK_FUTURE_LEGACY_REMOVE)
99 
102  void
103  SetUseImageSpacingOn()
104  {
105  this->SetUseImageSpacing(true);
106  }
107 
111  void
112  SetUseImageSpacingOff()
113  {
114  this->SetUseImageSpacing(false);
115  }
116 #endif
117 
118 #ifdef ITK_USE_CONCEPT_CHECKING
119  // Begin concept checking
120  itkConceptMacro(InputHasNumericTraitsCheck, (Concept::HasNumericTraits<InputPixelType>));
121  // End concept checking
122 #endif
123 
124 protected:
125  GradientMagnitudeImageFilter();
126 
127  ~GradientMagnitudeImageFilter() override = default;
128 
140  void
141  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
142 
143 
144  void
145  PrintSelf(std::ostream &, Indent) const override;
146 
147 private:
148  bool m_UseImageSpacing{ true };
149 };
150 } // end namespace itk
151 
152 #ifndef ITK_MANUAL_INSTANTIATION
153 # include "itkGradientMagnitudeImageFilter.hxx"
154 #endif
155 
156 #endif
itk::GradientMagnitudeImageFilter
Computes the gradient magnitude of an image region at each pixel.
Definition: itkGradientMagnitudeImageFilter.h:42
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::GradientMagnitudeImageFilter::OutputPixelType
typename TOutputImage::PixelType OutputPixelType
Definition: itkGradientMagnitudeImageFilter.h:61
itk::SmartPointer< Self >
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkImageToImageFilter.h
itk::GradientMagnitudeImageFilter::InputPixelType
typename TInputImage::PixelType InputPixelType
Definition: itkGradientMagnitudeImageFilter.h:62
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:58
itk::GradientMagnitudeImageFilter::RealType
typename NumericTraits< InputPixelType >::RealType RealType
Definition: itkGradientMagnitudeImageFilter.h:63
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::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90