Skip to content
Snippets Groups Projects
Commit f5ef1623 authored by Mark Woolrich's avatar Mark Woolrich
Browse files

adding susan function call

parent c7cb6ef6
No related branches found
No related tags found
No related merge requests found
......@@ -16,11 +16,13 @@
#include "miscmaths/volume.h"
#include "miscmaths/histogram.h"
#include "miscmaths/miscmaths.h"
#include "newimage/newimageall.h"
#include "glm.h"
using namespace Utilities;
using namespace NEWMAT;
using namespace MISCMATHS;
using namespace NEWIMAGE;
namespace FILM {
......@@ -369,7 +371,7 @@ namespace FILM {
return usanthresh;
}
void AutoCorrEstimator::spatiallySmooth(const string& usanfname, const Volume& epivol, int masksize, const string& epifname, const string& susanpath, int usanthresh, int lag) {
void AutoCorrEstimator::spatiallySmooth(const string& usanfname, const Volume& epivol, int masksize, const string& epifname, const string& susanpath, int usan_thresh, int lag) {
Tracer trace("AutoCorrEstimator::spatiallySmooth");
if(xdata.getNumSeries()<=1)
......@@ -378,55 +380,52 @@ namespace FILM {
}
else
{
Log& logger = LogSingleton::getInstance();
if(lag==0)
lag = MISCMATHS::Min(40,int(xdata.getNumVolumes()/4));
if(usanthresh == 0)
if(usan_thresh == 0)
{
// Establish epi thresh to use:
usanthresh = establishUsanThresh(epivol);
usan_thresh = 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);
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 volume for reading and writing volumes:
Volume vol(acEst.getNumSeries(), xdata.getInfo(), xdata.getPreThresholdPositions());
int i = 2;
cerr << "Spatially smoothing auto corr estimates" << endl;
for(; i <= lag; i++)
{
// output unsmoothed estimates:
//vol = acEst.getVolume(i).AsColumn()*factor;
//vol.unthreshold();
//vol.writeAsInt(logger.getDir() + "/" + preSmoothVol);
// setup susan input
vol = acEst.getVolume(i).AsColumn();
vol.unthreshold();
susan_vol.insert_vec(vol);
// call susan
susan_vol=susan_convolve(susan_vol,kernel,1,0,1,&usan_area,usan_vol,usan_thresh*usan_thresh);
//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);
// insert output back into acEst
vol=susan_vol.vec();
vol.threshold();
acEst.setVolume(static_cast<RowVector>((vol).AsRow()), i);
cerr << ".";
}
cerr << endl << "Completed" << endl;
}
}
void AutoCorrEstimator::calcRaw(int lag) {
cerr << "Calculating raw AutoCorrs...";
......
......@@ -5,7 +5,7 @@ PROJNAME = film
USRINCFLAGS = -I${INC_NEWMAT} -I${INC_PROB} -I${INC_ZLIB}
USRLDFLAGS = -L${LIB_NEWMAT} -L${LIB_PROB} -L${LIB_ZLIB}
LIBS = -lmiscmaths -lutils -lm -lnewmat -lfslio -lniftiio -lznz -lprob -lz
LIBS = -lmiscmaths -lnewimage -lutils -lm -lnewmat -lfslio -lniftiio -lznz -lprob -lz
XFILES = film_gls contrast_mgr ttoz ftoz ttologp
......
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