-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTensorData.h
61 lines (51 loc) · 1.83 KB
/
TensorData.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma once
#include "volumedata.h"
#include "armadillo"
using namespace arma;
typedef struct
{
float D [6];
float fa;
float d0 [3];
}Tensor;
class TensorData :
public VolumeData
{
public:
TensorData(void);
~TensorData(void);
private:
int _nAcquisition;
double * _bTable;
Tensor * _tensorField;
int _noiseSignalThres;
bool _bInterpolate;
public:
virtual int readOrientedData (const QStringList & fileList, const QString & dtiFileName = "");
virtual void getSagittalSlice ();
virtual void getCoronalSlice ();
virtual void getAxialSlice ();
virtual void setInfoStr();
void setNoiseSignalThres (int t) {_noiseSignalThres = t;}
void setInterpolate (bool bSet);
int readBTable (const QStringList & fileList);
int getTensorField ();
static void getTensorField (const unsigned * data, int nPixel, int nAcquisition, const double * bTable, int nsThres, Tensor * tensorField);
static void getTensorField (const unsigned * data, int nPixel, int nAcquisition, const double * bTable, int nsThres, const fmat & G, Tensor * tensorField);
void saveTensorField (const QString & fileName);
void loadTensorField (const QString & fileName);
Tensor getTensorAt (int x, int y, int z) const;
Tensor getTensorAt (double x, double y, double z) const;
static void test ();
private:
unsigned long getIndex (int x, int y, int z, int n);
unsigned getData (int x, int y, int z, int n);
unsigned getData (double x, double y, double z, int n);
void removeRedundantData ();
};
fmat tensorLog (const Tensor &t);
fmat tensorLog (const fmat &tMat);
fmat tensorExp (const fmat &tMat);
fmat tensorLinearInterp (double w1, const Tensor & t1, double w2, const Tensor & t2);
fmat tensorLinearInterp (double w1, const fmat & tMat1, double w2, const fmat & tMat2);
Tensor getTensorFromMat (const fmat & tMat);