diff --git a/fsl_glm.cc b/fsl_glm.cc index ab9a411b259400f4da9d40f878dfeea8057d9fb1..29413d25397ebdd9c468faa3f0c2a6019d19244b 100644 --- a/fsl_glm.cc +++ b/fsl_glm.cc @@ -24,9 +24,7 @@ using namespace std; string title=string("fsl_glm (Version 1.1)")+ string("\nCopyright(c) 2004-2009, University of Oxford (Christian F. Beckmann)\n")+ - string(" \n Simple GLM usign ordinary least-squares (OLS) regression on\n")+ - string(" time courses and/or 3D/4D imges against time courses \n")+ - string(" or 3D/4D images"); + string(" \n Simple GLM allowing temporal or spatial regression on either text data or images\n"); string examples="fsl_glm -i <input> -d <design> -o <output> [options]"; //Command line Options { @@ -37,7 +35,7 @@ using namespace std; string("output file name for GLM parameter estimates (GLM betas)"), false, requires_argument); Option<string> fndesign(string("-d,--design"), string(""), - string("file name of the GLM design matrix (time courses or spatial maps)"), + string("file name of the GLM design matrix (text time courses for temporal regression or an image file for spatial regression )"), false, requires_argument); Option<string> fnmask(string("-m,--mask"), string(""), string("mask image file name if input is image"), @@ -167,7 +165,7 @@ int setup(int &dof){ if(!samesize(tmpdata[0],mask)){ cerr << "ERROR: Mask image does not match input image" << endl; return 1; - }; + }; }else{ if(debug.value()) cout << "Creating mask image" << endl; @@ -186,7 +184,7 @@ int setup(int &dof){ } } else - data = read_ascii_matrix(fnin.value()); + data = read_ascii_matrix(fnin.value()); if(fsl_imageexists(fndesign.value())){//read design if(debug.value()) @@ -205,8 +203,17 @@ int setup(int &dof){ design = read_ascii_matrix(fndesign.value()); } - dof=(int)ols_dof(design); + cerr << data << endl << design << endl; + + if (perf_demean.value() ) { + if(debug.value()) + cout << "De-meaning the data matrix" << endl; + data = remmean(data,1); + } + + dof=ols_dof(design); Matrix baseConfounds; + if ( textConfounds.set() ) { baseConfounds=read_ascii_matrix( textConfounds.value().at(0) ); for(unsigned int i=1; i< textConfounds.value().size(); i++) @@ -238,14 +245,6 @@ int setup(int &dof){ dof-=confounds.size(); } - - - if(perf_demean.value()){ - if(debug.value()) - cout << "De-meaning the data matrix" << endl; - data = remmean(data,1); - dof-=1; - } if(normdat.value()){ if(debug.value()) cout << "Normalising data matrix to unit std-deviation" << endl; @@ -253,11 +252,17 @@ int setup(int &dof){ } meanR=mean(data,1); + if(perf_demean.value()){ if(debug.value()) cout << "De-meaning design matrix" << endl; design = remmean(design,1); + dof-=1; } + + cerr << data << endl << design << endl; + + if(normdes.value()){ if(debug.value()) cout << "Normalising design matrix to unit std-deviation" << endl;