Index: lsm_contour.cpp
===================================================================
--- lsm_contour.cpp	(revision 27)
+++ lsm_contour.cpp	(revision 28)
@@ -116,17 +116,15 @@
   outputdir.erase(filename.size()-4);
   string mkdir="mkdir -p "+outputdir;
   systout=system(mkdir.c_str()); 
-  mkdir="mkdir -p "+outputdir+"/evolution";
-  systout=system(mkdir.c_str());
 
-  string filename_cut=outputdir+"/evolution/"+filename;
-  filename_cut.erase(filename_cut.size()-4);
+  string filename_txt=outputdir+"/"+filename;
+  filename_txt.erase(filename_txt.size()-4);
   filename=outputdir+"/"+filename;
   string result_name=filename;
 
   //txt files 
   ofstream file;
-  string txt_name=filename_cut+".txt";
+  string txt_name=filename_txt+".txt";
   file.open(txt_name.c_str());
   file<<argv[0]<<endl;
   time_t t;
@@ -150,7 +148,7 @@
   file<<"perDown : "<<perDown<<endl;
 
   ofstream bg_file;
-  string bg_name=filename_cut+"_BGgrowth.txt";
+  string bg_name=filename_txt+"_BGgrowth.txt";
   bg_file.open(bg_name.c_str());
   bg_file<<"it\tbg_growth"<<endl;
 
@@ -158,13 +156,6 @@
   //add slices
   img=add_side_slices(img,3);
 
-  //define and save cut
-  int cut=img._depth/2;
-  cout <<"cut z= "<<cut<<endl;
-  file <<"\ncut z= "<<cut<<endl;
-  CImg<float> imgCut=img.get_crop(0,0,cut,0,img._width,img._height,cut,0);
-  imgCut.save((filename_cut+".png").c_str());
-
   //smooth image
   file<<"smooth : "<<smooth<<endl;
   img.blur(smooth);
@@ -231,25 +222,9 @@
 	  it_stop=0;
 	}
 
-      //Graphics to follow evolution
-      if((it%50==0)or(contour_evolves==false)or(it==timestep_max-1))
-	{
-	  ostringstream oss;
-	  oss << it;
-	  string iterstring="";
-	  if(it<10) {iterstring="00"+oss.str();}
-	  else if (it<100) {iterstring="0"+oss.str();}
-	  else {iterstring=oss.str();}
-	  cout<<"-----------------------------------"<<endl;
-	  cout<<" *** time step for graphics : "<<iterstring<<endl;
-	  //Save cut
-	  CImg<float>segCut=segmented.get_crop(0,0,cut,0,img._width,img._height,cut,0);
-	  string temp_name=filename_cut+"it"+iterstring+".png";
-	  segCut.normalize(0,255).save(temp_name.c_str());
-	}
+    //Save result
       if((((it%50)==0)and(it!=0))or(contour_evolves==false)or(it==timestep_max-1))
-	{
-	  //Save result
+	{	  
 	  CImg<unsigned char>segSave=remove_side_slices(segmented,3);
 	  segSave.save_inr(result_name.c_str(),tailleVoxel);
 	  segSave.assign();
Index: lsm_cells.cpp
===================================================================
--- lsm_cells.cpp	(revision 27)
+++ lsm_cells.cpp	(revision 28)
@@ -161,13 +161,11 @@
       int bg_evolution=abs(new_backsegm-backsegm);
 	
       // * if the evolution is less then evolution_min 3 consecutive times
-      //if((it>10) and (bg_evolution<=evolution_min) and (bg_evolution>=evolution_max))
       if((it>10) and (bg_evolution<=evolution_min) )
 	{
 	  it_stop+=1;
 	  if(it_stop>3)
-	    {contour_evolve=false;
-		cout<<"stopit "<<endl;}
+	    {contour_evolve=false;}
 	}
       else
 	{
@@ -177,15 +175,7 @@
 
       it+=1;
       backsegm=new_backsegm;
-      //cout<<"backsegm= "<<backsegm<<endl;     
     }
-
-//  cimg_forXYZ(psi,x,y,z)
-//    {
-//      if(psi(x,y,z)>=0){psi(x,y,z)=4;}
-//      else{psi(x,y,z)=-4;}
-//    }
-
   return psi;
 }
 
@@ -283,7 +273,6 @@
   //Original image
   CImg<char> description;
   float tailleVoxel[3] = {0}; // resolution initialisation
-  //float tailleVoxel[3] = {0.195177,0.195177,0.195177};
   
   bool gzipped=false;
   
@@ -430,12 +419,10 @@
   string outputdir=filename;
   outputdir.erase(filename.size()-4);
   string mkdir="mkdir -p "+outputdir;
-  int syst=system(mkdir.c_str()); 
-  mkdir="mkdir -p "+outputdir+"/evolution";
-  syst=system(mkdir.c_str());
+  if(system(mkdir.c_str())); 
 
-  string filename_cut=outputdir+"/evolution/"+filename;
-  filename_cut.erase(filename_cut.size()-4);
+  string filename_txt=outputdir+"/"+filename;
+  filename_txt.erase(filename_txt.size()-4);
   filename=outputdir+"/"+filename;
   string wat_eroded_name=filename;
   wat_eroded_name.insert(filename.size()-4,"_eroded");
@@ -446,7 +433,7 @@
 
   //txt files 
   ofstream file;
-  string txt_name=filename_cut+".txt";
+  string txt_name=filename_txt+".txt";
   file.open(txt_name.c_str());
   file<<argv[0]<<endl;
   time_t t;
@@ -474,13 +461,6 @@
   file<<"timestep_max : "<<timestep_max <<endl;
 
   //-----------------------------------------Image Pre-processing
-  //define cut
-  int cut=img._depth/2;
-  cut = 82;
-  cout <<"cut z= "<<cut<<endl;
-  file <<"\ncut z= "<<cut<<endl;
-  CImg<float> imgCut=img.get_crop(0,0,cut,0,img._width,img._height,cut,0);
-  imgCut.save((filename_cut+".png").c_str());
 
   //smooth image
   file<<"smooth : "<<smooth<<endl;
@@ -510,13 +490,7 @@
   CImgList<float> gg=gradient(g);
   CImg<float> h=g;
   img.assign();
-
   
-  CImg<float> gout=g;
-  gout.crop(0,0,cut,0,g._width,g._height,cut,0);
-  gout.normalize(0,255).save((filename_cut+"_edge_indicator.png").c_str());
-  gout.assign();
-  
   //initialize psi for every cell
   int maxcells=wat.max()+1; //indice maximum  
   vector<int> list=index(wat,maxcells);
@@ -540,28 +514,26 @@
       min_list[i][0]=xmin;
       min_list[i][1]=ymin;
       min_list[i][2]=zmin;
-      cout <<"cell "<<ind<<endl;
+      cout <<"cell "<<ind<<" initialised."<<endl;
     }
   }
   wat.assign();
 
