-
Notifications
You must be signed in to change notification settings - Fork 0
/
MedialCurve.h
91 lines (79 loc) · 3.07 KB
/
MedialCurve.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#pragma once
#include <cmath>
#include "cc/voxel/Voxels.h"
#include "RootGraph.h"
// 2012-09-20
//
// Vladimir Popov added these includes, when adjusting this code to Linux
//
#include <ext/hash_map>
#include <ext/hash_set>
// 2012-09-20
//
// Vladimir Popov added this include, when adjusting this code to Linux
//
// (otherwise INT_MAX and INT_MAX are not visible)
#include <limits.h>
// 2012-09-20
//
// Vladimir Popov changed (if matches were found) below, when adjusting this code to Linux
//
// >> substituted by > > in all generic types (templates)
// for instance,map<int,pair<int,int>> changed to map<int,pair<int,int> >
//
// stdext:: substituted by __gnu_cxx::
//
// hash_map substituted by __gnu_cxx::hash_map
//
// hash_set substituted by __gnu_cxx::hash_set
class MedialCurve
{
public:
__gnu_cxx::hash_map <int,float> voxset;
int xsize;
int ysize;
int zsize;
int offset;
string name;
float maxd;
float mind;
float scale;
MedialCurve(void);
MedialCurve(MedialCurve &);
MedialCurve(string filename, int off);
MedialCurve(string filename, int off, bool ying);
~MedialCurve(void);
inline int subind2linind(int i, int j, int k){return k*ysize*xsize+j*xsize+i;};
inline void linind2subind(int ind, int &x, int &y, int &z){z=(int)floor((double)ind/(double)(ysize*xsize)); y=(int)floor((double)(ind-z*ysize*xsize)/(double)xsize); x=ind-z*ysize*xsize-y*xsize; return;}
void createSkeleton(float scale);
void thinning();
void thinning(__gnu_cxx::hash_map<int, float> &distR);
void scaleAxis(float sc);
void setScale();
void repair();
void computeFeatures(vector<pair<string,double> > &features, MedialCurve &skel);
void getBifClusterFeatures(vector<pair<string, double> > &features);
void getEdgesFeatures(vector<pair<string,double> > &features);
void dt(__gnu_cxx::hash_map<int,float> &dtmap);
void computeSkeletonEstimatedFeatures(vector<pair<string,double> > &features, __gnu_cxx::hash_map<int,float> &dtmap);
private:
int getConnectedComponents(__gnu_cxx::hash_set<int> &vset, vector<set<int> > &cc, int conn);
void get_26_neighbours(int ind, vector<int> &nb);
void get_6_neighbours(int ind, vector<int> &nb);
void copyDistances(__gnu_cxx::hash_map<int,float> &distR);
void getTipBranches(vector<vector<int> > &tipbranches);
void getIncidentBranch(int tip, vector<int> &branch);
float getBranchLength(vector<int> &br);
void getBiffurcationList(__gnu_cxx::hash_set<int> &br);
void getTipsList(__gnu_cxx::hash_set<int> &tips);
void fillCavities(set<int> &cc, set<int> &cavity);
double computeSurfaceArea();
double computeSurfaceArea_lateral();
double computeConvexVolume();
void computeSweepingFeatures(double &medR, double &maxR, double &maxW, double &depth, double &miny);
double computeLengthDistribution(MedialCurve &skel, double depth, double miny);
void getBoundaryVector(vector<double> &v);
void getBifClustersList(set<set<int> > &v_cl);
void getEdges(vector<vector<int> > &edges);
void getTotalLength(__gnu_cxx::hash_map<int,float> &dtmap, float &len, float &vol, float &sa);
};