/* contrast_mgr.cc Mark Woolrich, FMRIB Image Analysis Group Copyright (C) 1999-2000 University of Oxford */ /* CCOPYRIGHT */ #include <iostream> #include <fstream> #include <strstream> #define WANT_STREAM #define WANT_MATH #include "newmatap.h" #include "newmatio.h" #include "VolumeSeries.h" #include "Volume.h" #include "ContrastMgr.h" #include "sigproc.h" #include "miscmaths.h" #include "Log.h" #include "paradigm.h" #include "ContrastMgrOptions.h" #include <string> #ifndef NO_NAMESPACE using namespace NEWMAT; using namespace SIGPROC; using namespace TACO; using namespace UTILS; #endif int main(int argc, char *argv[]) { try{ // parse command line to find out directory name for logging: ofstream out2; ContrastMgrOptions& globalopts = ContrastMgrOptions::getInstance(); globalopts.parse_command_line(argc, argv, out2); // Setup logging: Log& logger = Log::getInstance(); logger.setLogFile("contrastlogfile"); logger.setDir(globalopts.datadir); // parse command line again to output arguments to logfile globalopts.parse_command_line(argc, argv, logger.str()); // Load contrasts: Paradigm parad; parad.load("", globalopts.contrastfname, false, 0); if(globalopts.verbose) { logger.str() << "Contrast:" << endl << parad.getContrasts(); } ContrastMgr conMgr(parad.getContrasts()); cerr << "Loading data..."; conMgr.Load(); cerr << " Completed" << endl; // Loop through contrasts: for(int c = 1; c <= parad.getContrasts().Nrows(); c++) { cerr << "Computing data..."; conMgr.SetContrast(c, c+globalopts.copenumber-1); conMgr.ComputeNeff(false); conMgr.ComputeCope(); conMgr.ComputeVarCope(); conMgr.ComputeZStat(); cerr << " Completed" << endl; cerr << "Saving data..."; conMgr.Save(globalopts.suffix); cerr << " Completed" << endl; } } catch(Exception p_excp) { cerr << p_excp.what() << endl; } catch(...) { cerr << "Image error" << endl; } return 0; }