Skip to content
Snippets Groups Projects
Commit 68bb6176 authored by Matthew Webster's avatar Matthew Webster
Browse files

in progress newimage conversion: DO NOT TAG STABLE

parent c92f1d66
No related branches found
No related tags found
No related merge requests found
...@@ -138,11 +138,10 @@ int main(int argc,char *argv[]) ...@@ -138,11 +138,10 @@ int main(int argc,char *argv[])
ColumnVector zs(numTS); ColumnVector zs(numTS);
F2z::ComputeFStats(fs, dof1, dof2, zs); F2z::ComputeFStats(fs, dof1, dof2, zs);
input.set_intent(NIFTI_INTENT_ZSCORE,0,0,0);
input.setmatrix(zs.AsRow()); input.setmatrix(zs.AsRow());
FslSetCalMinMax(&vinfo,input.min(),input.max()); FslSetCalMinMax(&vinfo,input.min(),input.max());
input.set_intent(NIFTI_INTENT_ZSCORE,0,0,0);
save_volume4D(input,globalopts.zscoresfname,vinfo); save_volume4D(input,globalopts.zscoresfname,vinfo);
} }
catch(Exception p_excp) catch(Exception p_excp)
......
...@@ -9,24 +9,24 @@ ...@@ -9,24 +9,24 @@
#include <sstream> #include <sstream>
#include "glim.h" #include "glim.h"
#include "miscmaths/miscmaths.h"
#include "utils/log.h" #include "utils/log.h"
#include "miscmaths/volume.h" #include "newimage/newimageall.h"
#ifndef NO_NAMESPACE #ifndef NO_NAMESPACE
using namespace MISCMATHS; using namespace MISCMATHS;
using namespace Utilities; using namespace Utilities;
using namespace NEWIMAGE;
namespace FILM { namespace FILM {
#endif #endif
Glim::Glim(VolumeSeries& p_y, const Matrix& p_x): Glim::Glim(Matrix& p_y, const Matrix& p_x):
y(p_y), y(p_y),
x(p_x), x(p_x),
numTS(p_y.Ncols()), numTS(p_y.Ncols()),
sizeTS(p_y.Nrows()), sizeTS(p_y.Nrows()),
numParams(p_x.Ncols()), numParams(p_x.Ncols()),
r(sizeTS, numTS, p_y.getInfo(), p_y.getPreThresholdPositions()), r(sizeTS, numTS),
pinv_x(p_x.Ncols(), sizeTS), pinv_x(p_x.Ncols(), sizeTS),
V(sizeTS,sizeTS), V(sizeTS,sizeTS),
RV(sizeTS,sizeTS), RV(sizeTS,sizeTS),
...@@ -39,32 +39,26 @@ namespace FILM { ...@@ -39,32 +39,26 @@ namespace FILM {
{ {
} }
void Glim::Save() void Glim::Save(const volume<float>& mask,volumeinfo vinfo)
{ {
// Need to save b, sigmaSquareds, corrections and dof // Need to save b, sigmaSquareds, corrections and dof
Log& logger = LogSingleton::getInstance(); Log& logger = LogSingleton::getInstance();
// b: volume4D<float> output;
Volume peVol;
for(int i = 1; i <= numParams; i++) for(int i = 1; i <= numParams; i++)
{ {
peVol = b.Row(i).AsColumn();
peVol.setInfo(y.getInfo());
peVol.setPreThresholdPositions(y.getPreThresholdPositions());
peVol.unthreshold();
// Add param number to "pe" to create filename:
ostringstream osc; ostringstream osc;
osc << i; osc << i;
output.setmatrix(b.Row(i),mask);
peVol.writeAsFloat(logger.getDir() + "/pe" + osc.str().c_str()); FslSetCalMinMax(&vinfo,output.min(),output.max());
save_volume4D(output,logger.getDir() + "/pe" + osc.str().c_str(),vinfo);
} }
// sigmaSquareds: output.setmatrix(sigmaSquareds.AsRow(),mask);
sigmaSquareds.setInfo(y.getInfo()); FslSetCalMinMax(&vinfo,output.min(),output.max());
sigmaSquareds.setPreThresholdPositions(y.getPreThresholdPositions()); save_volume4D(output,logger.getDir() + "/sigmasquareds",vinfo);
sigmaSquareds.unthreshold();
sigmaSquareds.writeAsFloat(logger.getDir() + "/sigmasquareds");
// dof: // dof:
ColumnVector dofVec(1); ColumnVector dofVec(1);
...@@ -76,7 +70,7 @@ namespace FILM { ...@@ -76,7 +70,7 @@ namespace FILM {
} }
// Called on entire data set: // Called on entire data set:
VolumeSeries& Glim::ComputeResids() Matrix& Glim::ComputeResids()
{ {
Tracer ts("ComputeResids"); Tracer ts("ComputeResids");
......
...@@ -11,13 +11,12 @@ ...@@ -11,13 +11,12 @@
#define WANT_STREAM #define WANT_STREAM
#define WANT_MATH #define WANT_MATH
#include "newmatap.h" #include "miscmaths/miscmaths.h"
#include "newmatio.h" #include "newimage/newimageall.h"
#include "miscmaths/volumeseries.h"
#include "miscmaths/volume.h"
using namespace NEWMAT; using namespace NEWMAT;
using namespace MISCMATHS; using namespace MISCMATHS;
using namespace NEWIMAGE;
namespace FILM{ namespace FILM{
#if !defined(__glim_h) #if !defined(__glim_h)
...@@ -28,11 +27,11 @@ namespace FILM{ ...@@ -28,11 +27,11 @@ namespace FILM{
class Glim class Glim
{ {
public: public:
Glim(VolumeSeries& p_y, const Matrix& p_x); Glim(Matrix& p_y, const Matrix& p_x);
void Save(); void Save(const volume<float>& mask,volumeinfo vinfo);
VolumeSeries& ComputeResids(); Matrix& ComputeResids();
void ComputePes(); void ComputePes();
void SetVrow(const ColumnVector& p_vrow, const int ind); void SetVrow(const ColumnVector& p_vrow, const int ind);
void SetGlobalVrow(const ColumnVector& p_vrow); void SetGlobalVrow(const ColumnVector& p_vrow);
...@@ -46,17 +45,17 @@ namespace FILM{ ...@@ -46,17 +45,17 @@ namespace FILM{
void SetCorrection(const Matrix& corr, const int ind); void SetCorrection(const Matrix& corr, const int ind);
void ConstructV(const ColumnVector& p_vrow); void ConstructV(const ColumnVector& p_vrow);
void setData(VolumeSeries& p_y) { y = p_y; } void setData(Matrix& p_y) { y = p_y; }
// y = bx + r // y = bx + r
VolumeSeries& y; Matrix& y;
const Matrix& x; const Matrix& x;
int numTS; int numTS;
int sizeTS; int sizeTS;
int numParams; int numParams;
VolumeSeries r; Matrix r;
Matrix pinv_x; Matrix pinv_x;
Matrix V; Matrix V;
Matrix RV; Matrix RV;
...@@ -67,7 +66,7 @@ namespace FILM{ ...@@ -67,7 +66,7 @@ namespace FILM{
// Data to be saved: // Data to be saved:
Matrix corrections; Matrix corrections;
Matrix b; Matrix b;
Volume sigmaSquareds; ColumnVector sigmaSquareds;
float dof; float dof;
}; };
......
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