56 |
56 |
//ckeck filename and read image
|
57 |
57 |
string filename=argv[1];
|
58 |
58 |
CImg<unsigned char> img_prev;
|
|
59 |
|
|
60 |
float tailleVoxel[3] = {0};// resolution initialisation
|
|
61 |
|
59 |
62 |
if(filename.compare(filename.size()-4,4,".inr")==0)
|
60 |
63 |
{
|
61 |
|
img_prev.load(filename.c_str());
|
|
64 |
img_prev.get_load_inr(filename.c_str(),tailleVoxel); // reads resolution
|
62 |
65 |
}
|
63 |
66 |
else if(filename.compare(filename.size()-7,7,".inr.gz")==0)
|
64 |
67 |
{
|
65 |
|
img_prev.load_gzip_external(filename.c_str());
|
|
68 |
string oldname = filename;
|
66 |
69 |
filename.erase(filename.size()-3);
|
|
70 |
string zip="gunzip -c "+oldname+" > "+filename;
|
|
71 |
if(system(zip.c_str())); // decompress image file
|
|
72 |
img_prev.load(filename.c_str()); //read image
|
|
73 |
img_prev.get_load_inr(filename.c_str(),tailleVoxel); // read resolution
|
|
74 |
zip="rm "+filename;
|
|
75 |
if(system(zip.c_str())); //removes decompressed image
|
|
76 |
|
|
77 |
|
67 |
78 |
}
|
68 |
79 |
else
|
69 |
80 |
{cout<<"!! wrong file extension : "<<filename<<endl;
|
... | ... | |
93 |
104 |
float perUp=atof(argv[7]);
|
94 |
105 |
float perDown=atof(argv[8]);
|
95 |
106 |
|
96 |
|
float tailleVoxel[3] = {0.195177,0.195177,0.195177};
|
97 |
|
|
98 |
|
//other paremeters
|
99 |
|
int systout;
|
|
107 |
cout<<"Voxel size : ("<<tailleVoxel[0]<<","<<tailleVoxel[1]<<","<<tailleVoxel[2]<<")"<<endl;
|
100 |
108 |
|
|
109 |
|
101 |
110 |
//-------------------------------------------Names and directories
|
102 |
111 |
//new name with arguments
|
103 |
112 |
string ar2=argv[2];
|
... | ... | |
115 |
124 |
string outputdir=filename;
|
116 |
125 |
outputdir.erase(filename.size()-4);
|
117 |
126 |
string mkdir="mkdir -p "+outputdir;
|
118 |
|
systout=system(mkdir.c_str());
|
|
127 |
if(system(mkdir.c_str()));
|
119 |
128 |
|
120 |
129 |
string filename_txt=outputdir+"/"+filename;
|
121 |
130 |
filename_txt.erase(filename_txt.size()-4);
|
... | ... | |
229 |
238 |
segSave.save_inr(result_name.c_str(),tailleVoxel);
|
230 |
239 |
segSave.assign();
|
231 |
240 |
string zip="gzip -f "+result_name;
|
232 |
|
systout=system(zip.c_str());
|
|
241 |
if(system(zip.c_str()));
|
233 |
242 |
}
|
234 |
243 |
it+=1;
|
235 |
244 |
}
|