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

changes to ftoz and ttoz to allow for voxel-specific dofs

parent a17b92cb
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@
#include <fstream>
#define WANT_STREAM
#define WANT_MATH
#include "fslio/fslio.h"
#include "newmatap.h"
#include "newmatio.h"
......@@ -26,8 +27,8 @@ using namespace MISCMATHS;
class globaloptions {
public:
string fsfname;
int dof1;
int dof2;
string doffile1;
string doffile2;
string zscoresfname;
public:
......@@ -73,9 +74,9 @@ void parse_command_line(int argc, char* argv[])
if(inp == 1)
globalopts.fsfname = arg;
else if(inp == 2)
globalopts.dof1 = atoi(argv[n]);
globalopts.doffile1 = argv[n];
else if(inp == 3)
globalopts.dof2 = atoi(argv[n]);
globalopts.doffile2 = argv[n];
else
{
cerr << "Mismatched argument " << arg << endl;
......@@ -126,8 +127,27 @@ int main(int argc,char *argv[])
int numTS = fs.Nrows();
cerr << numTS << endl;
Volume dof1, dof2;
if(FslFileExists(globalopts.doffile1.c_str())){ //dof1 is avw file
dof1.read(globalopts.doffile1);
}
else {
dof1 = fs;
dof1 = atof(globalopts.doffile1.c_str());
}
if(FslFileExists(globalopts.doffile2.c_str())){ //dof2 is avw file
dof2.read(globalopts.doffile2);
}
else {
dof2 = fs;
dof2 = atof(globalopts.doffile2.c_str());
}
Volume zs(numTS);
F2z::ComputeFStats(fs, globalopts.dof1, globalopts.dof2, zs);
F2z::ComputeFStats(fs, dof1, dof2, zs);
VolumeInfo volinfo = fs.getInfo();
volinfo.intent_code = NIFTI_INTENT_ZSCORE;
......
......@@ -10,6 +10,7 @@
#include <fstream>
#define WANT_STREAM
#define WANT_MATH
#include "fslio/fslio.h"
#include "newmatap.h"
#include "newmatio.h"
......@@ -28,7 +29,7 @@ class globaloptions {
public:
string varsfname;
string cbsfname;
int dof;
string doffile;
string zscoresfname;
public:
......@@ -76,7 +77,7 @@ void parse_command_line(int argc, char* argv[])
else if(inp == 2)
globalopts.cbsfname = arg;
else if(inp == 3)
globalopts.dof = atoi(argv[n]);
globalopts.doffile = arg;
else
{
cerr << "Mismatched argument " << arg << endl;
......@@ -121,15 +122,23 @@ int main(int argc,char *argv[])
try{
parse_command_line(argc, argv);
Volume vars, cbs;
Volume vars, cbs, dofs;
vars.read(globalopts.varsfname.c_str());
cbs.read(globalopts.cbsfname.c_str());
int numTS = vars.Nrows();
cerr << numTS << endl;
// cerr << numTS << endl;
if(FslFileExists(globalopts.doffile.c_str())){ //dof1 is avw file
dofs.read(globalopts.doffile);
}
else {
dofs = vars;
dofs = atof(globalopts.doffile.c_str());
}
Volume zs(numTS);
T2z::ComputeZStats(vars, cbs, globalopts.dof, zs);
T2z::ComputeZStats(vars, cbs, dofs, zs);
VolumeInfo volinfo = vars.getInfo();
volinfo.intent_code = NIFTI_INTENT_ZSCORE;
......
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