Skip to content
Snippets Groups Projects
Commit c7cb6ef6 authored by Matthew Webster's avatar Matthew Webster
Browse files

temporary update to new susan

parent cc0c38f5
No related branches found
No related tags found
No related merge requests found
......@@ -388,21 +388,15 @@ namespace FILM {
// Establish epi thresh to use:
usanthresh = establishUsanThresh(epivol);
}
volume<float> susan_vol(xdata.getInfo().x,xdata.getInfo().y,xdata.getInfo().z);
volume<float> usan_area(xdata.getInfo().x,xdata.getInfo().y,xdata.getInfo().z);
volume<float> usan_vol;
read_volume(usan_vol,usanfname);
volume<float> kernel;
kernel = kernel=gaussian_kernel3D(masksize,xdata.getInfo().vx,xdata.getInfo().vy,xdata.getInfo().vz);
// Setup external call to susan program:
ostringstream osc3;
string preSmoothVol = "preSmoothVol";
string postSmoothVol = "postSmoothVol";
osc3 << susanpath << " "
<< logger.getDir() << "/" << preSmoothVol << " 1 "
<< logger.getDir() << "/" << postSmoothVol << " "
<< masksize << " 3D 0 1 " << usanfname << " " << usanthresh << " "
<< logger.getDir() << "/" << "usanSize";
// Loop through first third of volumes
// assume the rest are zero
int factor = 10000;
// Setup volume for reading and writing volumes:
Volume vol(acEst.getNumSeries(), xdata.getInfo(), xdata.getPreThresholdPositions());
......@@ -410,39 +404,26 @@ namespace FILM {
int i = 2;
cerr << "Spatially smoothing auto corr estimates" << endl;
cerr << osc3.str() << endl;
for(; i <= lag; i++)
{
// output unsmoothed estimates:
vol = acEst.getVolume(i).AsColumn()*factor;
vol.unthreshold();
vol.writeAsInt(logger.getDir() + "/" + preSmoothVol);
// call susan:
system(osc3.str().c_str());
//vol = acEst.getVolume(i).AsColumn()*factor;
//vol.unthreshold();
//vol.writeAsInt(logger.getDir() + "/" + preSmoothVol);
//TODO copy vol to susan_volume
susan_vol=susan_convolve(susan_vol,kernel,1,0,1,&usan_area,usan_vol,usan_thresh*usan_thresh);
//TODO copy susan_volume to vol
// read in smoothed volume:
vol.read(logger.getDir() + "/" + postSmoothVol);
vol.threshold();
acEst.setVolume(static_cast<RowVector>((vol/factor).AsRow()), i);
//vol.read(logger.getDir() + "/" + postSmoothVol);
//vol.threshold();
//acEst.setVolume(static_cast<RowVector>((vol/factor).AsRow()), i);
cerr << ".";
}
cerr << endl;
// Clear unwanted written files
ostringstream osc;
osc << "rm -rf "
<< logger.getDir() + "/" + postSmoothVol + "* "
<< logger.getDir() + "/" + preSmoothVol + "* "
<< logger.getDir() + "/usanSize*";
cerr << osc.str() << endl;
system(osc.str().c_str());
cerr << "Completed" << endl;
cerr << endl << "Completed" << endl;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment