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 
91  void
93  {
94  this->SetUseImageSpacing(true);
95  }
96 
99  void
101  {
102  this->SetUseImageSpacing(false);
103  }
104 
107  itkSetMacro(UseImageSpacing, bool);
108  itkGetConstMacro(UseImageSpacing, bool);
110 
111 #ifdef ITK_USE_CONCEPT_CHECKING
112  // Begin concept checking
113  itkConceptMacro(InputHasNumericTraitsCheck, (Concept::HasNumericTraits<InputPixelType>));
114  // End concept checking
115 #endif
116 
117 protected:
119 
120  ~GradientMagnitudeImageFilter() override = default;
121 
133  void
134  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
135 
136 
137  void
138  PrintSelf(std::ostream &, Indent) const override;
139 
140 private:
141  bool m_UseImageSpacing{ true };
142 };
143 } // end namespace itk
144 
145 #ifndef ITK_MANUAL_INSTANTIATION
146 # include "itkGradientMagnitudeImageFilter.hxx"
147 #endif
148 
149 #endif
itk::GradientMagnitudeImageFilter
Computes the gradient magnitude of an image region at each pixel.
Definition: itkGradientMagnitudeImageFilter.h:42
itk::Concept::HasNumericTraits
Definition: itkConceptChecking.h:712
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::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::GradientMagnitudeImageFilter::SetUseImageSpacingOn
void SetUseImageSpacingOn()
Definition: itkGradientMagnitudeImageFilter.h:92
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::SetUseImageSpacingOff
void SetUseImageSpacingOff()
Definition: itkGradientMagnitudeImageFilter.h:100
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:64
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