cortical_surface  5.0.5
sulcalLinesGeodesic.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2000-2004 CEA
3  *
4  * This software and supporting documentation were developed by
5  * CEA/DSV/SHFJ
6  * 4 place du General Leclerc
7  * 91401 Orsay cedex
8  * France
9  */
10 
11 
12 
13 #ifndef AIMS_SULCUS_CORTICAL_GEO_H
14 #define AIMS_SULCUS_CORTICAL_GEO_H
15 
16 #include <aims/mesh/surface.h>
17 #include <aims/mesh/texture.h>
18 #include <aims/mesh/surfacegen.h>
24 #include <aims/io/reader.h>
25 #include <aims/io/writer.h>
27 #include <iostream>
28 #include <fstream>
29 #include <queue>
30 #include <map>
31 
32 using namespace aims;
33 using namespace aims::meshdistance;
34 using namespace std;
35 
36 typedef std::vector<double> double_vec_t;
37 
38 class Comp
39 {
40 
41  double_vec_t& _v;
42  public:
43  Comp(double_vec_t& v) : _v(v) {}
44  bool operator()(double i, double j){
45  return _v[i] < _v[j];
46  }
47 };
48 
50 {
51  public:
52 
53  //Parametres pour l'execution
54  string _adrMesh;
55  string _adrRootsLat;
56  string _adrRootsLon;
57  string _adrCurv;
64  string _side;
65 
66  int _strain;
69  vector<float> _proba;
70  bool _save;
71  float _curv_thresh;
72  float _clean_size;
75 
77  std::vector<std::set<uint> > _neigh;
78 
85 
86  //Constructor
87  SulcalLinesGeodesic(string & adrMesh, string & adrCurv,
88  string & adrGeodesicDepth, string & adrRootsLon, string & adrRootsLat,string & adrRootsBottom, string & adrLabelBasins, string & adrLabelSulcalines, string & adrSulcalines,
89  int extremeties_method, int constraint_type, int strain,
90  vector<float> proba, string saveFolder, float curv_thresh, string side, float clean_size, int constraintValue,int max_extremities);
91 
93 
94  //public methods
95  void run();
96  void probaMap();
97 
98  void writeShortTexture (string name,TimeTexture<short> &out);
99  void writeFloatTexture (string name,TimeTexture<float> &out);
100  void floodFillIter(int indexVertex, float newTextureValue,float oldTextureValue,TimeTexture<short> &texBasinsTemp, map<int,set<int> > &mapBasins);
101  TimeTexture<short> texConnectedComponent(TimeTexture<short> &texBasins, map<int,set<int> > &mapBasins, int offset);
102 
103  void texBinarizeF2S(TimeTexture<float> &texIn, TimeTexture<short> &texOut, float threshold,int inf,int sup);
104  void texBinarizeS2S(TimeTexture<short> &texIn, TimeTexture<short> &texOut, int threshold,int inf,int sup);
105  void computeListLabelProjectionsBasins (TimeTexture<short> &roots, map<int,set<int> > &mapBasins,set<int> &listIndex, map<int,set<int> > &mapConstraint);
106 
107  private :
108  void segmentationSulcalBasins (TimeTexture<float> &texIn,TimeTexture<short> &texBasins,map<int,set<int> > &mapBasins,float threshold, int close, int open);
109 
110  void computeRootsBottomMap(TimeTexture<short> &texBasins,TimeTexture<short> &texRootsBottom, float dist_max);
111 
112  void computeConstraintList(map<int,int> & listValues);
113 
114  void listRootsProjections(TimeTexture<short> &texBasins,set<int> &listIndexLat,set<int> &listIndexLon);
115  void computeLongestPathBasins (TimeTexture<short> &roots, TimeTexture<short> &out, map<int,set<int> > &mapConstraint);
116 
117  void normalizeDepthMap (TimeTexture<float> &depth, TimeTexture<float> &depthNorm, map<int,set<int> > &mapBasins);
118 
119  void sulcalLinesExtract_projection(map<int,set<int> > &mapBasins, TimeTexture<short> &texBasins);
120 
121  void dilationRoots(TimeTexture<short> &texLatDil,TimeTexture<short> &texLonDil,int size);
122  void interRootsDilBasins(TimeTexture<short> &texBasins,TimeTexture<short> &texDil,TimeTexture<short> &texInter);
123  void cleanBasins(map<int,set<int> > &mapBasins,TimeTexture<short> &texBasins,map<int, vector<int> > &mapPolygonSetBasins,float min_area_size);
124  void contourBasins(map<int,set<int> > &mapBasins,TimeTexture<short> &texBasins,map<int,set<int> > &mapContourBasins,TimeTexture<short> &texContourBasins);
125  void computeProbabiltyMap(map<int,set<int> > &mapContourBasins,TimeTexture<short> &texContourBasins,TimeTexture<short> &texBasins, TimeTexture<float> &texProba);
126  void computeMaximalProbabiltyMap(map<int, set<int> > &mapContourBasins, TimeTexture<short> &texContourBasins, TimeTexture<short> &texBasins, TimeTexture<float> &texProba);
127  void normalizeProbabiltyMap(map<int,set<int> > &mapBasins, map<int,set<int> > &mapContourBasins,TimeTexture<short> &texContourBasins,TimeTexture<float> &texProba,TimeTexture<float> &texProbaNorm);
128  void normalizeMaximalProbabiltyMap(map<int,set<int> > &mapBasins, map<int,set<int> > &mapContourBasins,TimeTexture<short> &texContourBasins,TimeTexture<float> &texProba,TimeTexture<float> &texProbaNorm);
129  void textureBin2Label(TimeTexture<short> &texLabel, TimeTexture<short> &texIn, TimeTexture<short> &texOut);
130 
131  //embc11
132  void sulcalLinesExtract_probability(map<int,set<int> > &mapBasins, TimeTexture<short> &texBasins);
133  //neuroimage11
134  void sulcalLinesExtract_density(map<int, set<int> > &mapBasins, TimeTexture<short> &texBasins);
135  //miccai12
136  void sulcalLinesExtract_maximal_density(map<int, set<int> > &mapBasins, TimeTexture<short> &texBasins);
137 
138  void automaticThresholdDensityMap(map<int, set<int> > &mapBasins, TimeTexture<short> &texBasins, TimeTexture<float> &texProbaNorm,TimeTexture<short> &texAutoThreshold,int nb_bin);
139  void automaticThresholdMaximalDensityMap(map<int, set<int> > &mapBasins, TimeTexture<short> &texBasins, TimeTexture<float> &texProbaNorm,TimeTexture<short> &texAutoThreshold_begin,TimeTexture<short> &texAutoThreshold_middle,TimeTexture<short> &texAutoThreshold_end,int nb_bin);
140 
141  void vertexmap2polygonMap(map<int, set<int> > &mapVertexSetBasins, map<int, vector<int> > &mapPolygonSetBasins);
142 
143 };
144 
145 
146 #endif
TimeTexture< short > _rootsLat
vector< float > _proba
bool operator()(double i, double j)
TimeTexture< float > _geoDepth
AIMSDATA_API AimsTimeSurface< 3, Void > AimsSurfaceTriangle
TimeTexture< float > _texCurv
AimsSurfaceTriangle _mesh
STL namespace.
std::vector< double > double_vec_t
TimeTexture< float > _geoCurvDepthNorm
std::vector< std::set< uint > > _neigh
TimeTexture< short > _rootsLon
Comp(double_vec_t &v)
TimeTexture< float > _geoDepthNorm