2 * This program is free software: you can redistribute it and/or modify
3 * it under the terms of the GNU Lesser General Public License as
4 * published by the Free Software Foundation, either version 3 of the
5 * License, or (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * @author David Coeurjolly (\c david.coeurjolly@liris.cnrs.fr )
20 * Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
24 * Implementation of inline methods defined in SummationBasedNormalVectorEstimator.h
26 * This file is part of the DGtal library.
30//////////////////////////////////////////////////////////////////////////////
32//////////////////////////////////////////////////////////////////////////////
34///////////////////////////////////////////////////////////////////////////////
35// IMPLEMENTATION of inline methods.
36///////////////////////////////////////////////////////////////////////////////
38///////////////////////////////////////////////////////////////////////////////
39// ----------------------- Standard services ------------------------------
44template <typename DigitalSurf, typename KernelFunctor>
46DGtal::deprecated::LocalConvolutionNormalVectorEstimator<DigitalSurf,KernelFunctor>
47::LocalConvolutionNormalVectorEstimator (
48 ConstAlias<DigitalSurf> digitalSurface,
49 ConstAlias<KernelFunctor> aKernelFunctor )
50 : mySurface ( digitalSurface ), myKernelFunctor ( aKernelFunctor )
57template <typename DigitalSurf, typename KernelFunctor>
60DGtal::deprecated::LocalConvolutionNormalVectorEstimator<DigitalSurf,KernelFunctor>::init ( const double h,
61 const unsigned int radius )
69 * @return the estimated quantity at *it
72template <typename DigitalSurf, typename KernelFunctor>
73template <typename OutputIterator>
76DGtal::deprecated::LocalConvolutionNormalVectorEstimator<DigitalSurf,KernelFunctor>::
77eval ( const ConstIterator& itb,
78 const ConstIterator& ite,
79 OutputIterator result ) const
81 for ( ConstIterator it = itb; it != ite; ++it )
83 Quantity q = eval( *it );
90//-----------------------------------------------------------------------------
91template <typename DigitalSurf, typename KernelFunctor>
93const typename DGtal::deprecated::LocalConvolutionNormalVectorEstimator<DigitalSurf,KernelFunctor>::Surface &
94DGtal::deprecated::LocalConvolutionNormalVectorEstimator<DigitalSurf,KernelFunctor>::
100//-----------------------------------------------------------------------------
101template <typename DigitalSurf, typename KernelFunctor>
102template <typename OutputIterator>
105DGtal::deprecated::LocalConvolutionNormalVectorEstimator<DigitalSurf,KernelFunctor>::
106evalAll ( OutputIterator result ) const
108 for ( ConstIterator it = surface().begin(), it_end = surface().end();
111 *result++ = eval ( *it );
118 * @return the estimated quantity at *it
121template <typename DigitalSurf, typename KernelFunctor>
123typename DGtal::deprecated::LocalConvolutionNormalVectorEstimator<DigitalSurf,KernelFunctor>::Quantity
124DGtal::deprecated::LocalConvolutionNormalVectorEstimator<DigitalSurf,KernelFunctor>::eval ( const ConstIterator& it ) const
128//-----------------------------------------------------------------------------
129template <typename DigitalSurf, typename KernelFunctor>
131typename DGtal::deprecated::LocalConvolutionNormalVectorEstimator<DigitalSurf,KernelFunctor>::Quantity
132DGtal::deprecated::LocalConvolutionNormalVectorEstimator<DigitalSurf,KernelFunctor>::
133eval ( const SCell & scell ) const
135 typedef BreadthFirstVisitor<DigitalSurf> MyBreadthFirstVisitor;
136 typedef typename MyBreadthFirstVisitor::Node MyNode;
137 MyBreadthFirstVisitor visitor ( mySurface, scell );
140 Quantity n, elementary;
142 typename DigitalSurf::Surfel s;
143 const typename DigitalSurf::KSpace & K = mySurface.container().space();
145 ASSERT ( myFlagIsInit );
147 while ( ! visitor.finished() )
149 node = visitor.current();
150 if ( node.second < myRadius )
153 i = K.sOrthDir ( s );
154 elementary[ i ] = K.sDirect ( s, i ) ? 1 : -1;
156 elementary *= myKernelFunctor ( node.second );
159 elementary [ i ] = 0;
166 return n.getNormalized();
171 * Checks the validity/consistency of the object.
172 * @return 'true' if the object is valid, 'false' otherwise.
174template <typename DigitalSurf, typename KernelFunctor>
177DGtal::deprecated::LocalConvolutionNormalVectorEstimator<DigitalSurf,KernelFunctor>::isValid() const