ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkCannyEdgeDetectionImageFilter.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 itkCannyEdgeDetectionImageFilter_h
19#define itkCannyEdgeDetectionImageFilter_h
20
26#include "itkSparseFieldLayer.h"
27#include "itkObjectStore.h"
28#include "itkMath.h"
29
30namespace itk
31{
32template <typename TValue>
33class ITK_TEMPLATE_EXPORT ListNode
34{
35public:
36 TValue m_Value;
37
40};
41
85template <typename TInputImage, typename TOutputImage>
86class ITK_TEMPLATE_EXPORT CannyEdgeDetectionImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
87{
88public:
89 ITK_DISALLOW_COPY_AND_MOVE(CannyEdgeDetectionImageFilter);
90
94
96 using InputImageType = TInputImage;
97 using OutputImageType = TOutputImage;
98
102
104 using InputImagePixelType = typename TInputImage::PixelType;
105 using OutputImagePixelType = typename TOutputImage::PixelType;
106 using IndexType = typename TInputImage::IndexType;
107 using SizeValueType = typename TInputImage::SizeValueType;
108
112
117
122
124 itkNewMacro(Self);
125
127 using OutputImageRegionType = typename TOutputImage::RegionType;
128 using InputImageRegionType = typename TInputImage::RegionType;
129
131 itkOverrideGetNameOfClassMacro(CannyEdgeDetectionImageFilter);
132
134 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
135 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
136
139
141 itkSetMacro(Variance, ArrayType);
142 itkGetConstMacro(Variance, const ArrayType);
144
147 itkSetMacro(MaximumError, ArrayType);
148 itkGetConstMacro(MaximumError, const ArrayType);
150
152 void
154 {
155 for (unsigned int i = 0; i < TInputImage::ImageDimension; ++i)
156 {
158 {
159 m_Variance.Fill(v);
160 this->Modified();
161 break;
162 }
163 }
164 }
165
166
169 void
171 {
172 for (unsigned int i = 0; i < TInputImage::ImageDimension; ++i)
173 {
175 {
176 m_MaximumError.Fill(v);
177 this->Modified();
178 break;
179 }
180 }
181 }
182
183
186 itkSetMacro(UpperThreshold, OutputImagePixelType);
187 itkGetConstMacro(UpperThreshold, OutputImagePixelType);
188
191 itkSetMacro(LowerThreshold, OutputImagePixelType);
192 itkGetConstMacro(LowerThreshold, OutputImagePixelType);
193
196 {
197 return this->m_MultiplyImageFilter->GetOutput();
198 }
199
205
206protected:
208 void
209 PrintSelf(std::ostream & os, Indent indent) const override;
210
211 void
212 GenerateData() override;
213
216
217private:
218 ~CannyEdgeDetectionImageFilter() override = default;
219
221 void
223
225 void
227
229 void
230 FollowEdge(IndexType index, const OutputImageType * multiplyImageFilterOutput);
231
234 void
236
237
242 ComputeCannyEdge(const NeighborhoodType & it, void * globalData);
243
246 void
248
251
252 OutputImagePixelType m_UpperThreshold{}; // should be float here?
253 OutputImagePixelType m_LowerThreshold{}; // should be float here?
254
255 typename OutputImageType::Pointer m_UpdateBuffer1{};
256
259
263
268
270
273
276
278};
279} // end of namespace itk
280
281#ifndef ITK_MANUAL_INSTANTIATION
282# include "itkCannyEdgeDetectionImageFilter.hxx"
283#endif
284
285#endif
typename TInputImage::PixelType InputImagePixelType
void SetMaximumError(const typename ArrayType::ValueType v)
~CannyEdgeDetectionImageFilter() override=default
ImageToImageFilter< TInputImage, TOutputImage > Superclass
typename TInputImage::SizeValueType SizeValueType
void ThreadedCompute2ndDerivative(const OutputImageRegionType &outputRegionForThread)
ZeroFluxNeumannBoundaryCondition< OutputImageType > DefaultBoundaryConditionType
GaussianImageFilterType::Pointer m_GaussianFilter
MultiplyImageFilter< OutputImageType, OutputImageType, OutputImageType > MultiplyImageFilterType
OutputImagePixelType ComputeCannyEdge(const NeighborhoodType &it, void *globalData)
void SetVariance(const typename ArrayType::ValueType v)
FixedArray< double, Self::ImageDimension > ArrayType
typename TOutputImage::PixelType OutputImagePixelType
void ThreadedCompute2ndDerivativePos(const OutputImageRegionType &outputRegionForThread)
typename TInputImage::RegionType InputImageRegionType
MultiplyImageFilterType::Pointer m_MultiplyImageFilter
DerivativeOperator< OutputImagePixelType, Self::ImageDimension > m_ComputeCannyEdge1stDerivativeOper
DiscreteGaussianImageFilter< InputImageType, OutputImageType > GaussianImageFilterType
typename TOutputImage::RegionType OutputImageRegionType
void FollowEdge(IndexType index, const OutputImageType *multiplyImageFilterOutput)
void PrintSelf(std::ostream &os, Indent indent) const override
DerivativeOperator< OutputImagePixelType, Self::ImageDimension > m_ComputeCannyEdge2ndDerivativeOper
ConstNeighborhoodIterator< OutputImageType, DefaultBoundaryConditionType > NeighborhoodType
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
A NeighborhoodOperator for taking an n-th order derivative at a pixel.
Blurs an image by separable convolution with discrete gaussian kernels. This filter performs Gaussian...
Simulate a standard C array with copy semantics.
Control indentation during Print() invocation.
Definition itkIndent.h:50
Pixel-wise multiplication of two images.
A specialized memory management object for allocating and destroying contiguous blocks of objects.
virtual void Modified() const
Implements transparent reference counting.
A very simple linked list that is used to manage nodes in a layer of a sparse field level-set solver.
A function object that determines a neighborhood of values at an image boundary according to a Neuman...
#define itkConceptMacro(name, concept)
bool NotExactlyEquals(const TInput1 &x1, const TInput2 &x2)
Definition itkMath.h:731
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....