-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVectorVis.h
More file actions
117 lines (95 loc) · 3.38 KB
/
Copy pathVectorVis.h
File metadata and controls
117 lines (95 loc) · 3.38 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#ifndef IMAGE_VECTORVIS_H
#define IMAGE_VECTORVIS_H
namespace sofa
{
namespace defaulttype
{
/**
* Holds data regarding visualization of vector data so that it can be accessed and manipulated by the VectorVisualizationDataWidget
*/
class VectorVis
{
protected:
/**
* One shape is drawn every subsampleXY values in both the X plane and the Y plane. So, as subsampleXY is increased, the density of the shapes decreases.
*/
int subsampleXY;
/**
* One shape is drawn every subsampleZ values in Z plane. So, as subsampleZ is increased, the density of the shapes decreases.
*/
int subsampleZ;
/**
* The size of the shape is multiplied by this value before it is drawn.
*/
int shapeScale;
/**
* When true, a 3 channel image is displayed as an RGB image. When false, the image is displayed in greyscale, with the value being the norm of the 3 channels.
*/
bool rgb;
/**
* When true, a shape is drawn representing the data. In a 3 channel image, that shape is an arrow, and in a 6 channel image, the shape is an ellipsoid.
*/
bool shape;
/**
* Specifies the order that tensor information is encoded. Possible values are LowerTriRowMajor, UpperTriRowMajor, DiagonalFirst
*/
std::string tensorOrder;
public:
static const char* Name() { return "Vectors";}
VectorVis(int _subsampleXY=5, int _subsampleZ=5, int _shapeScale=10, bool _rgb=true, bool _shape=false, std::string _tensorOrder="LowerTriRowMajor")
:subsampleXY(_subsampleXY), subsampleZ(_subsampleZ), shapeScale(_shapeScale), rgb(_rgb), shape(_shape), tensorOrder(_tensorOrder)
{ }
/**
* @name Accessor/Getter functions
*/
/**@{*/
int getSubsampleXY() const { return subsampleXY; }
int getSubsampleZ() const { return subsampleZ; }
int getShapeScale() const {return shapeScale; }
bool getRgb() const {return rgb; }
bool getShape() const {return shape;}
std::string getTensorOrder() const {return tensorOrder;}
/**@}*/
/**
* @name Mutator/Setter functions
*/
/**@{*/
void setSubsampleXY(int _subsampleXY) { subsampleXY = _subsampleXY; }
void setSubsampleZ(int _subsampleZ) {subsampleZ = _subsampleZ; }
void setShapeScale(int scale) { shapeScale = scale; }
void setRgb(bool _rgb) {rgb = _rgb;}
void setShape(bool vis) { shape = vis; }
void setTensorOrder(std::string _tensorOrder) { tensorOrder = _tensorOrder;}
/**@}*/
/**
* Stream operator that allows data to be recieved from the GUI
*/
inline friend std::istream& operator >> (std::istream& in, VectorVis& v)
{
int subsampleXY;
int subsampleZ;
int shapeScale;
bool rgb;
bool shape;
std::string tensorOrder;
in >> subsampleXY >> subsampleZ >> shapeScale >> rgb >> shape >> tensorOrder;
v.setSubsampleXY(subsampleXY);
v.setSubsampleZ(subsampleZ);
v.setShapeScale(shapeScale);
v.setRgb(rgb);
v.setShape(shape);
v.setTensorOrder(tensorOrder);
return in;
}
/**
* Stream operator that allows data to be sent to the GUI
*/
friend std::ostream& operator << (std::ostream& out, const VectorVis& v)
{
out << v.getSubsampleXY() << v.getSubsampleZ() << v.getShapeScale() << v.getRgb() << v.getShape() << v.getTensorOrder() ;
return out;
}
};
}
}
#endif //IMAGE_VECTORVIS_H