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 DigitalSurfaceEmbedderWithNormalVectorEstimator.ih
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 DigitalSurfaceEmbedderWithNormalVectorEstimator.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 TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
44 DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
45 ~DigitalSurfaceEmbedderWithNormalVectorEstimator()
48 //-----------------------------------------------------------------------------
49 template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
51 DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
52 DigitalSurfaceEmbedderWithNormalVectorEstimator()
53 : myDSEmbedder( 0 ), myEstimator( 0 )
56 //-----------------------------------------------------------------------------
57 template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
59 DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
60 DigitalSurfaceEmbedderWithNormalVectorEstimator
61 ( ConstAlias<DigitalSurfaceEmbedder> aDSEmbedder,
62 ConstAlias<NormalVectorEstimator> anEstimator )
63 : myDSEmbedder( &aDSEmbedder ),
64 myEstimator( &anEstimator )
67 //-----------------------------------------------------------------------------
68 template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
70 DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
71 DigitalSurfaceEmbedderWithNormalVectorEstimator
72 ( const Self & other )
73 : myDSEmbedder( other.myDSEmbedder ),
74 myEstimator( other.myEstimator )
77 //-----------------------------------------------------------------------------
78 template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
80 typename DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::Self &
81 DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
83 ( const Self & other )
85 myDSEmbedder = other.myDSEmbedder;
86 myEstimator = other.myEstimator;
90 //-----------------------------------------------------------------------------
91 template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
93 const typename DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::Surface &
94 DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
97 ASSERT( this->isValid() );
98 return myDSEmbedder->surface();
101 //-----------------------------------------------------------------------------
102 template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
104 typename DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::RealPoint
105 DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
106 operator()( const SCell & scell ) const
108 ASSERT( this->isValid() );
109 return myDSEmbedder->operator()( scell );
112 //-----------------------------------------------------------------------------
113 template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
115 typename DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::RealVector
116 DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
117 gradient( const SCell & scell ) const
119 ASSERT( this->isValid() );
120 return myEstimator->eval( scell );
123 //-----------------------------------------------------------------------------
124 template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
126 typename DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::GradientMap
127 DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
130 ASSERT( this->isValid() );
131 return GradientMap( *this );
134 ///////////////////////////////////////////////////////////////////////////////
135 // Interface - public :
138 * Writes/Displays the object on an output stream.
139 * @param out the output stream where the object is written.
141 template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
144 DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
145 selfDisplay ( std::ostream & out ) const
147 out << "[DigitalSurfaceEmbedderWithNormalVectorEstimator]";
151 * Checks the validity/consistency of the object.
152 * @return 'true' if the object is valid, 'false' otherwise.
154 template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
157 DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
160 return ( myEstimator != 0 ) && ( myDSEmbedder != 0 )
161 && ( myEstimator->isValid() ) && ( myDSEmbedder->isValid() );
164 ///////////////////////////////////////////////////////////////////////////////
165 // class DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap
167 //-----------------------------------------------------------------------------
168 template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
170 DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
171 ~DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap()
174 //-----------------------------------------------------------------------------
175 template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
177 DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
178 DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap()
182 //-----------------------------------------------------------------------------
183 template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
185 DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
186 DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap
187 ( ConstAlias<Embedder> embedder )
188 : myEmbedder( &embedder )
191 //-----------------------------------------------------------------------------
192 template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
194 DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
195 DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap
196 ( const Self & other )
197 : myEmbedder( other.myEmbedder )
200 //-----------------------------------------------------------------------------
201 template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
203 typename DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::Self &
204 DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
206 ( const Self & other )
208 myEmbedder = other.myEmbedder;
212 //-----------------------------------------------------------------------------
213 template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
215 typename DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::Value
216 DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
217 operator()( const Argument & arg ) const
219 ASSERT( myEmbedder != 0 );
220 return myEmbedder->gradient( arg );
224 ///////////////////////////////////////////////////////////////////////////////
225 // Implementation of inline functions //
227 template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
230 DGtal::operator<< ( std::ostream & out,
231 const DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator> & object )
233 object.selfDisplay( out );
238 ///////////////////////////////////////////////////////////////////////////////