Révision 27 src/lsm_cells.cpp
lsm_cells.cpp (revision 27) | ||
---|---|---|
129 | 129 |
{ |
130 | 130 |
int timestep_max=2000; |
131 | 131 |
int evolution_min=1; |
132 |
int evolution_max=-1; |
|
132 |
//int evolution_max=-1;
|
|
133 | 133 |
int it=0; |
134 | 134 |
int it_stop=0; |
135 | 135 |
bool contour_evolve=true; |
136 | 136 |
int backsegm=0; |
137 |
CImg<float> psi_old=psi; |
|
137 | 138 |
cimg_forXYZ(psi,x,y,z) |
138 | 139 |
{ |
139 | 140 |
if(psi(x,y,z)>=0){backsegm+=1;} |
... | ... | |
141 | 142 |
|
142 | 143 |
while((it<timestep_max)and(contour_evolve==true)and(backsegm>30)) |
143 | 144 |
{ |
145 |
psi_old=psi; |
|
144 | 146 |
//evolution |
145 | 147 |
psi=evolution_AK2_contour_cells(psi,g,gg,h,lam,mu,alf,beta,epsilon,dt,min_list); |
146 | 148 |
//new segmentation |
... | ... | |
149 | 151 |
{ |
150 | 152 |
if(psi(x,y,z)>=0){new_backsegm+=1;} |
151 | 153 |
} |
152 |
|
|
154 |
|
|
153 | 155 |
//Stop criteria |
156 |
// * if the cell would disappear, we stop |
|
157 |
if(new_backsegm==0) |
|
158 |
{psi=psi_old; |
|
159 |
contour_evolve=false;} |
|
160 |
|
|
154 | 161 |
int bg_evolution=abs(new_backsegm-backsegm); |
155 | 162 |
|
156 |
//New stop criteria |
|
157 |
if((it>10) and (bg_evolution<=evolution_min) and (bg_evolution>=evolution_max)) |
|
163 |
// * if the evolution is less then evolution_min 3 consecutive times |
|
164 |
//if((it>10) and (bg_evolution<=evolution_min) and (bg_evolution>=evolution_max)) |
|
165 |
if((it>10) and (bg_evolution<=evolution_min) ) |
|
158 | 166 |
{ |
159 | 167 |
it_stop+=1; |
160 |
if(it_stop>1) |
|
161 |
{contour_evolve=false;} |
|
168 |
if(it_stop>3) |
|
169 |
{contour_evolve=false; |
|
170 |
cout<<"stopit "<<endl;} |
|
162 | 171 |
} |
163 | 172 |
else |
164 | 173 |
{ |
... | ... | |
166 | 175 |
} |
167 | 176 |
|
168 | 177 |
|
169 |
|
|
170 |
|
|
171 | 178 |
it+=1; |
172 |
backsegm=new_backsegm; |
|
179 |
backsegm=new_backsegm; |
|
180 |
//cout<<"backsegm= "<<backsegm<<endl; |
|
173 | 181 |
} |
174 | 182 |
|
175 |
cimg_forXYZ(psi,x,y,z) |
|
176 |
{ |
|
177 |
if(psi(x,y,z)>=0){psi(x,y,z)=4;} |
|
178 |
else{psi(x,y,z)=-4;} |
|
179 |
} |
|
183 |
// cimg_forXYZ(psi,x,y,z)
|
|
184 |
// {
|
|
185 |
// if(psi(x,y,z)>=0){psi(x,y,z)=4;}
|
|
186 |
// else{psi(x,y,z)=-4;}
|
|
187 |
// }
|
|
180 | 188 |
|
181 | 189 |
return psi; |
182 | 190 |
} |
... | ... | |
553 | 561 |
double time1=double(end1-begin); |
554 | 562 |
cout<<"initialization with erosion : "<<time1<<endl; |
555 | 563 |
file<<"\ninitialization with erosion : "<<time1<<endl; |
556 |
cout<<"coucou : "<<endl;
|
|
564 |
cout<<"Evolving cells..... "<<endl;
|
|
557 | 565 |
//---------------------------------------------------------Edge detection |
558 | 566 |
//evolve each cell one by one, attract to maximal gradient |
559 | 567 |
#pragma omp parallel shared(psi_list,min_list,g,gg,h,lam,mu,alf,beta,epsilon,dt,list) |
Formats disponibles : Unified diff