-  //reconstruct image of eroded cell
+  //reconstruct image of eroded cells
   CImg<unsigned short> wat_eroded=reconstruct(background,psi_list,min_list,nbcells,list);
+  cout <<"saving file "<<wat_eroded_name<<"..."<<endl;
   wat_eroded.save_inr(wat_eroded_name.c_str(),tailleVoxel);
   string zip="gzip -f "+wat_eroded_name;
-  syst=system(zip.c_str());
-  wat_eroded.crop(0,0,cut,0,wat_eroded._width,wat_eroded._height,cut,0);
-  wat_eroded.normalize(0,255).save((filename_cut+"_eroded.png").c_str());
-  wat_eroded.assign();
+  if(system(zip.c_str()));
+  cout <<"Eroded watershed segmentation saved in file:"<<wat_eroded_name<<endl;
 
   //Segmented inital = background segmentation
   CImg<unsigned char> segmented=background;
 
   double end1=omp_get_wtime();
   double time1=double(end1-begin);
-  cout<<"initialization with erosion : "<<time1<<endl;
-  file<<"\ninitialization with erosion : "<<time1<<endl;
   cout<<"Evolving cells..... "<<endl;
+  
   //---------------------------------------------------------Edge detection
   //evolve each cell one by one, attract to maximal gradient
 #pragma omp parallel shared(psi_list,min_list,g,gg,h,lam,mu,alf,beta,epsilon,dt,list)
@@ -570,7 +542,7 @@
   for(int i=0;i<nbcells;i++) 
     {
       psi_list[i]=lsm_segment2(psi_list[i],g,gg,h,lam,mu,alf,beta,epsilon,dt,min_list[i]);
-      cout <<"cell evolution "<<list[i]<<endl;
+      cout <<"cell "<<list[i]<<" evolved."<<endl;
     }
   }
 
@@ -579,26 +551,20 @@
   CImg<unsigned short> edge=reconstruct_overlap(background,psi_list,min_list,nbcells,free,list);
   edge.save_inr(edge_detection_name.c_str(),tailleVoxel);
   zip="gzip -f "+edge_detection_name;
-  syst=system(zip.c_str());
-  edge.crop(0,0,cut,0,edge._width,edge._height,cut,0);
-  edge.normalize(0,255).save((filename_cut+"_evoEdge.png").c_str());
-  
+  if(system(zip.c_str()));
 
-
+// time measurements
   double end2=omp_get_wtime();
   double time2=double(end2-begin);
-  cout<<"edge detection : "<<time2<<endl;
-  file<<"edge detection : "<<time2<<endl;
-
-
+  
   double end=omp_get_wtime();
   double time=double(end-begin);
-  cout<<"total time : "<<time<<" (~"<<time/60<<" mn  ~"<<time/60/60<<" h)"<<endl;
-  cout<<"initialization with erosion : "<<time1<<endl;
-  cout<<"edge detection : "<<time2<<endl;
-  file<<"total time : "<<time<<" (~"<<time/60<<" mn  ~"<<time/60/60<<" h)"<<endl;
-  file<<"initialization with erosion : "<<time1<<endl;
-  file<<"edge detection : "<<time2<<endl;
+  cout<<"total time : "<<time<<"s"<<" (~"<<time/60<<" mn  ~"<<time/60/60<<" h)"<<endl;
+  cout<<"-initialization with erosion : "<<time1<<"s"<<endl;
+  cout<<"-edge detection : "<<time2<<"s"<<endl;
+  file<<"total time : "<<time<<"s"<<" (~"<<time/60<<" mn  ~"<<time/60/60<<" h)"<<endl;
+  file<<"-initialization with erosion : "<<time1<<"s"<<endl;
+  file<<"-edge detection : "<<time2<<"s"<<endl;
   file.close();
 
   return 0;
