Skip to content
Snippets Groups Projects
Commit 96143800 authored by Christian Beckmann's avatar Christian Beckmann
Browse files

added instacorr option

parent 55470a36
No related branches found
No related tags found
No related merge requests found
......@@ -115,6 +115,19 @@ namespace Melodic{
message(" done" << endl);
}
//convert to instacorrs
if(opts.insta_fn.value()>""){
Matrix vscales = pow(stdev(tmpData,1),-1);
varnorm(tmpData,vscales);
Matrix tmpTC = tmpData * insta_mask.t();
varnorm(tmpTC,pow(stdev(tmpTC),-1));
for(int ctr=1; ctr <=tmpData.Ncols();ctr++)
tmpData.Column(ctr) = SP(tmpData.Column(ctr),tmpTC);
}
tmpData.Release();
dbgmsg(string("END: process_file") << endl);
return tmpData;
......@@ -607,6 +620,19 @@ namespace Melodic{
create_RXweight();
}
//set up instacorr mask image
if(opts.insta_fn.value()>""){
dbgmsg(string(" Setting up instacorr mask") << endl);
volume4D<float> tmp_im;
read_volume4D(tmp_im,opts.insta_fn.value());
if(!samesize(Mean,tmp_im[0])){
cerr << "ERROR:: instacorr mask and data have different voxel dimensions \n\n";
exit(2);
}
insta_mask = tmp_im.matrix(Mask);
}
//seed the random number generator
double tmptime = time(NULL);
if ( opts.seed.value() != -1 ) {
......
......@@ -241,6 +241,7 @@ namespace Melodic{
volume<float> Mask;
volume<float> Mean;
volume<float> background;
Matrix insta_mask;
Matrix Data;
Matrix PPCA;
......
......@@ -164,6 +164,8 @@ namespace Melodic{
return tmpD;
} //RowVector varnorm
Matrix SP2(const Matrix& in, const Matrix& weights, int econ)
{
Matrix Res;
......
......@@ -66,7 +66,7 @@
namespace Melodic{
const string version = "3.13";
const string version = "3.131";
// The two strings below specify the title and example usage that is
// printed out as the help or usage message
......
......@@ -155,6 +155,9 @@ MelodicOptions* MelodicOptions::gopt = NULL;
if (numICs.value() > 0){
explicitnums = true;
}
if (insta_fn.value() > ""){
varnorm.set_T(false);
}
//in the case of indirect inputs, create the vector of input names here
if(!fsl_imageexists(inputfname.value().at(0))){
......
/* MELODIC - Multivariate exploratory linear optimized decomposition into
/* MELODIC - Multivariate exploratory linear optimized decomposition into
independent components
meloptions.h - class for command line options
......@@ -125,6 +125,7 @@ class MelodicOptions {
Option<float> nlconst1;
Option<float> nlconst2;
Option<float> smooth_probmap;
Option<string> insta_fn;
Option<bool> remove_meanvol;
Option<bool> remove_meantc;
......@@ -391,6 +392,9 @@ class MelodicOptions {
smooth_probmap(string("--smooth_pm"), 0.0,
string("width of smoothing kernel for probability maps"),
false, requires_argument, false),
insta_fn(string("--insta_fn"), string(""),
string(" mask file name for instacorr calculation"),
false, requires_argument, false),
remove_meanvol(string("--keep_meanvol"), true,
string("do not subtract mean volume"),
false, no_argument, false),
......@@ -496,6 +500,7 @@ class MelodicOptions {
options.add(nlconst1);
options.add(nlconst2);
options.add(smooth_probmap);
options.add(insta_fn);
options.add(remove_meanvol);
options.add(remove_meantc);
options.add(remove_endslices);
......
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