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