Révision 8
src/edge_indicator.cpp (revision 8) | ||
---|---|---|
1 | 1 |
/* |
2 |
Anisotropic blur : removes noise while keeping cell walls |
|
3 |
Parallel version |
|
4 |
3D only |
|
5 | 2 |
|
6 | 3 |
To compile : |
7 | 4 |
g++ -o edge_indicator edge_indicator.cpp -O2 -L/usr/X11R6/lib -lm -lpthread -lX11 -fopenmp -l:libtiff.so.4 |
8 | 5 |
Needs CImg.h |
9 | 6 |
|
10 | 7 |
To execute : |
11 |
./edge_indicator img K sigma [filtertype]
|
|
8 |
./edge_indicator img K sigma input_type [transfer_type]
|
|
12 | 9 |
|
13 | 10 |
img : image in .inr or .inr.gz |
14 | 11 |
K : proportional to width of cell walls (0.1 - 0.3) |
15 | 12 |
sigma : amount of gaussian blur (float) |
16 |
filtertype (optional) : by default 1/(1+x/K) type edge function. If "exp" is marked, then exp(-x/K) edge function is used
|
|
13 |
transfer_type (optional) : by default 1/(1+x/K) type edge function. If "exp" is marked, then exp(-x/K) edge function is used
|
|
17 | 14 |
|
18 | 15 |
* authors : Annamaria Kiss (RDP) |
19 | 16 |
* ENS-Lyon |
... | ... | |
38 | 35 |
//----------------------------------------------------------------------------- |
39 | 36 |
int main (int argc, char* argv[]) |
40 | 37 |
{ |
41 |
// double begin_main=omp_get_wtime(); |
|
42 |
|
|
38 |
|
|
43 | 39 |
if(argc<4 || argc>5) |
44 | 40 |
{ |
45 | 41 |
cout<<"!! wrong number of arguments"<<endl; |
46 |
cout<<"how to execute : edge_indicator img K sigma gamma upDiter nbIter [type]"<<endl;
|
|
42 |
cout<<"how to execute : ./edge_indicator img K sigma [transfer_type]"<<endl;
|
|
47 | 43 |
cout<<" img : image in .inr or .inr.gz"<<endl; |
48 | 44 |
cout<<" K : proportional to width of cell walls (0.1 - 0.3)"<<endl; |
49 | 45 |
cout<<" sigma : amount of gaussian blur (float)"<<endl; |
50 |
cout<<" filtertype (optional) : by default 'hill' that is 1/(1+x/K) type edge function. If 'exp' is marked, then exp(-x/K) edge function is used"<<endl;
|
|
46 |
cout<<" transfer_type (optional) : by default 'hill' that is 1/(1+x/K) type edge function. If 'exp' is marked, then exp(-x/K) edge function is used"<<endl;
|
|
51 | 47 |
return 0; |
52 | 48 |
} |
53 | 49 |
|
54 |
|
|
55 | 50 |
string filter_type="hill"; |
51 |
|
|
52 |
|
|
56 | 53 |
if (argc==5) |
57 | 54 |
{ |
58 | 55 |
if (string(argv[4]).compare("exp")==0) |
59 | 56 |
{filter_type="exp";} |
60 | 57 |
} |
61 |
|
|
58 |
|
|
62 | 59 |
|
63 | 60 |
//Open image with name in argument |
64 | 61 |
//image is converted to unsigned char (0 to 255) and then to float |
... | ... | |
114 | 111 |
cout<<"Voxel size : ("<<tailleVoxel[0]<<","<<tailleVoxel[1]<<","<<tailleVoxel[2]<<")"<<endl; |
115 | 112 |
|
116 | 113 |
//--------------------------------------------------------Name and directories |
117 |
string insert=string("_edgeind-K")+argv[2]+"s"+argv[3]+"-type-"+filter_type;
|
|
114 |
string insert=string("_edgeind-K")+argv[2]+"s"+argv[3]+"-"+filter_type; |
|
118 | 115 |
name.insert(name.size()-4,insert); |
119 | 116 |
size_t test=name.rfind("/"); |
120 | 117 |
if(test!=name.npos) |
121 | 118 |
{name.erase(0,test+1);} |
122 | 119 |
|
123 | 120 |
//---------------------------------------------------------------------Processing |
124 |
//Evolution during nbIter |
|
125 |
//-------------------------------------------------------------------------3D |
|
126 | 121 |
cout<<"3D image"<<endl; |
127 | 122 |
cout <<"Computing Hessian"<<endl; |
128 | 123 |
|
... | ... | |
136 | 131 |
|
137 | 132 |
if (filter_type.compare("hill")==0) |
138 | 133 |
{ |
139 |
edgeind=edge_indicator3(img,K);
|
|
134 |
edgeind=edge_indicator3(fx,K);
|
|
140 | 135 |
} |
141 | 136 |
else |
142 | 137 |
{ |
143 |
edgeind=edge_indicator3exp(img,K);
|
|
138 |
edgeind=edge_indicator3exp(fx,K);
|
|
144 | 139 |
} |
145 | 140 |
|
146 | 141 |
|
Formats disponibles : Unified diff