DGtal 2.1.0
Loading...
Searching...
No Matches
Analyzer< KSpace, N > Struct Template Reference

Public Types

typedef KSpace::Point Point
 
typedef NeighborhoodConvexityAnalyzer< KSpace, N > NCA
 

Static Public Member Functions

template<typename ImagePtr >
static std::vector< Pointdebug_one (const KSpace &aK, Point p, ImagePtr bimage)
 
template<typename ImagePtr >
static std::vector< int > run (const KSpace &aK, const std::vector< Point > &pts, ImagePtr bimage)
 
template<typename ImagePtr >
static void run (std::vector< int > &to_update, const KSpace &aK, const std::vector< Point > &pts, ImagePtr bimage)
 

Detailed Description

template<typename KSpace, int N>
struct Analyzer< KSpace, N >
Examples
geometry/volumes/fullConvexityAnalysis3D.cpp.

Definition at line 93 of file fullConvexityAnalysis3D.cpp.

Member Typedef Documentation

◆ NCA

template<typename KSpace , int N>
typedef NeighborhoodConvexityAnalyzer< KSpace, N > Analyzer< KSpace, N >::NCA

◆ Point

template<typename KSpace , int N>
typedef KSpace::Point Analyzer< KSpace, N >::Point

Member Function Documentation

◆ debug_one()

template<typename KSpace , int N>
template<typename ImagePtr >
static std::vector< Point > Analyzer< KSpace, N >::debug_one ( const KSpace aK,
Point  p,
ImagePtr  bimage 
)
inlinestatic
Examples
geometry/volumes/fullConvexityAnalysis3D.cpp.

Definition at line 100 of file fullConvexityAnalysis3D.cpp.

101 {
102 NCA nca( aK.lowerBound(), aK.upperBound(),
103 KSpace::dimension <= 2 ? 0 : 10000*KSpace::dimension*N );
104 auto& image = *bimage;
105 int geom = 0;
106 nca.setCenter( p, image );
107 bool cvx = nca.isFullyConvex( true );
108 bool ccvx = nca.isComplementaryFullyConvex( false );
109 auto cfg = nca.makeConfiguration( nca.configuration(), true, false );
110 std::vector< Point > localCompX;
111 nca.getLocalCompX( localCompX, false );
112 std::cout << "InC=" << nca.configuration() << std::endl;
113 std::cout << "Cfg=" << cfg << std::endl;
114 for ( auto q : localCompX ) std::cout << q;
115 std::cout << std::endl;
116 geom = ( cvx ? 0x1 : 0x0 ) | ( ccvx ? 0x2 : 0x0 );
117 std::cout << "cvx=" << cvx << " ccvx=" << ccvx << std::endl;
118 std::cout << "geom=" << geom << std::endl;
119 return localCompX;
120 }
Aim: This class is a model of CCellularGridSpaceND. It represents the cubical grid as a cell complex,...
const Point & lowerBound() const
Return the lower bound for digital points in this space.
const Point & upperBound() const
Return the upper bound for digital points in this space.
static const constexpr Dimension dimension
NeighborhoodConvexityAnalyzer< KSpace, 1 > NCA
STL namespace.
Image image(domain)

References DGtal::KhalimskySpaceND< dim, TInteger >::dimension, image(), DGtal::KhalimskySpaceND< dim, TInteger >::lowerBound(), and DGtal::KhalimskySpaceND< dim, TInteger >::upperBound().

◆ run() [1/2]

template<typename KSpace , int N>
template<typename ImagePtr >
static std::vector< int > Analyzer< KSpace, N >::run ( const KSpace aK,
const std::vector< Point > &  pts,
ImagePtr  bimage 
)
inlinestatic
Examples
geometry/volumes/fullConvexityAnalysis3D.cpp.

Definition at line 125 of file fullConvexityAnalysis3D.cpp.

126 {
127 NCA nca( aK.lowerBound(), aK.upperBound(), 0 );
128 // KSpace::dimension <= 2 ? 0 : 10000*KSpace::dimension*N );
129 auto& image = *bimage;
130 std::vector<int> result;
131 std::map< Point, int > computed;
132 int geom;
133 int i = 0;
134 int nb = pts.size();
135 int nb_cvx = 0;
136 int nb_ccvx = 0;
137 for ( auto p : pts )
138 {
139 if ( i % 100 == 0 ) trace.progressBar( i, nb );
140 auto it = computed.find( p );
141 if ( it == computed.end() )
142 {
143 nca.setCenter( p, image );
144 bool cvx = nca.isFullyConvex( true );
145 bool ccvx = nca.isComplementaryFullyConvex( false );
146 if ( cvx ) nb_cvx += 1;
147 if ( ccvx ) nb_ccvx += 1;
148 geom = ( cvx ? 0x1 : 0x0 ) | ( ccvx ? 0x2 : 0x0 );
149 computed[ p ] = geom;
150 }
151 else geom = it->second;
152 result.push_back( geom );
153 i++;
154 }
155 trace.info() << "nb_cvx=" << nb_cvx << " nb_ccvx=" << nb_ccvx << std::endl;
156 return result;
157 }
std::ostream & info()
void progressBar(const double currentValue, const double maximalValue)
Trace trace

References image(), DGtal::Trace::info(), DGtal::KhalimskySpaceND< dim, TInteger >::lowerBound(), DGtal::Trace::progressBar(), DGtal::trace, and DGtal::KhalimskySpaceND< dim, TInteger >::upperBound().

Referenced by main(), and MultiScaleAnalyzer< KSpace, N >::multiscale_run().

◆ run() [2/2]

template<typename KSpace , int N>
template<typename ImagePtr >
static void Analyzer< KSpace, N >::run ( std::vector< int > &  to_update,
const KSpace aK,
const std::vector< Point > &  pts,
ImagePtr  bimage 
)
inlinestatic

Definition at line 162 of file fullConvexityAnalysis3D.cpp.

164 {
165 NCA nca( aK.lowerBound(), aK.upperBound() );
166 // KSpace::dimension <= 2 ? 0 : 10000*KSpace::dimension*N );
167 auto& image = *bimage;
168 std::map< Point, int > computed;
169 int geom;
170 int i = 0;
171 int nb = pts.size();
172 for ( auto p : pts )
173 {
174 if ( i % 100 == 0 ) trace.progressBar( i, nb );
175 auto it = computed.find( p );
176 if ( it == computed.end() )
177 {
178 nca.setCenter( p, image );
179 bool cvx = ( to_update[ i ] & 0x1 )
180 ? nca.isFullyConvex( true )
181 : false;
182 bool ccvx = ( to_update[ i ] & 0x2 )
183 ? nca.isComplementaryFullyConvex( false )
184 : false;
185 geom = ( cvx ? 0x1 : 0x0 ) | ( ccvx ? 0x2 : 0x0 );
186 computed[ p ] = geom;
187 }
188 else geom = it->second;
189 to_update[ i++ ] = geom;
190 }
191 }

References image(), DGtal::KhalimskySpaceND< dim, TInteger >::lowerBound(), DGtal::Trace::progressBar(), DGtal::trace, and DGtal::KhalimskySpaceND< dim, TInteger >::upperBound().


The documentation for this struct was generated from the following file: