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 //-----------------------------------------------------------------------------
42 template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
43 typename TKernelFunction, typename TVCMGeometricFunctor>
45 DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
46 ~VCMDigitalSurfaceLocalEstimator()
50 //-----------------------------------------------------------------------------
51 template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
52 typename TKernelFunction, typename TVCMGeometricFunctor>
54 DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
55 VCMDigitalSurfaceLocalEstimator()
57 mySurfelEmbedding( InnerSpel ),
64 //-----------------------------------------------------------------------------
65 template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
66 typename TKernelFunction, typename TVCMGeometricFunctor>
68 DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
69 VCMDigitalSurfaceLocalEstimator( const Self& other )
70 : mySurface( other.mySurface ),
71 mySurfelEmbedding( other.mySurfelEmbedding ),
72 myVCMOnSurface( other.myVCMOnSurface ),
73 myGeomFct( other.myGeomFct ),
78 //-----------------------------------------------------------------------------
79 template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
80 typename TKernelFunction, typename TVCMGeometricFunctor>
82 typename DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::Self&
83 DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
84 operator=( const Self& other )
88 mySurface = other.mySurface;
89 mySurfelEmbedding = other.mySurfelEmbedding;
90 myVCMOnSurface = other.myVCMOnSurface;
91 myGeomFct = other.myGeomFct;
97 //-----------------------------------------------------------------------------
98 template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
99 typename TKernelFunction, typename TVCMGeometricFunctor>
101 DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
102 VCMDigitalSurfaceLocalEstimator( ConstAlias< VCMOnSurface > vcmSurface )
103 : mySurface( vcmSurface->surface() ),
104 mySurfelEmbedding( vcmSurface->surfelEmbedding() ),
105 myVCMOnSurface( vcmSurface ),
106 myGeomFct( vcmSurface ),
110 //-----------------------------------------------------------------------------
111 template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
112 typename TKernelFunction, typename TVCMGeometricFunctor>
114 DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
115 VCMDigitalSurfaceLocalEstimator( ConstAlias< Surface > surface )
116 : mySurface( surface ),
117 mySurfelEmbedding( InnerSpel ),
124 //-----------------------------------------------------------------------------
125 template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
126 typename TKernelFunction, typename TVCMGeometricFunctor>
129 DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
130 attach( ConstAlias<Surface> surface )
133 myVCMOnSurface = CountedConstPtrOrConstPtr<VCMOnSurface>( 0,false );
136 //-----------------------------------------------------------------------------
137 template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
138 typename TKernelFunction, typename TVCMGeometricFunctor>
141 DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
142 setParams( 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 //-----------------------------------------------------------------------------
153 template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
154 typename TKernelFunction, typename TVCMGeometricFunctor>
155 template <typename SurfelConstIterator>
158 DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
159 init( 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 //-----------------------------------------------------------------------------
169 template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
170 typename TKernelFunction, typename TVCMGeometricFunctor>
171 template <typename SurfelConstIterator>
173 typename DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::Quantity
174 DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
175 eval( SurfelConstIterator it ) const
177 BOOST_CONCEPT_ASSERT(( boost::InputIterator<SurfelConstIterator> ));
178 ASSERT( mySurface != 0 );
179 ASSERT( myVCMOnSurface != 0 );
180 return myGeomFct( *it );
182 //-----------------------------------------------------------------------------
183 template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
184 typename TKernelFunction, typename TVCMGeometricFunctor>
185 template <typename SurfelConstIterator, typename OutputIterator>
188 DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
189 eval( 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 //-----------------------------------------------------------------------------
204 template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
205 typename TKernelFunction, typename TVCMGeometricFunctor>
207 typename DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::Scalar
208 DGtal::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.
221 template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
222 typename TKernelFunction, typename TVCMGeometricFunctor>
225 DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
226 selfDisplay ( 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.
235 template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
236 typename TKernelFunction, typename TVCMGeometricFunctor>
239 DGtal::VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor>::
247 ///////////////////////////////////////////////////////////////////////////////
248 // Implementation of inline functions //
250 template <typename TDigitalSurfaceContainer, typename TSeparableMetric,
251 typename TKernelFunction, typename TVCMGeometricFunctor>
254 DGtal::operator<<( std::ostream & out,
255 const VCMDigitalSurfaceLocalEstimator<TDigitalSurfaceContainer, TSeparableMetric, TKernelFunction, TVCMGeometricFunctor> & object )
257 object.selfDisplay( out );
262 ///////////////////////////////////////////////////////////////////////////////