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/>.
18 * @file VCMDigitalSurfaceLocalEstimator.ih
19 * @author Jacques-Olivier Lachaud (\c jacques-olivier.lachaud@univ-savoie.fr )
20 * Laboratory of Mathematics (CNRS, UMR 5127), University of Savoie, France
24 * Implementation of inline methods defined in VCMDigitalSurfaceLocalEstimator.h
26 * This file is part of the DGtal library.
30//////////////////////////////////////////////////////////////////////////////
32//////////////////////////////////////////////////////////////////////////////
34///////////////////////////////////////////////////////////////////////////////
35// IMPLEMENTATION of inline methods.
36///////////////////////////////////////////////////////////////////////////////
38///////////////////////////////////////////////////////////////////////////////
39// ----------------------- Standard services ------------------------------
41//-----------------------------------------------------------------------------
42template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
43 typename TKernelFunction, typename TVCMGeometricFunctor>
45DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
46~VCMDigitalSurfaceLocalEstimator()
50//-----------------------------------------------------------------------------
51template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
52 typename TKernelFunction, typename TVCMGeometricFunctor>
54DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
55VCMDigitalSurfaceLocalEstimator()
57 mySurfelEmbedding( InnerSpel ),
64//-----------------------------------------------------------------------------
65template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
66 typename TKernelFunction, typename TVCMGeometricFunctor>
68DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
69VCMDigitalSurfaceLocalEstimator( const Self& other )
70 : mySurface( other.mySurface ),
71 mySurfelEmbedding( other.mySurfelEmbedding ),
72 myVCMOnSurface( other.myVCMOnSurface ),
73 myGeomFct( other.myGeomFct ),
78//-----------------------------------------------------------------------------
79template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
80 typename TKernelFunction, typename TVCMGeometricFunctor>
82typename DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::Self&
83DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
84operator=( const Self& other )
88 mySurface = other.mySurface;
89 mySurfelEmbedding = other.mySurfelEmbedding;
90 myVCMOnSurface = other.myVCMOnSurface;
91 myGeomFct = other.myGeomFct;
97//-----------------------------------------------------------------------------
98template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
99 typename TKernelFunction, typename TVCMGeometricFunctor>
101DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
102VCMDigitalSurfaceLocalEstimator( ConstAlias< VCMOnSurface > vcmSurface )
103 : mySurface( vcmSurface->surface() ),
104 mySurfelEmbedding( vcmSurface->surfelEmbedding() ),
105 myVCMOnSurface( vcmSurface ),
106 myGeomFct( vcmSurface ),
110//-----------------------------------------------------------------------------
111template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
112 typename TKernelFunction, typename TVCMGeometricFunctor>
114DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
115VCMDigitalSurfaceLocalEstimator( ConstAlias< Surface > surface )
116 : mySurface( surface ),
117 mySurfelEmbedding( InnerSpel ),
124//-----------------------------------------------------------------------------
125template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
126 typename TKernelFunction, typename TVCMGeometricFunctor>
129DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
130attach( ConstAlias<Surface> surface )
133 myVCMOnSurface = CountedConstPtrOrConstPtr<VCMOnSurface>( 0,false );
136//-----------------------------------------------------------------------------
137template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
138 typename TKernelFunction, typename TVCMGeometricFunctor>
141DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
142setParams( Surfel2PointEmbedding surfelEmbedding,
143 const Scalar R, const Scalar r, KernelFunction chi_r,
144 const Scalar t, Metric aMetric, bool verbose )
146 mySurfelEmbedding = surfelEmbedding;
147 myVCMOnSurface = CountedConstPtrOrConstPtr<VCMOnSurface>
148 ( new VCMOnSurface( mySurface, mySurfelEmbedding,
149 R, r, chi_r, t, aMetric, verbose ), true );
150 myGeomFct.attach( myVCMOnSurface );
152//-----------------------------------------------------------------------------
153template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
154 typename TKernelFunction, typename TVCMGeometricFunctor>
155template <typename SurfelConstIterator>
158DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
159init( const Scalar _h,
160 SurfelConstIterator /* itb */,
161 SurfelConstIterator /* ite */ )
163 ASSERT( mySurface != 0 );
164 ASSERT( myVCMOnSurface != 0 );
165 // Unused. The VCM is necessarily initialized on the whole surface.
168//-----------------------------------------------------------------------------
169template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
170 typename TKernelFunction, typename TVCMGeometricFunctor>
171template <typename SurfelConstIterator>
173typename DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::Quantity
174DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
175eval( SurfelConstIterator it ) const
177 BOOST_CONCEPT_ASSERT(( boost::InputIterator<SurfelConstIterator> ));
178 ASSERT( mySurface != 0 );
179 ASSERT( myVCMOnSurface != 0 );
180 return myGeomFct( *it );
182//-----------------------------------------------------------------------------
183template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
184 typename TKernelFunction, typename TVCMGeometricFunctor>
185template <typename SurfelConstIterator, typename OutputIterator>
188DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
189eval( SurfelConstIterator itb,
190 SurfelConstIterator ite,
191 OutputIterator result ) const
193 BOOST_CONCEPT_ASSERT(( boost::InputIterator<SurfelConstIterator> ));
194 BOOST_CONCEPT_ASSERT(( boost::OutputIterator<OutputIterator,Quantity> ));
195 ASSERT( myVCMOnSurface != 0 );
196 for ( ; itb != ite; ++itb )
198 *result++ = myGeomFct( *itb );
203//-----------------------------------------------------------------------------
204template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
205 typename TKernelFunction, typename TVCMGeometricFunctor>
207typename DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::Scalar
208DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
214///////////////////////////////////////////////////////////////////////////////
215// Interface - public :
218 * Writes/Displays the object on an output stream.
219 * @param out the output stream where the object is written.
221template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
222 typename TKernelFunction, typename TVCMGeometricFunctor>
225DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
226selfDisplay ( std::ostream & out ) const
228 out << "[VCMDigitalSurfaceLocalEstimator]";
232 * Checks the validity/consistency of the object.
233 * @return 'true' if the object is valid, 'false' otherwise.
235template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
236 typename TKernelFunction, typename TVCMGeometricFunctor>
239DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
247///////////////////////////////////////////////////////////////////////////////
248// Implementation of inline functions //
250template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
251 typename TKernelFunction, typename TVCMGeometricFunctor>
254DGtal::operator<<( std::ostream & out,
255 const VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor> & object )
257 object.selfDisplay( out );
262///////////////////////////////////////////////////////////////////////////////