Orfeo Toolbox
3.16
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
OTB
Utilities
ITK
Code
BasicFilters
itkGrayscaleErodeImageFilter.txx
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: Insight Segmentation & Registration Toolkit
4
Module: $RCSfile: itkGrayscaleErodeImageFilter.txx,v $
5
Language: C++
6
Date: $Date: 2009-04-28 14:36:20 $
7
Version: $Revision: 1.16 $
8
9
Copyright (c) Insight Software Consortium. All rights reserved.
10
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12
This software is distributed WITHOUT ANY WARRANTY; without even
13
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14
PURPOSE. See the above copyright notices for more information.
15
16
=========================================================================*/
17
#ifndef __itkGrayscaleErodeImageFilter_txx
18
#define __itkGrayscaleErodeImageFilter_txx
19
20
// First make sure that the configuration is available.
21
// This line can be removed once the optimized versions
22
// gets integrated into the main directories.
23
#include "itkConfigure.h"
24
25
#ifdef ITK_USE_CONSOLIDATED_MORPHOLOGY
26
#include "
itkOptGrayscaleErodeImageFilter.txx
"
27
#else
28
29
30
#include "
itkGrayscaleErodeImageFilter.h
"
31
32
namespace
itk {
33
34
template
<
class
TInputImage,
class
TOutputImage,
class
TKernel>
35
GrayscaleErodeImageFilter<TInputImage, TOutputImage, TKernel>
36
::GrayscaleErodeImageFilter
()
37
{
38
m_ErodeBoundaryCondition.SetConstant(
NumericTraits<PixelType>::max
() );
39
this->OverrideBoundaryCondition( &m_ErodeBoundaryCondition );
40
}
41
42
template
<
class
TInputImage,
class
TOutputImage,
class
TKernel>
43
typename
GrayscaleErodeImageFilter<TInputImage, TOutputImage, TKernel>::PixelType
44
GrayscaleErodeImageFilter<TInputImage, TOutputImage, TKernel>
45
::Evaluate
(
const
NeighborhoodIteratorType
&nit,
46
const
KernelIteratorType
kernelBegin,
47
const
KernelIteratorType
kernelEnd)
48
{
49
unsigned
int
i;
50
PixelType
min =
NumericTraits<PixelType>::max
();
51
PixelType
temp;
52
53
KernelIteratorType
kernel_it;
54
55
for
( i=0, kernel_it=kernelBegin; kernel_it<kernelEnd; ++kernel_it, ++i )
56
{
57
// if structuring element is positive, use the pixel under that element
58
// in the image
59
if
( *kernel_it >
NumericTraits<KernelPixelType>::Zero
)
60
{
61
// note we use GetPixel() on the NeighborhoodIterator in order
62
// to respect boundary conditions.
63
temp = nit.
GetPixel
(i);
64
65
if
( temp < min )
66
{
67
min = temp;
68
}
69
}
70
}
71
72
return
min;
73
}
74
75
}
// end namespace itk
76
#endif
77
78
#endif
Generated at Sat May 18 2013 23:41:04 for
Orfeo Toolbox
with
doxygen 1.8.3.1