diff --git a/fsl_regfilt.cc b/fsl_regfilt.cc index bb16d1367bec097dd003630e61267b00f7cfc371..e97434fb5468e24b270caf3b79ac24ae2f5e55bc 100644 --- a/fsl_regfilt.cc +++ b/fsl_regfilt.cc @@ -44,9 +44,12 @@ using namespace std; Option<string> filter(string("-f,--filter"),string(""), string("filter out part of the regression model, e.g. -f \"1,2,3\""), true, requires_argument); + Option<bool> verbose(string("-v"),FALSE, + string(" switch on diagnostic messages"), + false, no_argument); Option<bool> perfvn(string("--vn"),FALSE, string(" perfrom variance-normalisation on data"), - false, requires_argument); + false, no_argument); Option<int> help(string("-h,--help"), 0, string("display this help text"), false,no_argument); @@ -67,6 +70,7 @@ using namespace std; Matrix meanR; RowVector vnscales; volume<float> mask; + volume<float> Mean; volumeinfo volinf; /* } */ @@ -103,7 +107,9 @@ int dofilter(){ cerr << "ERROR: need to specify 4D input to use filtering" << endl; return 1; } - Matrix unmixMatrix = pinv(design); + if(verbose.value()) + cout << " Calculating maps " << endl; + Matrix unmixMatrix = pinv(design); Matrix maps = unmixMatrix * data; Matrix noisedes; @@ -133,7 +139,9 @@ int dofilter(){ } }while(p); Matrix newData; - newData = data - noisedes * noisemaps.t(); + if(verbose.value()) + cout << " Calculating filtered data " << endl; + newData = data - noisedes * noisemaps.t(); newData = newData + ones(newData.Nrows(),1)*meanR; save4D(newData,fnout.value()); @@ -154,11 +162,19 @@ int setup(){ return 1; }; }else{ - mask = tmpdata[0]*0.0+1.0; + if(verbose.value()) + cout << " Creating mask image " << endl; + Mean = meanvol(tmpdata); + float Mmin, Mmax; + Mmin = Mean.min(); Mmax = Mean.max(); + mask = binarise(Mean,float(Mmin + 0.01* (Mmax-Mmin)),Mmax); } data = tmpdata.matrix(mask); voxels = data.Ncols(); + if(verbose.value()) + cout << " Data matrix size : " << data.Nrows() << " x " << voxels << endl; + }else{ cerr << "ERROR: cannot read input image " << fnin.value()<<endl; return 1; @@ -205,6 +221,7 @@ int main(int argc,char *argv[]){ options.add(fnmask); options.add(filter); options.add(perfvn); + options.add(verbose); options.add(help); options.add(outdata); options.add(outvnscales); @@ -226,5 +243,5 @@ int main(int argc,char *argv[]){ }catch(std::exception &e) { cerr << e.what() << endl; } - } +} diff --git a/meldata.cc b/meldata.cc index cabb70793a4dd7650ed5291f4fc10b8c9a67dd74..c6235e09fe1f36261ec3998303c33741e195d74c 100644 --- a/meldata.cc +++ b/meldata.cc @@ -526,7 +526,6 @@ namespace Melodic{ if(meanR.Storage()>0) newData = newData + ones(newData.Nrows(),1)*meanR; - cerr << " HERE REMOVE " << endl; volume4D<float> tmp; read_volume4D(tmp,opts.inputfname.value().at(0)); tmp.setmatrix(newData,Mask); diff --git a/melgmix.cc b/melgmix.cc index 3831a749ee56929d528d94a5b5890002776ba243..42bcaae9fbb7c18907e27c8cbf435cc6aa1b0f1e 100644 --- a/melgmix.cc +++ b/melgmix.cc @@ -239,9 +239,7 @@ namespace Melodic{ SortAscending(tmp); RowVector newcdf(tmp); newcdf << normcdf(tmp,means(1),vars(1)); - write_ascii_matrix(dat,"dat"); - write_ascii_matrix(newcdf,"newcdf"); - write_ascii_matrix(tmp,"tmpmat"); + float thrp = tmp(tmp.Ncols())+0.01; float thrn = tmp(1)-0.01; int ctr=tmp.Ncols(); diff --git a/meloptions.h b/meloptions.h index 9270400ad8115add0d38e16bde32794f3c901220..9cbf13c2092738f1550b189624bf31c00ea6d831 100644 --- a/meloptions.h +++ b/meloptions.h @@ -168,7 +168,7 @@ class MelodicOptions { perf_bet(string("--nobet"), true, string("\tswitch off BET"), false, no_argument), - threshold(string("--bgthreshold"), 0.00000001, + threshold(string("--bgthreshold"), 0.01, string("brain / non-brain threshold (only if --nobet selected)\n"), false, requires_argument), pca_dim(string("-d,--dim"), 0, diff --git a/melreport.h b/melreport.h index 3989f8a0b625bef81ad3c62226cc0d415709a5c8..e6ce996d57add175323886f03c4934341a5a80e4 100644 --- a/melreport.h +++ b/melreport.h @@ -80,7 +80,7 @@ namespace Melodic{ report <<"<OBJECT data="<<opts.guireport.value()<< "></OBJECT>"<< endl; loghtml <<"<OBJECT data="<<opts.guireport.value()<< "></OBJECT>"<< endl; } - report << "<IFRAME height=100px width=100% src=nav.html frameborder=0></IFRAME><p>"<< endl; + report << "<IFRAME height=80px width=100% src=nav.html frameborder=0></IFRAME><p>"<< endl; loghtml << "<IFRAME height=100px width=100% src=nav.html frameborder=0></IFRAME><p>" <<"<pre>../melodic.log</pre>" <<endl; navigator <<"<CENTER><TABLE BORDER=0><TR>" << endl