Constellation: Connectivity-based Structural Parcellation


tildefs.h
Go to the documentation of this file.
1#ifndef CONSTELLATION_TILDEFS_H
2#define CONSTELLATION_TILDEFS_H
3
4#include <kdtree++/kdtree.hpp>
5
6/* This file, named "tildefs" is a remain of the former dependecy on the
7 obsolete aims-til library. It was used mainly for distance maps and KDTree.
8 These algorithms also exist in aims, so we have finally replaced them and do
9 not depend on "til" any longer.
10
11*/
12
13namespace constel
14{
15
16 template <typename PointType>
18 {
19 typedef float result_type;
20 typedef std::pair<uint, PointType> _Val;
21
23 operator()(_Val const& V, size_t const N) const
24 {
25 return V.second[N];
26 }
27 };
28
29 typedef std::vector< std::pair< uint, Point3df > > KDTreeVertices;
30
32 inline
34 {
35 std::vector<std::pair< uint, Point3df > > vert;
36 vert.reserve( mesh.vertex().size() );
37 std::vector<Point3df>::const_iterator iv, ev = mesh.vertex().end();
38 uint index = 0;
39 for( iv=mesh.vertex().begin(); iv!=ev; ++iv, ++index )
40 vert.push_back( std::make_pair( index, Point3df( *iv ) ) );
41 return vert;
42 }
43
44 typedef KDTree::KDTree<3, std::pair<uint, Point3df>,
45 Bracket_accessor_PointIndex<Point3df> >
47
48 inline
49 float dist2( const Point3df & p1, const Point3df & p2 )
50 {
51 return (p2 - p1).norm2();
52 }
53
54}
55#endif
56
KDTree::KDTree< 3, std::pair< uint, Point3df >, Bracket_accessor_PointIndex< Point3df > > KDTree
Definition tildefs.h:46
float dist2(const Point3df &p1, const Point3df &p2)
Definition tildefs.h:49
std::vector< std::pair< uint, Point3df > > KDTreeVertices
Definition tildefs.h:29
KDTreeVertices kdt_vertices(const AimsSurfaceTriangle &mesh)
get vertices vector with index for each vertex
Definition tildefs.h:33
std::pair< uint, PointType > _Val
Definition tildefs.h:20
result_type operator()(_Val const &V, size_t const N) const
Definition tildefs.h:23
AIMSDATA_API AimsTimeSurface< 3, Void > AimsSurfaceTriangle
unsigned int uint