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 @@ ...@@ -16,11 +16,13 @@
#include "miscmaths/volume.h" #include "miscmaths/volume.h"
#include "miscmaths/histogram.h" #include "miscmaths/histogram.h"
#include "miscmaths/miscmaths.h" #include "miscmaths/miscmaths.h"
#include "newimage/newimageall.h"
#include "glm.h" #include "glm.h"
using namespace Utilities; using namespace Utilities;
using namespace NEWMAT; using namespace NEWMAT;
using namespace MISCMATHS; using namespace MISCMATHS;
using namespace NEWIMAGE;
namespace FILM { namespace FILM {
...@@ -369,7 +371,7 @@ namespace FILM { ...@@ -369,7 +371,7 @@ namespace FILM {
return usanthresh; 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"); Tracer trace("AutoCorrEstimator::spatiallySmooth");
if(xdata.getNumSeries()<=1) if(xdata.getNumSeries()<=1)
...@@ -378,55 +380,52 @@ namespace FILM { ...@@ -378,55 +380,52 @@ namespace FILM {
} }
else else
{ {
Log& logger = LogSingleton::getInstance();
if(lag==0) if(lag==0)
lag = MISCMATHS::Min(40,int(xdata.getNumVolumes()/4)); lag = MISCMATHS::Min(40,int(xdata.getNumVolumes()/4));
if(usanthresh == 0) if(usan_thresh == 0)
{ {
// Establish epi thresh to use: // 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> 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_area(xdata.getInfo().x,xdata.getInfo().y,xdata.getInfo().z);
volume<float> usan_vol; volume<float> usan_vol;
read_volume(usan_vol,usanfname); read_volume(usan_vol,usanfname);
volume<float> kernel; volume<float> kernel;
kernel = kernel=gaussian_kernel3D(masksize,xdata.getInfo().vx,xdata.getInfo().vy,xdata.getInfo().vz); kernel = kernel=gaussian_kernel3D(masksize,xdata.getInfo().vx,xdata.getInfo().vy,xdata.getInfo().vz);
// Setup volume for reading and writing volumes: // Setup volume for reading and writing volumes:
Volume vol(acEst.getNumSeries(), xdata.getInfo(), xdata.getPreThresholdPositions()); Volume vol(acEst.getNumSeries(), xdata.getInfo(), xdata.getPreThresholdPositions());
int i = 2; int i = 2;
cerr << "Spatially smoothing auto corr estimates" << endl; cerr << "Spatially smoothing auto corr estimates" << endl;
for(; i <= lag; i++) for(; i <= lag; i++)
{ {
// output unsmoothed estimates: // setup susan input
//vol = acEst.getVolume(i).AsColumn()*factor; vol = acEst.getVolume(i).AsColumn();
//vol.unthreshold(); vol.unthreshold();
//vol.writeAsInt(logger.getDir() + "/" + preSmoothVol); 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 // insert output back into acEst
susan_vol=susan_convolve(susan_vol,kernel,1,0,1,&usan_area,usan_vol,usan_thresh*usan_thresh); vol=susan_vol.vec();
//TODO copy susan_volume to vol vol.threshold();
acEst.setVolume(static_cast<RowVector>((vol).AsRow()), i);
// read in smoothed volume:
//vol.read(logger.getDir() + "/" + postSmoothVol);
//vol.threshold();
//acEst.setVolume(static_cast<RowVector>((vol/factor).AsRow()), i);
cerr << "."; cerr << ".";
} }
cerr << endl << "Completed" << endl; cerr << endl << "Completed" << endl;
} }
} }
void AutoCorrEstimator::calcRaw(int lag) { void AutoCorrEstimator::calcRaw(int lag) {
cerr << "Calculating raw AutoCorrs..."; cerr << "Calculating raw AutoCorrs...";
......
...@@ -5,7 +5,7 @@ PROJNAME = film ...@@ -5,7 +5,7 @@ PROJNAME = film
USRINCFLAGS = -I${INC_NEWMAT} -I${INC_PROB} -I${INC_ZLIB} USRINCFLAGS = -I${INC_NEWMAT} -I${INC_PROB} -I${INC_ZLIB}
USRLDFLAGS = -L${LIB_NEWMAT} -L${LIB_PROB} -L${LIB_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 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