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

3.0 alpha 1

parent 4c237f7d
No related branches found
No related tags found
No related merge requests found
...@@ -155,6 +155,8 @@ namespace Melodic{ ...@@ -155,6 +155,8 @@ namespace Melodic{
{ {
setup_misc(); setup_misc();
numfiles = (int)opts.inputfname.value().size(); numfiles = (int)opts.inputfname.value().size();
if((numfiles > 1) && (opts.approach.value()==string("defl") || opts.approach.value()==string("symm")))
opts.approach.set_T("tica");
Matrix alldat, tmpData; Matrix alldat, tmpData;
alldat = process_file(opts.inputfname.value().at(0), numfiles) / numfiles; alldat = process_file(opts.inputfname.value().at(0), numfiles) / numfiles;
...@@ -324,6 +326,10 @@ namespace Melodic{ ...@@ -324,6 +326,10 @@ namespace Melodic{
save4D(stdNoisei,string("Noise_stddev_inv")); save4D(stdNoisei,string("Noise_stddev_inv"));
} }
//Output T- & S-modes
save_Tmodes();
save_Smodes();
//Output mixMatrix //Output mixMatrix
if(mixMatrix.Storage()>0){ if(mixMatrix.Storage()>0){
saveascii(mixMatrix, opts.outputfname.value() + "_mix"); saveascii(mixMatrix, opts.outputfname.value() + "_mix");
......
...@@ -77,10 +77,22 @@ namespace Melodic{ ...@@ -77,10 +77,22 @@ namespace Melodic{
inline vector<Matrix>& get_Smodes() {return Smodes;} inline vector<Matrix>& get_Smodes() {return Smodes;}
inline Matrix& get_Smodes(int what) {return Smodes.at(what);} inline Matrix& get_Smodes(int what) {return Smodes.at(what);}
inline void add_Smodes(Matrix& Arg) {Smodes.push_back(Arg);} inline void add_Smodes(Matrix& Arg) {Smodes.push_back(Arg);}
inline void save_Smodes(){
Matrix tmp = Smodes.at(0);
for(unsigned int ctr = 1; ctr < Smodes.size(); ctr++)
tmp |= Smodes.at(ctr);
saveascii(tmp,opts.outputfname.value() + "_Smodes");
}
inline vector<Matrix>& get_Tmodes() {return Tmodes;} inline vector<Matrix>& get_Tmodes() {return Tmodes;}
inline Matrix& get_Tmodes(int what) {return Tmodes.at(what);} inline Matrix& get_Tmodes(int what) {return Tmodes.at(what);}
inline void add_Tmodes(Matrix& Arg) {Tmodes.push_back(Arg);} inline void add_Tmodes(Matrix& Arg) {Tmodes.push_back(Arg);}
inline void save_Tmodes(){
Matrix tmp = Tmodes.at(0);
for(unsigned int ctr = 1; ctr < Tmodes.size(); ctr++)
tmp |= Tmodes.at(ctr);
saveascii(tmp,opts.outputfname.value() + "_Tmodes");
}
void set_TSmode(); void set_TSmode();
......
...@@ -90,8 +90,9 @@ namespace Melodic{ ...@@ -90,8 +90,9 @@ namespace Melodic{
// rank 1 approximation in the case of multiple input files // rank 1 approximation in the case of multiple input files
if(melodat.get_numfiles() > 1) if(opts.approach.value() == string("tica"))
{ {
message(" Rank-1 approximation of the time courses; ");
Matrix temp(melodat.get_dewhite() * redUMM); Matrix temp(melodat.get_dewhite() * redUMM);
temp = melodat.expand_dimred(temp); temp = melodat.expand_dimred(temp);
temp = krapprox(temp,int(temp.Nrows()/melodat.get_numfiles())); temp = krapprox(temp,int(temp.Nrows()/melodat.get_numfiles()));
...@@ -460,7 +461,10 @@ write_ascii_matrix("Xim",Data.Row(1)); ...@@ -460,7 +461,10 @@ write_ascii_matrix("Xim",Data.Row(1));
//switch to the chosen method //switch to the chosen method
// cout << endl << "Dim = " << dim << endl << "Samples = " << samples << endl; // cout << endl << "Dim = " << dim << endl << "Samples = " << samples << endl;
if(opts.approach.value()==string("symm")){ if(opts.approach.value()==string("symm") ||
opts.approach.value()==string("tica") ||
opts.approach.value()==string("parafac") ||
opts.approach.value()==string("concat")){
ica_fastica_symm(Data);} ica_fastica_symm(Data);}
if(opts.approach.value()==string("defl")){ if(opts.approach.value()==string("defl")){
ica_fastica_defl(Data);} ica_fastica_defl(Data);}
...@@ -468,6 +472,7 @@ write_ascii_matrix("Xim",Data.Row(1)); ...@@ -468,6 +472,7 @@ write_ascii_matrix("Xim",Data.Row(1));
ica_jade(Data);} ica_jade(Data);}
if(opts.approach.value()==string("maxent")){ if(opts.approach.value()==string("maxent")){
ica_maxent(Data);} ica_maxent(Data);}
if(!no_convergence){//calculate the IC if(!no_convergence){//calculate the IC
Matrix temp(melodat.get_unmix()*melodat.get_Data()); Matrix temp(melodat.get_unmix()*melodat.get_Data());
......
...@@ -313,11 +313,13 @@ Matrix mmall(Log& logger, MelodicOptions& opts, ...@@ -313,11 +313,13 @@ Matrix mmall(Log& logger, MelodicOptions& opts,
wherelog,ctr, wherelog,ctr,
melodat.get_mask(), melodat.get_mask(),
melodat.get_mean(),3); melodat.get_mean(),3);
message(" calculating mixture-model fit "<<endl);
mixmod.fit("GGM"); mixmod.fit("GGM");
if(opts.output_MMstats.value()){ if(opts.output_MMstats.value()){
message(" saving probability map:");
melodat.save4D(mixmod.get_probmap(), melodat.save4D(mixmod.get_probmap(),
string("stats/probmap_")+num2str(ctr)); string("stats/probmap_")+num2str(ctr));
} }
//re-scale spatial maps to mean 0 for nht //re-scale spatial maps to mean 0 for nht
...@@ -380,6 +382,7 @@ Matrix mmall(Log& logger, MelodicOptions& opts, ...@@ -380,6 +382,7 @@ Matrix mmall(Log& logger, MelodicOptions& opts,
<< " Means : " << mixmod.get_means() << endl << " Means : " << mixmod.get_means() << endl
<< " Vars. : " << mixmod.get_vars() << endl << " Vars. : " << mixmod.get_vars() << endl
<< " Prop. : " << mixmod.get_pi() << endl << endl; << " Prop. : " << mixmod.get_pi() << endl << endl;
message(" saving thresholded Z-stats image:");
melodat.save4D(mixmod.get_threshmaps(), melodat.save4D(mixmod.get_threshmaps(),
string("stats/thresh_zstat")+num2str(ctr)); string("stats/thresh_zstat")+num2str(ctr));
} }
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
namespace Melodic{ namespace Melodic{
const string version = "3.02"; const string version = "3.0 alpha 1";
} }
......
...@@ -80,7 +80,7 @@ MelodicOptions* MelodicOptions::gopt = NULL; ...@@ -80,7 +80,7 @@ MelodicOptions* MelodicOptions::gopt = NULL;
} }
if (approach.value() != "symm" && approach.value() != "defl" && if (approach.value() != "symm" && approach.value() != "defl" &&
approach.value() != "jade" && approach.value() != "maxent" && approach.value() != "jade" && approach.value() != "maxent" &&
approach.value() != "tica" && approach.value() != "parafac"){ approach.value() != "tica" && approach.value() != "concat"){
cerr << "ERROR:: unknown approach \n\n"; cerr << "ERROR:: unknown approach \n\n";
print_usage(argc,argv); print_usage(argc,argv);
exit(2); exit(2);
......
...@@ -171,7 +171,7 @@ class MelodicOptions { ...@@ -171,7 +171,7 @@ class MelodicOptions {
string("numer of IC's to extract (for deflation approach)"), string("numer of IC's to extract (for deflation approach)"),
false, requires_argument), false, requires_argument),
approach(string("-a,--approach"), string("symm"), approach(string("-a,--approach"), string("symm"),
string("approach for decomposition: defl, symm"), string("approach for decomposition, 2D: defl, symm (default), 3D: tica (default), concat"),
false, requires_argument), false, requires_argument),
nonlinearity(string("--nl"), string("pow3"), nonlinearity(string("--nl"), string("pow3"),
string("\tnonlinearity: gauss, tanh, pow3, pow4"), string("\tnonlinearity: gauss, tanh, pow3, pow4"),
......
...@@ -146,10 +146,10 @@ namespace Melodic{ ...@@ -146,10 +146,10 @@ namespace Melodic{
{//plot subject mode {//plot subject mode
Matrix smode; Matrix smode;
smode = melodat.get_Smodes(0); smode = melodat.get_Smodes(cnum-1);
if(smode.Nrows() > 1){ if(smode.Nrows() > 1){
miscplot newplot; miscplot newplot;
newplot.timeseries(smode, newplot.timeseries(smode.t(),
report.appendDir(string("s")+num2str(cnum)+".png"), report.appendDir(string("s")+num2str(cnum)+".png"),
string("Subject/Session mode")); string("Subject/Session mode"));
write_ascii_matrix(report.appendDir(string("s") write_ascii_matrix(report.appendDir(string("s")
...@@ -161,7 +161,6 @@ namespace Melodic{ ...@@ -161,7 +161,6 @@ namespace Melodic{
+string("s")+num2str(cnum)+".png\"></A><p>" << endl; +string("s")+num2str(cnum)+".png\"></A><p>" << endl;
} }
}//subject mode plot }//subject mode plot
cerr << "after subject plot " << endl;
{//plot frequency {//plot frequency
miscplot newplot; miscplot newplot;
RowVector empty(1); RowVector empty(1);
......
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