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

MELODIC 3.0 beta

parent 3a316b72
No related branches found
No related tags found
No related merge requests found
...@@ -181,10 +181,10 @@ namespace Melodic{ ...@@ -181,10 +181,10 @@ namespace Melodic{
} }
else{ else{
order = opts.pca_dim.value(); order = opts.pca_dim.value();
std_pca(tmpData, RXweight, Corr, pcaE, pcaD); std_pca(alldat, RXweight, Corr, pcaE, pcaD);
calc_white(pcaE, pcaD, order, whiteMatrix, dewhiteMatrix); calc_white(pcaE, pcaD, order, whiteMatrix, dewhiteMatrix);
} }
if(numfiles < 2){ if(numfiles < 2){
Data = alldat; Data = alldat;
Matrix tmp = Identity(Data.Nrows()); Matrix tmp = Identity(Data.Nrows());
...@@ -193,7 +193,7 @@ namespace Melodic{ ...@@ -193,7 +193,7 @@ namespace Melodic{
} else { } else {
for(int ctr = 0; ctr < numfiles; ctr++){ for(int ctr = 0; ctr < numfiles; ctr++){
tmpData = process_file(opts.inputfname.value().at(ctr), numfiles); tmpData = process_file(opts.inputfname.value().at(ctr), numfiles);
// whiten (separate / joint) // whiten (separate / joint)
if(!opts.joined_whiten.value()){ if(!opts.joined_whiten.value()){
std_pca(tmpData, RXweight, Corr, pcaE, pcaD); std_pca(tmpData, RXweight, Corr, pcaE, pcaD);
...@@ -248,6 +248,7 @@ namespace Melodic{ ...@@ -248,6 +248,7 @@ namespace Melodic{
char callRMstr[1000]; char callRMstr[1000];
ostrstream osc(callRMstr,1000); ostrstream osc(callRMstr,1000);
osc << "rm " << string(Mean_fname) <<"* " << '\0'; osc << "rm " << string(Mean_fname) <<"* " << '\0';
system(callRMstr); system(callRMstr);
if(!samesize(Mean,Mask)){ if(!samesize(Mean,Mask)){
...@@ -266,9 +267,24 @@ namespace Melodic{ ...@@ -266,9 +267,24 @@ namespace Melodic{
//seed the random number generator //seed the random number generator
double tmptime = time(NULL); double tmptime = time(NULL);
srand((unsigned int) tmptime); srand((unsigned int) tmptime);
}
//read in post-proc design matrices etc
if(opts.fn_Tdesign.value().length()>0)
Tdes = read_vest(opts.fn_Tdesign.value());
if(opts.fn_Sdesign.value().length()>0)
Sdes = read_vest(opts.fn_Sdesign.value());
if(opts.fn_Tcon.value().length()>0)
Tcon = read_vest(opts.fn_Tcon.value());
if(opts.fn_Scon.value().length()>0)
Scon = read_vest(opts.fn_Scon.value());
if(opts.fn_TconF.value().length()>0)
TconF = read_vest(opts.fn_TconF.value());
if(opts.fn_SconF.value().length()>0)
SconF = read_vest(opts.fn_SconF.value());
Tdes = remmean(Tdes,1);
Sdes = remmean(Sdes,1);
}
// {{{ Save // {{{ Save
void MelodicData::save() void MelodicData::save()
...@@ -334,7 +350,7 @@ namespace Melodic{ ...@@ -334,7 +350,7 @@ namespace Melodic{
//Output mixMatrix //Output mixMatrix
if(mixMatrix.Storage()>0){ if(mixMatrix.Storage()>0){
saveascii(mixMatrix, opts.outputfname.value() + "_mix"); saveascii(mixMatrix, opts.outputfname.value() + "_mix");
mixFFT=calc_FFT(mixMatrix, opts.logPower.value()); mixFFT=calc_FFT(expand_mix(), opts.logPower.value());
saveascii(mixFFT,opts.outputfname.value() + "_FTmix"); saveascii(mixFFT,opts.outputfname.value() + "_FTmix");
} }
...@@ -746,7 +762,7 @@ namespace Melodic{ ...@@ -746,7 +762,7 @@ namespace Melodic{
ICstats |= copeN; ICstats |= copeN;
} }
mixFFT=calc_FFT(mixMatrix, opts.logPower.value()); mixFFT=calc_FFT(expand_mix(), opts.logPower.value());
unmixMatrix = pinv(mixMatrix); unmixMatrix = pinv(mixMatrix);
//if(ICstats.Storage()>0){cout << "ICstats: " << ICstats.Nrows() <<"x" << ICstats.Ncols() << endl;}else{cout << "ICstats empty " <<endl;} //if(ICstats.Storage()>0){cout << "ICstats: " << ICstats.Nrows() <<"x" << ICstats.Ncols() << endl;}else{cout << "ICstats empty " <<endl;}
......
...@@ -29,32 +29,31 @@ namespace Melodic{ ...@@ -29,32 +29,31 @@ namespace Melodic{
//constructor //constructor
MelodicData(MelodicOptions &popts, Log &plogger): MelodicData(MelodicOptions &popts, Log &plogger):
opts(popts), opts(popts),logger(plogger)
logger(plogger) {
{ after_mm = false;
after_mm = false; Resels = 0;
Resels = 0; }
}
void save(); void save();
Matrix process_file(string fname, int numfiles); Matrix process_file(string fname, int numfiles);
inline void save4D(Matrix what, string fname){ inline void save4D(Matrix what, string fname){
volume4D<float> tempVol; volume4D<float> tempVol;
tempVol.setmatrix(what,Mask); tempVol.setmatrix(what,Mask);
save_volume4D(tempVol,logger.appendDir(fname),tempInfo); save_volume4D(tempVol,logger.appendDir(fname),tempInfo);
message(" " << logger.appendDir(fname) << endl); message(" " << logger.appendDir(fname) << endl);
} }
inline void saveascii(Matrix what, string fname){ inline void saveascii(Matrix what, string fname){
write_ascii_matrix(logger.appendDir(fname),what); write_ascii_matrix(logger.appendDir(fname),what);
message(" " << logger.appendDir(fname) << endl); message(" " << logger.appendDir(fname) << endl);
} }
inline void savebinary(Matrix what, string fname){ inline void savebinary(Matrix what, string fname){
write_binary_matrix(what,logger.appendDir(fname)); write_binary_matrix(what,logger.appendDir(fname));
message(" " << logger.appendDir(fname) << endl); message(" " << logger.appendDir(fname) << endl);
} }
int remove_components(); int remove_components();
...@@ -78,20 +77,20 @@ namespace Melodic{ ...@@ -78,20 +77,20 @@ namespace Melodic{
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(){ inline void save_Smodes(){
Matrix tmp = Smodes.at(0); Matrix tmp = Smodes.at(0);
for(unsigned int ctr = 1; ctr < Smodes.size(); ctr++) for(unsigned int ctr = 1; ctr < Smodes.size(); ctr++)
tmp |= Smodes.at(ctr); tmp |= Smodes.at(ctr);
saveascii(tmp,opts.outputfname.value() + "_Smodes"); 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(){ inline void save_Tmodes(){
Matrix tmp = Tmodes.at(0); Matrix tmp = Tmodes.at(0);
for(unsigned int ctr = 1; ctr < Tmodes.size(); ctr++) for(unsigned int ctr = 1; ctr < Tmodes.size(); ctr++)
tmp |= Tmodes.at(ctr); tmp |= Tmodes.at(ctr);
saveascii(tmp,opts.outputfname.value() + "_Tmodes"); saveascii(tmp,opts.outputfname.value() + "_Tmodes");
} }
void set_TSmode(); void set_TSmode();
...@@ -111,12 +110,12 @@ namespace Melodic{ ...@@ -111,12 +110,12 @@ namespace Melodic{
inline Matrix& get_mix() {return mixMatrix;} inline Matrix& get_mix() {return mixMatrix;}
inline void set_mix(Matrix& Arg) { inline void set_mix(Matrix& Arg) {
mixMatrix = Arg; mixMatrix = Arg;
if (Tmodes.size() < 1) if (Tmodes.size() < 1)
for (int ctr = 1; ctr <= Arg.Ncols(); ctr++){ for (int ctr = 1; ctr <= Arg.Ncols(); ctr++){
Matrix tmp = Arg.Column(ctr); Matrix tmp = Arg.Column(ctr);
add_Tmodes(tmp); add_Tmodes(tmp);
} }
} }
Matrix expand_mix(); Matrix expand_mix();
...@@ -167,24 +166,24 @@ namespace Melodic{ ...@@ -167,24 +166,24 @@ namespace Melodic{
inline void set_after_mm(bool val) {after_mm = val;} inline void set_after_mm(bool val) {after_mm = val;}
inline void flipres(int num){ inline void flipres(int num){
IC.Row(num) = -IC.Row(num); IC.Row(num) = -IC.Row(num);
mixMatrix.Column(num) = -mixMatrix.Column(num); mixMatrix.Column(num) = -mixMatrix.Column(num);
mixFFT=calc_FFT(mixMatrix); mixFFT=calc_FFT(mixMatrix);
unmixMatrix = pinv(mixMatrix); unmixMatrix = pinv(mixMatrix);
if(ICstats.Storage()>0&&ICstats.Ncols()>3){ if(ICstats.Storage()>0&&ICstats.Ncols()>3){
double tmp; double tmp;
tmp = ICstats(num,3); tmp = ICstats(num,3);
ICstats(num,3) = -1.0*ICstats(num,4); ICstats(num,3) = -1.0*ICstats(num,4);
ICstats(num,4) = -1.0*tmp; ICstats(num,4) = -1.0*tmp;
} }
} }
void sort(); void sort();
volumeinfo tempInfo; volumeinfo tempInfo;
vector<Matrix> DWM, WM; vector<Matrix> DWM, WM;
basicGLM glmT, glmS;
private: private:
MelodicOptions &opts; MelodicOptions &opts;
...@@ -204,6 +203,7 @@ namespace Melodic{ ...@@ -204,6 +203,7 @@ namespace Melodic{
Matrix mixFFT; Matrix mixFFT;
Matrix IC; Matrix IC;
Matrix ICstats; Matrix ICstats;
Matrix Tdes, Tcon, TconF, Sdes, Scon, SconF;
vector<Matrix> Tmodes; vector<Matrix> Tmodes;
vector<Matrix> Smodes; vector<Matrix> Smodes;
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#include "melhlprfns.h" #include "melhlprfns.h"
#include "libprob.h" #include "libprob.h"
#include "miscmaths/miscprob.h" #include "miscmaths/miscprob.h"
#include "miscmaths/t2z.h"
#include "miscmaths/f2z.h"
namespace Melodic{ namespace Melodic{
...@@ -781,4 +783,52 @@ namespace Melodic{ ...@@ -781,4 +783,52 @@ namespace Melodic{
return res; return res;
} //Matrix gen_arCorr } //Matrix gen_arCorr
Matrix basicGLM::olsfit(const Matrix& data, const Matrix& design,
const Matrix& contrasts, int DOFadjust)
{
beta = zeros(design.Ncols(),1);
residu = zeros(1); sigsq = -1.0*ones(1); varcb = -1.0*ones(1);
t = zeros(1); z = zeros(1); p=-1.0*ones(1);
dof = (int)-1; cbeta = -1.0*ones(1);
if(data.Nrows()==design.Nrows()){
Matrix dat = remmean(data,1);
Matrix pinvdes = pinv(design);
beta = pinvdes * dat;
residu = dat - design*beta;
Matrix R = Identity(design.Nrows()) - design * pinvdes;
Matrix R2 = R*R;
float tR = R.Trace();
sigsq = sum(SP(residu,residu))/tR;
dof = (int)(tR*tR/R2.Trace() - DOFadjust);
float fact = float(design.Nrows() - 1 - design.Ncols()) / design.Ncols();
f_fmf = SP(var(design*beta),pow(var(residu),-1))* fact;
pf_fmf = f_fmf.Row(1); pf_fmf &= pf_fmf;
for(int ctr1=1;ctr1<=f_fmf.Ncols();ctr1++)
pf_fmf(1,ctr1) = 1.0-MISCMATHS::fdtr(design.Ncols(),
int(design.Nrows() -1 -design.Ncols()),f_fmf.Column(ctr1).AsScalar());
pf_fmf.Row(2) = pf_fmf.Row(1) * pf_fmf.Ncols();
if(contrasts.Storage()>0 && contrasts.Nrows()==beta.Ncols()){
cbeta = contrasts.t()*beta;
Matrix tmp = contrasts.t()*pinvdes*pinvdes.t()*contrasts;
varcb = diag(tmp)*sigsq;
t = SP(cbeta,pow(varcb,-0.5));
z = t; p=t;
for(int ctr1=1;ctr1<=t.Ncols();ctr1++){
ColumnVector tmp = t.Column(ctr1);
T2z::ComputeZStats(varcb.Column(ctr1),cbeta.Column(ctr1),dof, tmp);
z.Column(ctr1) << tmp;
T2z::ComputePs(varcb.Column(ctr1),cbeta.Column(ctr1),dof, tmp);
p.Column(ctr1) << exp(tmp);
}
}
}
return beta;
}
} }
...@@ -70,7 +70,44 @@ namespace Melodic{ ...@@ -70,7 +70,44 @@ namespace Melodic{
ColumnVector gen_ar(const ColumnVector& in, int maxorder = 1); ColumnVector gen_ar(const ColumnVector& in, int maxorder = 1);
Matrix gen_ar(const Matrix& in, int maxorder); Matrix gen_ar(const Matrix& in, int maxorder);
Matrix gen_arCorr(const Matrix& in, int maxorder); Matrix gen_arCorr(const Matrix& in, int maxorder);
class basicGLM
{
public:
//constructor
basicGLM(){}
//destructor
~basicGLM(){}
Matrix olsfit(const Matrix& data, const Matrix& design,
const Matrix& contrasts, int DOFadjust = 0);
inline Matrix& get_t(){return t;}
inline Matrix& get_z(){return z;}
inline Matrix& get_p(){return p;}
inline Matrix& get_f_fmf(){return f_fmf;}
inline Matrix& get_pf_fmf(){return pf_fmf;}
inline Matrix& get_cbeta(){return cbeta;}
inline Matrix& get_varcb(){return varcb;}
inline Matrix& get_sigsq(){return sigsq;}
inline Matrix& get_residu(){return residu;}
inline int get_dof(){return dof;}
private:
Matrix beta;
Matrix residu;
Matrix sigsq;
Matrix varcb;
Matrix cbeta;
Matrix f_fmf, pf_fmf;
int dof;
Matrix t;
Matrix z;
Matrix p;
};
// Matrix glm_ols(const Matrix& dat, const Matrix& design);
} }
#endif #endif
...@@ -499,7 +499,6 @@ write_ascii_matrix("Xim",Data.Row(1)); ...@@ -499,7 +499,6 @@ 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());
...@@ -511,18 +510,20 @@ write_ascii_matrix("Xim",Data.Row(1)); ...@@ -511,18 +510,20 @@ write_ascii_matrix("Xim",Data.Row(1));
scales = stdev(melodat.get_mix()); scales = stdev(melodat.get_mix());
// cerr << " SCALES 1 " << scales << endl; // cerr << " SCALES 1 " << scales << endl;
Matrix tmp; Matrix tmp, tmp2;
tmp = SP(melodat.get_mix(),ones(melodat.get_mix().Nrows(),1)*pow(scales,-1)); tmp = SP(melodat.get_mix(),ones(melodat.get_mix().Nrows(),1)*pow(scales,-1));
temp = SP(temp,scales.t()*ones(1,temp.Ncols())); temp = SP(temp,scales.t()*ones(1,temp.Ncols()));
scales = scales.t(); scales = scales.t();
melodat.set_mix(tmp); melodat.set_mix(tmp);
melodat.set_IC(temp); melodat.set_IC(temp);
melodat.set_ICstats(scales); melodat.set_ICstats(scales);
melodat.sort(); melodat.sort();
melodat.set_TSmode(); melodat.set_TSmode();
} }
} }
} }
......
...@@ -56,7 +56,6 @@ void mmonly(Log& logger, MelodicOptions& opts, ...@@ -56,7 +56,6 @@ void mmonly(Log& logger, MelodicOptions& opts,
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
try{ try{
// Setup logging: // Setup logging:
Log& logger = LogSingleton::getInstance(); Log& logger = LogSingleton::getInstance();
...@@ -67,16 +66,16 @@ int main(int argc, char *argv[]) ...@@ -67,16 +66,16 @@ int main(int argc, char *argv[])
//set up data object //set up data object
MelodicData melodat(opts,logger); MelodicData melodat(opts,logger);
//set up report object
MelodicReport report(melodat,opts,logger); MelodicReport report(melodat,opts,logger);
if (opts.filtermode || opts.filtermix.value().length()>0){ if (opts.filtermode || opts.filtermix.value().length()>0){
if(opts.filtermode){ // just filter out some noise from a previous run if(opts.filtermode){ // just filter out some noise from a previous run
melodat.setup(); melodat.setup();
melodat.remove_components(); melodat.remove_components();
} }
else else
mmonly(logger,opts,melodat,report); mmonly(logger,opts,melodat,report);
} }
else else
{ // standard PICA now { // standard PICA now
...@@ -84,105 +83,100 @@ int main(int argc, char *argv[]) ...@@ -84,105 +83,100 @@ int main(int argc, char *argv[])
bool no_conv; bool no_conv;
bool leaveloop = false; bool leaveloop = false;
// melodat.setup2();
melodat.setup(); melodat.setup();
do{ do{
//do PCA pre-processing //do PCA pre-processing
MelodicPCA pcaobj(melodat,opts,logger,report); MelodicPCA pcaobj(melodat,opts,logger,report);
pcaobj.perf_pca(); pcaobj.perf_pca();
pcaobj.perf_white(); pcaobj.perf_white();
//do ICA //do ICA
MelodicICA icaobj(melodat,opts,logger,report); MelodicICA icaobj(melodat,opts,logger,report);
icaobj.perf_ica(melodat.get_white()*melodat.get_Data()); icaobj.perf_ica(melodat.get_white()*melodat.get_Data());
no_conv = icaobj.no_convergence; no_conv = icaobj.no_convergence;
opts.maxNumItt.set_T(500); opts.maxNumItt.set_T(500);
if((opts.approach.value()=="symm")&& if((opts.approach.value()=="symm")&&
(retry > std::min(opts.retrystep,3))){ (retry > std::min(opts.retrystep,3))){
if(no_conv){ if(no_conv){
retry++; retry++;
opts.approach.set_T("defl"); opts.approach.set_T("defl");
message(endl << "Restarting MELODIC using deflation approach" message(endl << "Restarting MELODIC using deflation approach"
<< endl << endl); << endl << endl);
} }
else{ else{
leaveloop = true; leaveloop = true;
} }
} }
else{ else{
if(no_conv){ if(no_conv){
retry++; retry++;
if(opts.pca_dim.value()-retry*opts.retrystep > if(opts.pca_dim.value()-retry*opts.retrystep >
0.1*melodat.data_dim()){ 0.1*melodat.data_dim()){
opts.pca_dim.set_T(opts.pca_dim.value()-retry*opts.retrystep); opts.pca_dim.set_T(opts.pca_dim.value()-retry*opts.retrystep);
} }
else{ else{
if(opts.pca_dim.value()-retry*opts.retrystep < melodat.data_dim()){ if(opts.pca_dim.value()-retry*opts.retrystep < melodat.data_dim()){
opts.pca_dim.set_T(opts.pca_dim.value()+retry*opts.retrystep); opts.pca_dim.set_T(opts.pca_dim.value()+retry*opts.retrystep);
}else{ }else{
leaveloop = true; //stupid, but break does not compile leaveloop = true; //stupid, but break does not compile
//on all platforms //on all platforms
} }
} }
if(!leaveloop){ if(!leaveloop){
message(endl << "Restarting MELODIC using -d " message(endl << "Restarting MELODIC using -d "
<< opts.pca_dim.value() << opts.pca_dim.value()
<< endl << endl); << endl << endl);
} }
} }
} }
} while (no_conv && retry<opts.maxRestart.value() && !leaveloop); } while (no_conv && retry<opts.maxRestart.value() && !leaveloop);
if(!no_conv){ if(!no_conv){
//save raw IC results //save raw IC results
melodat.save(); melodat.save();
Matrix pmaps;//(melodat.get_IC());
Matrix pmaps;//(melodat.get_IC()); Matrix mmres;
Matrix mmres;
if(opts.perf_mm.value())
if(opts.perf_mm.value()) mmres = mmall(logger,opts,melodat,report,pmaps);
mmres = mmall(logger,opts,melodat,report,pmaps); else{
else{ if( bool(opts.genreport.value()) ){
if( bool(opts.genreport.value()) ){ message(endl
message(endl << "Creating web report in " << report.getDir()
<< "Creating web report in " << report.getDir() << " " << endl);
<< " " << endl); for(int ctr=1; ctr<= melodat.get_IC().Nrows(); ctr++){
for(int ctr=1; ctr<= melodat.get_IC().Nrows(); ctr++){ string prefix = "IC_"+num2str(ctr);
string prefix = "IC_"+num2str(ctr); message(" " << ctr);
message(" " << ctr); report.IC_simplerep(prefix,ctr,melodat.get_IC().Nrows());
report.IC_simplerep(prefix,ctr,melodat.get_IC().Nrows()); }
}
message(endl << endl <<
" To view the output report point your web browser at " <<
report.getDir() + "/00index.html" << endl<< endl);
message(endl << endl << }
" To view the output report point your web browser at " << }
report.getDir() + "/00index.html" << endl<< endl);
} if( bool(opts.genreport.value()) ){
} report.analysistxt();
report.PPCA_rep();
if( bool(opts.genreport.value()) ){ }
report.analysistxt();
report.PPCA_rep(); message("finished!" << endl << endl);
} }
else {
message("finished!" << endl << endl); message(endl <<"No convergence -- giving up " << endl << endl);
} else {
message(endl <<"No convergence -- giving up " << endl << endl);
} }
} }
} }
catch(Exception e) catch(Exception e) {
{
cerr << endl << e.what() << endl; cerr << endl << e.what() << endl;
} }
catch(X_OptionError& e) catch(X_OptionError& e) {
{
cerr << endl << e.what() << endl; cerr << endl << e.what() << endl;
} }
return 0; return 0;
} }
...@@ -271,7 +265,7 @@ void mmonly(Log& logger, MelodicOptions& opts, ...@@ -271,7 +265,7 @@ void mmonly(Log& logger, MelodicOptions& opts,
melodat.set_mean(Mean); melodat.set_mean(Mean);
melodat.set_IC(ICs); melodat.set_IC(ICs);
melodat.set_mix(mixMatrix); melodat.set_mix(mixMatrix);
fmixMatrix = calc_FFT(mixMatrix, opts.logPower.value()); fmixMatrix = calc_FFT(melodat.expand_mix(), opts.logPower.value());
melodat.set_fmix(fmixMatrix); melodat.set_fmix(fmixMatrix);
fmixMatrix = pinv(mixMatrix); fmixMatrix = pinv(mixMatrix);
melodat.set_unmix(fmixMatrix); melodat.set_unmix(fmixMatrix);
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
namespace Melodic{ namespace Melodic{
const string version = "3.0 alpha 1"; const string version = "3.0 beta";
} }
......
...@@ -64,11 +64,7 @@ MelodicOptions* MelodicOptions::gopt = NULL; ...@@ -64,11 +64,7 @@ MelodicOptions* MelodicOptions::gopt = NULL;
} }
if(! options.check_compulsory_arguments()) if(! options.check_compulsory_arguments())
{ {
print_version(); print_usage(argc, argv);
cout << endl;
cout << "Usage: melodic <options> -i <filename>" << endl <<
"Please specify input file name correctly or try melodic --help"
<< endl << endl;
exit(2); exit(2);
} }
...@@ -173,8 +169,8 @@ MelodicOptions* MelodicOptions::gopt = NULL; ...@@ -173,8 +169,8 @@ MelodicOptions* MelodicOptions::gopt = NULL;
while (!fs.eof()) { while (!fs.eof()) {
getline(fs,cline); getline(fs,cline);
if(cline.length()>0) if(cline.length()>0)
tmpfnames.push_back(cline); tmpfnames.push_back(cline);
} }
fs.close(); fs.close();
inputfname.set_T(tmpfnames); inputfname.set_T(tmpfnames);
} }
...@@ -211,7 +207,7 @@ MelodicOptions* MelodicOptions::gopt = NULL; ...@@ -211,7 +207,7 @@ MelodicOptions* MelodicOptions::gopt = NULL;
void MelodicOptions::print_usage(int argc, char *argv[]) void MelodicOptions::print_usage(int argc, char *argv[])
{ {
print_version(); print_copyright();
options.usage(); options.usage();
/* cout << "Usage: " << argv[0] << " "; /* cout << "Usage: " << argv[0] << " ";
...@@ -221,14 +217,14 @@ void MelodicOptions::print_usage(int argc, char *argv[]) ...@@ -221,14 +217,14 @@ void MelodicOptions::print_usage(int argc, char *argv[])
void MelodicOptions::print_version() void MelodicOptions::print_version()
{ {
cout << "MELODIC Version " << version; cout << endl <<"MELODIC Version " << version;
cout.flush(); cout.flush();
} }
void MelodicOptions::print_copyright() void MelodicOptions::print_copyright()
{ {
print_version(); print_version();
cout << endl << "Copyright (C) 1999-2002 University of Oxford " << endl; cout << endl << "Copyright (C) 1999-2007 University of Oxford " << endl;
cout.flush(); cout.flush();
} }
......
...@@ -80,6 +80,13 @@ class MelodicOptions { ...@@ -80,6 +80,13 @@ class MelodicOptions {
Option<float> tr; Option<float> tr;
Option<bool> logPower; Option<bool> logPower;
Option<string> fn_Tdesign;
Option<string> fn_Tcon;
Option<string> fn_TconF;
Option<string> fn_Sdesign;
Option<string> fn_Scon;
Option<string> fn_SconF;
Option<bool> output_all; Option<bool> output_all;
Option<bool> output_unmix; Option<bool> output_unmix;
Option<bool> output_MMstats; Option<bool> output_MMstats;
...@@ -103,7 +110,6 @@ class MelodicOptions { ...@@ -103,7 +110,6 @@ class MelodicOptions {
Option<float> nlconst2; Option<float> nlconst2;
Option<float> smooth_probmap; Option<float> smooth_probmap;
Option<bool> remove_meanvol; Option<bool> remove_meanvol;
Option<bool> remove_endslices; Option<bool> remove_endslices;
Option<bool> rescale_nht; Option<bool> rescale_nht;
...@@ -186,7 +192,7 @@ class MelodicOptions { ...@@ -186,7 +192,7 @@ class MelodicOptions {
varnorm(string("--vn,--varnorm"), true, varnorm(string("--vn,--varnorm"), true,
string("switch off variance normalisation"), string("switch off variance normalisation"),
false, no_argument), false, no_argument),
pbsc(string("--pbsc"), true, pbsc(string("--pbsc"), false,
string("switch off conversion to percent BOLD signal change"), string("switch off conversion to percent BOLD signal change"),
false, no_argument), false, no_argument),
pspec(string("--pspec"), false, pspec(string("--pspec"), false,
...@@ -207,7 +213,7 @@ class MelodicOptions { ...@@ -207,7 +213,7 @@ class MelodicOptions {
maxRestart(string("--maxrestart"), 6, maxRestart(string("--maxrestart"), 6,
string("maximum number of restarts\n"), string("maximum number of restarts\n"),
false, requires_argument), false, requires_argument),
rank1interval(string("--rank1interval"), 30, rank1interval(string("--rank1interval"), 5,
string("number of iterations between rank-1 approximation (TICA)\n"), string("number of iterations between rank-1 approximation (TICA)\n"),
false, requires_argument,false), false, requires_argument,false),
mmthresh(string("--mmthresh"), string("0.5"), mmthresh(string("--mmthresh"), string("0.5"),
...@@ -237,6 +243,24 @@ class MelodicOptions { ...@@ -237,6 +243,24 @@ class MelodicOptions {
logPower(string("--logPower"), false, logPower(string("--logPower"), false,
string("calculate log of power for frequency spectrum\n"), string("calculate log of power for frequency spectrum\n"),
false, no_argument), false, no_argument),
fn_Tdesign(string("--Tdes"), string(""),
string("design matrix across time-domain"),
false, requires_argument),
fn_Tcon(string("--Tcon"), string(""),
string("t-contrast matrix across time-domain"),
false, requires_argument),
fn_TconF(string("--Tconf"), string(""),
string("F-contrast matrix across time-domain"),
false, requires_argument),
fn_Sdesign(string("--Sdes"), string(""),
string("design matrix across subject-domain"),
false, requires_argument),
fn_Scon(string("--Scon"), string(""),
string("t-contrast matrix across subject-domain"),
false, requires_argument),
fn_SconF(string("--Sconf"), string(""),
string("F-contrast matrix across subject-domain"),
false, requires_argument),
output_all(string("--Oall"), false, output_all(string("--Oall"), false,
string("output everything"), string("output everything"),
false, no_argument), false, no_argument),
...@@ -356,6 +380,12 @@ class MelodicOptions { ...@@ -356,6 +380,12 @@ class MelodicOptions {
options.add(genreport); options.add(genreport);
options.add(tr); options.add(tr);
options.add(logPower); options.add(logPower);
options.add(fn_Tdesign);
options.add(fn_Tcon);
options.add(fn_TconF);
options.add(fn_Sdesign);
options.add(fn_Scon);
options.add(fn_SconF);
options.add(output_all); options.add(output_all);
options.add(output_unmix); options.add(output_unmix);
options.add(output_MMstats); options.add(output_MMstats);
......
This diff is collapsed.
...@@ -37,18 +37,23 @@ int do_work(int argc, char* argv[]) ...@@ -37,18 +37,23 @@ int do_work(int argc, char* argv[])
{ {
Matrix mat; Matrix mat;
mat = normrnd(300,(int)num.value())+2;
cout << "BLAH " << num.value() << endl; cout << "BLAH " << num.value() << endl;
for (int i=1; i <= (int)num.value();i++){ mat=normrnd(300,1);
miscplot::Timeseries(mat.t(),string("test0.png"),string("TEST"));
for (int i=1; i <= (int)num.value();i++){
cout << "Processing " << i << endl; cout << "Processing " << i << endl;
miscplot newplot; miscplot newplot;
ColumnVector col; newplot.GDCglobals_set();
col = mat.Column(i); mat = normrnd(300,3)+2;
newplot.add_bpdata(col); Matrix col;
newplot.boxplot(string("test")+num2str(i)+string(".png"),string("TEST")); col = mat;
newplot.add_bpdata(col);
// newplot.add_bpdata(col);
newplot.boxplot(string("test")+num2str(i)+string(".png"),string("TEST"));
} }
return 0; return 0;
} }
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
......
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