Révision 28 src/lsm_contour.cpp

lsm_contour.cpp (revision 28)
116 116
  outputdir.erase(filename.size()-4);
117 117
  string mkdir="mkdir -p "+outputdir;
118 118
  systout=system(mkdir.c_str()); 
119
  mkdir="mkdir -p "+outputdir+"/evolution";
120
  systout=system(mkdir.c_str());
121 119

  
122
  string filename_cut=outputdir+"/evolution/"+filename;
123
  filename_cut.erase(filename_cut.size()-4);
120
  string filename_txt=outputdir+"/"+filename;
121
  filename_txt.erase(filename_txt.size()-4);
124 122
  filename=outputdir+"/"+filename;
125 123
  string result_name=filename;
126 124

  
127 125
  //txt files 
128 126
  ofstream file;
129
  string txt_name=filename_cut+".txt";
127
  string txt_name=filename_txt+".txt";
130 128
  file.open(txt_name.c_str());
131 129
  file<<argv[0]<<endl;
132 130
  time_t t;
......
150 148
  file<<"perDown : "<<perDown<<endl;
151 149

  
152 150
  ofstream bg_file;
153
  string bg_name=filename_cut+"_BGgrowth.txt";
151
  string bg_name=filename_txt+"_BGgrowth.txt";
154 152
  bg_file.open(bg_name.c_str());
155 153
  bg_file<<"it\tbg_growth"<<endl;
156 154

  
......
158 156
  //add slices
159 157
  img=add_side_slices(img,3);
160 158

  
161
  //define and save cut
162
  int cut=img._depth/2;
163
  cout <<"cut z= "<<cut<<endl;
164
  file <<"\ncut z= "<<cut<<endl;
165
  CImg<float> imgCut=img.get_crop(0,0,cut,0,img._width,img._height,cut,0);
166
  imgCut.save((filename_cut+".png").c_str());
167

  
168 159
  //smooth image
169 160
  file<<"smooth : "<<smooth<<endl;
170 161
  img.blur(smooth);
......
231 222
	  it_stop=0;
232 223
	}
233 224

  
234
      //Graphics to follow evolution
235
      if((it%50==0)or(contour_evolves==false)or(it==timestep_max-1))
236
	{
237
	  ostringstream oss;
238
	  oss << it;
239
	  string iterstring="";
240
	  if(it<10) {iterstring="00"+oss.str();}
241
	  else if (it<100) {iterstring="0"+oss.str();}
242
	  else {iterstring=oss.str();}
243
	  cout<<"-----------------------------------"<<endl;
244
	  cout<<" *** time step for graphics : "<<iterstring<<endl;
245
	  //Save cut
246
	  CImg<float>segCut=segmented.get_crop(0,0,cut,0,img._width,img._height,cut,0);
247
	  string temp_name=filename_cut+"it"+iterstring+".png";
248
	  segCut.normalize(0,255).save(temp_name.c_str());
249
	}
225
    //Save result
250 226
      if((((it%50)==0)and(it!=0))or(contour_evolves==false)or(it==timestep_max-1))
251
	{
252
	  //Save result
227
	{	  
253 228
	  CImg<unsigned char>segSave=remove_side_slices(segmented,3);
254 229
	  segSave.save_inr(result_name.c_str(),tailleVoxel);
255 230
	  segSave.assign();

Formats disponibles : Unified diff