-
Notifications
You must be signed in to change notification settings - Fork 12
/
bag_vrnodedescriptor.cpp
178 lines (155 loc) · 4.13 KB
/
bag_vrnodedescriptor.cpp
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#include "bag_exceptions.h"
#include "bag_private.h"
#include "bag_vrnodedescriptor.h"
namespace BAG {
//! Constructor.
/*!
\param id
The unique layer id.
\param chunkSize
The chunk size the HDF5 DataSet will use.
\param compressionLevel
The compression level the HDF5 DataSet will use.
*/
VRNodeDescriptor::VRNodeDescriptor(
uint32_t id,
uint64_t chunkSize,
int compressionLevel)
: LayerDescriptor(id, VR_NODE_PATH,
kLayerTypeMapString.at(VarRes_Node), VarRes_Node, chunkSize,
compressionLevel)
{
}
//! Constructor.
/*!
\param dataset
The BAG Dataset this layer belongs to.
*/
VRNodeDescriptor::VRNodeDescriptor(
const Dataset& dataset)
: LayerDescriptor(dataset, VarRes_Node, VR_NODE_PATH)
{
}
//! Create a mew variable resolution node.
/*!
\param dataset
The BAG Dataset this layer belongs to.
\param chunkSize
The chunk size the HDF5 DataSet will use.
\param compressionLevel
The compression level the HDF5 DataSet will use.
\return
A new variable resolution node layer.
*/
std::shared_ptr<VRNodeDescriptor> VRNodeDescriptor::create(
const Dataset& dataset,
uint64_t chunkSize,
int compressionLevel)
{
return std::shared_ptr<VRNodeDescriptor>(
new VRNodeDescriptor{dataset.getNextId(), chunkSize,
compressionLevel});
}
//! Open an existing variable resolution node.
/*!
\param dataset
The BAG Dataset this layer belongs to.
*/
std::shared_ptr<VRNodeDescriptor> VRNodeDescriptor::open(
const Dataset& dataset)
{
return std::shared_ptr<VRNodeDescriptor>(
new VRNodeDescriptor{dataset});
}
//! \copydoc LayerDescriptor::getDataType
DataType VRNodeDescriptor::getDataTypeProxy() const noexcept
{
return DT_COMPOUND;
}
//! \copydoc LayerDescriptor::getElementSize
uint8_t VRNodeDescriptor::getElementSizeProxy() const noexcept
{
return sizeof(BagVRNodeItem);
}
//! Retrieve the minimum and maximum hypotheses strength.
/*!
\return
The minimum and maximum hypotheses strength.
*/
std::tuple<float, float>
VRNodeDescriptor::getMinMaxHypStrength() const noexcept
{
return {m_minHypStrength, m_maxHypStrength};
}
//! Retrieve the minimum and maximum n samples.
/*!
\return
The minimum and maximum n samples.
*/
std::tuple<uint32_t, uint32_t>
VRNodeDescriptor::getMinMaxNSamples() const noexcept
{
return {m_minNSamples, m_maxNSamples};
}
//! Retrieve the minimum and maximum number of hypotheses.
/*!
\return
The minimum and maximum number of hypotheses.
*/
std::tuple<uint32_t, uint32_t>
VRNodeDescriptor::getMinMaxNumHypotheses() const noexcept
{
return {m_minNumHypotheses, m_maxNumHypotheses};
}
//! Set the minimum and maximum hypotheses strength.
/*!
\param minHypStrength
The minimum hypotheses strength.
\param maxHypStrength
The maximum hypotheses strength.
\return
The variable resolution node descriptor.
*/
VRNodeDescriptor& VRNodeDescriptor::setMinMaxHypStrength(
float minHypStrength,
float maxHypStrength) & noexcept
{
m_minHypStrength = minHypStrength;
m_maxHypStrength = maxHypStrength;
return *this;
}
//! Set the minimum and maximum number of samples.
/*!
\param minNSamples
The minimum number of samples.
\param maxNSamples
The maximum number of samples.
\return
The variable resolution node descriptor.
*/
VRNodeDescriptor& VRNodeDescriptor::setMinMaxNSamples(
uint32_t minNSamples,
uint32_t maxNSamples) & noexcept
{
m_minNSamples = minNSamples;
m_maxNSamples = maxNSamples;
return *this;
}
//! Set the minimum and maximum number of hypotheses.
/*!
\param minNumHypotheses
The minimum number of hypotheses.
\param maxNumHypotheses
The maximum number of hypotheses.
\return
The variable resolution node descriptor.
*/
VRNodeDescriptor& VRNodeDescriptor::setMinMaxNumHypotheses(
uint32_t minNumHypotheses,
uint32_t maxNumHypotheses) & noexcept
{
m_minNumHypotheses = minNumHypotheses;
m_maxNumHypotheses = maxNumHypotheses;
return *this;
}
} // namespace BAG