/
vtkMRMLDoseVolumeHistogramNode.h
283 lines (227 loc) · 10.3 KB
/
vtkMRMLDoseVolumeHistogramNode.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
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
/*==============================================================================
Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
Queen's University, Kingston, ON, Canada. All Rights Reserved.
See COPYRIGHT.txt
or http://www.slicer.org/copyright/copyright.txt for details.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This file was originally developed by Csaba Pinter, PerkLab, Queen's University
and was supported through the Applied Cancer Research Unit program of Cancer Care
Ontario with funds provided by the Ontario Ministry of Health and Long-Term Care
==============================================================================*/
#ifndef __vtkMRMLDoseVolumeHistogramNode_h
#define __vtkMRMLDoseVolumeHistogramNode_h
// MRML includes
#include <vtkMRML.h>
#include <vtkMRMLNode.h>
// STD includes
#include <vector>
#include <map>
#include "vtkSlicerDoseVolumeHistogramModuleMRMLExport.h"
class vtkStringArray;
class vtkMRMLScalarVolumeNode;
class vtkMRMLPlotChartNode;
class vtkMRMLSegmentationNode;
class vtkMRMLTableNode;
/// \ingroup SlicerRt_QtModules_DoseVolumeHistogram
///
/// Parameter set node for DVH computation.
/// Node references:
/// Parameter -> Dose Volume (DOSE_VOLUME_REFERENCE_ROLE)
/// -> Segmentation Node (SEGMENTATION_REFERENCE_ROLE)
/// -> Metrics Table (mandatory, unique to parameter) (DVH_METRICS_TABLE_REFERENCE_ROLE)
/// -> Chart (mandatory, unique to parameter) (CHART_REFERENCE_ROLE)
/// Metrics Table -> DVH Table nodes (DVH_ATTRIBUTE_PREFIX[DoseVolumeID]_[SegmentationNodeID]_SegmentID
/// Generated by \sa AssembleDvhNodeReference
/// DVH Table -> Dose Volume (DOSE_VOLUME_REFERENCE_ROLE)
/// -> Segmentation Node (SEGMENTATION_REFERENCE_ROLE)
/// -> Metrics Table (DVH_METRICS_TABLE_REFERENCE_ROLE)
///
class VTK_SLICER_DOSEVOLUMEHISTOGRAM_MRML_EXPORT vtkMRMLDoseVolumeHistogramNode : public vtkMRMLNode
{
public:
// DoseVolumeHistogram constants
static const std::string DVH_ATTRIBUTE_PREFIX;
static const char* DOSE_VOLUME_REFERENCE_ROLE;
static const char* SEGMENTATION_REFERENCE_ROLE;
static const char* DVH_METRICS_TABLE_REFERENCE_ROLE;
// Column numbers of the default metrics in the table
enum
{
MetricColumnVisible = 0,
MetricColumnStructure,
MetricColumnDoseVolume,
MetricColumnVolumeCc,
MetricColumnMeanDose,
MetricColumnMinDose,
MetricColumnMaxDose,
NumberOfDefaultColumns
};
public:
static vtkMRMLDoseVolumeHistogramNode *New();
vtkTypeMacro(vtkMRMLDoseVolumeHistogramNode,vtkMRMLNode);
void PrintSelf(ostream& os, vtkIndent indent) override;
/// Create instance of a GAD node.
vtkMRMLNode* CreateNodeInstance() override;
/// Set node attributes from name/value pairs
void ReadXMLAttributes(const char** atts) override;
/// Write this node's information to a MRML file in XML format.
void WriteXML(ostream& of, int indent) override;
/// Copy the node's attributes to this object
void Copy(vtkMRMLNode *node) override;
/// Get unique node XML tag name (like Volume, Model)
const char* GetNodeTagName() override { return "DoseVolumeHistogram"; };
public:
/// Get dose volume node
vtkMRMLScalarVolumeNode* GetDoseVolumeNode();
/// Set and observe dose volume node
void SetAndObserveDoseVolumeNode(vtkMRMLScalarVolumeNode* node);
/// Get segmentation node
vtkMRMLSegmentationNode* GetSegmentationNode();
/// Set and observe segmentation node
void SetAndObserveSegmentationNode(vtkMRMLSegmentationNode* node);
/// Get DVH metrics table node
vtkMRMLTableNode* GetMetricsTableNode();
/// Get chart node
vtkMRMLPlotChartNode* GetChartNode();
/// Get selected segment IDs
void GetSelectedSegmentIDs(std::vector<std::string> &selectedSegmentIDs)
{
selectedSegmentIDs = this->SelectedSegmentIDs;
}
/// Set selected segment IDs
void SetSelectedSegmentIDs(std::vector<std::string> selectedSegmentIDs)
{
this->SelectedSegmentIDs = selectedSegmentIDs;
}
/// Clear automatic oversampling factors map
void ClearAutomaticOversamplingFactors()
{
this->AutomaticOversamplingFactors.clear();
}
/// Add automatic oversampling factor to map
void AddAutomaticOversamplingFactor(std::string segmentID, double factor)
{
this->AutomaticOversamplingFactors[segmentID] = factor;
}
/// Get automatic oversampling factors
void GetAutomaticOversamplingFactors(std::map<std::string, double> &factors)
{
factors = this->AutomaticOversamplingFactors;
}
/// Get automatic oversampling factor for segment (python compatibility)
double GetAutomaticOversamplingFactorForSegment(std::string segmentID);
/// Get segment IDs that are stored in the automatic oversampling factor map
void GetAutomaticOversamplingFactorSegmentIDs(vtkStringArray* segmentIDs);
/// Assemble DVH node reference role for current input selection and specific segment
std::string AssembleDvhNodeReference(std::string segmentID);
/// Collect DVH Table nodes belonging to this parameter set node
void GetDvhTableNodes(std::vector<vtkMRMLTableNode*> &dvhTableNodes);
/// Get/Set Show/Hide all checkbox state
vtkGetMacro(ShowHideAll, int);
vtkSetMacro(ShowHideAll, int);
/// Get/Set input dose values for V metrics
vtkGetStringMacro(VDoseValues);
vtkSetStringMacro(VDoseValues);
/// Get/Set show Cc for V metrics checkbox state
vtkGetMacro(ShowVMetricsCc, bool);
vtkSetMacro(ShowVMetricsCc, bool);
vtkBooleanMacro(ShowVMetricsCc, bool);
/// Get/Set show % for V metrics checkbox state
vtkGetMacro(ShowVMetricsPercent, bool);
vtkSetMacro(ShowVMetricsPercent, bool);
vtkBooleanMacro(ShowVMetricsPercent, bool);
/// Get input volume cc values for D metrics
vtkGetStringMacro(DVolumeValuesCc);
/// Set input volume cc values for D metrics
vtkSetStringMacro(DVolumeValuesCc);
/// Get input volume % values for D metrics
vtkGetStringMacro(DVolumeValuesPercent);
/// Set input volume % values for D metrics
vtkSetStringMacro(DVolumeValuesPercent);
/// Get show Gy for D metrics checkbox state
vtkGetMacro(ShowDMetrics, bool);
/// Set show Gy for D metrics checkbox state
vtkSetMacro(ShowDMetrics, bool);
/// Set show Gy for D metrics checkbox state
vtkBooleanMacro(ShowDMetrics, bool);
/// Get show dose volumes only checkbox state
vtkGetMacro(ShowDoseVolumesOnly, bool);
/// Set show dose volumes only checkbox state
vtkSetMacro(ShowDoseVolumesOnly, bool);
/// Set show dose volumes only checkbox state
vtkBooleanMacro(ShowDoseVolumesOnly, bool);
/// Get automatic oversampling flag
vtkGetMacro(AutomaticOversampling, bool);
/// Set automatic oversampling flag
vtkSetMacro(AutomaticOversampling, bool);
/// Set automatic oversampling flag
vtkBooleanMacro(AutomaticOversampling, bool);
/// Get fractional labelmap flag
vtkGetMacro(UseFractionalLabelmap, bool);
/// Set fractional labelmap flag
vtkSetMacro(UseFractionalLabelmap, bool);
/// Get fractional labelmap flag
vtkBooleanMacro(UseFractionalLabelmap, bool);
/// Get dose surface histogram flag
vtkGetMacro(DoseSurfaceHistogram, bool);
/// Set dose surface histogram flag
vtkSetMacro(DoseSurfaceHistogram, bool);
/// Get dose surface histogram flag
vtkBooleanMacro(DoseSurfaceHistogram, bool);
/// Get if the surface histogram should be calculated using internal/external voxels
vtkGetMacro(UseInsideDoseSurface, bool);
/// Set if the surface histogram should be calculated using internal/external voxels
vtkSetMacro(UseInsideDoseSurface, bool);
/// Get if the surface histogram should be calculated using internal/external voxels
vtkBooleanMacro(UseInsideDoseSurface, bool);
protected:
/// Set and observe DVH metrics table node
/// Metrics table node is unique and mandatory for each DVH node, so it is created within the node.
void SetAndObserveMetricsTableNode(vtkMRMLTableNode* node);
/// Set and observe chart node
/// Chart node is unique and mandatory for each DVH node, so it is created within the node.
void SetAndObserveChartNode(vtkMRMLPlotChartNode* node);
protected:
vtkMRMLDoseVolumeHistogramNode();
~vtkMRMLDoseVolumeHistogramNode();
vtkMRMLDoseVolumeHistogramNode(const vtkMRMLDoseVolumeHistogramNode&);
void operator=(const vtkMRMLDoseVolumeHistogramNode&);
protected:
/// List of segment IDs selected in the chosen segmentation. If empty, then all segments are considered selected
std::vector<std::string> SelectedSegmentIDs;
/// State of Show/Hide all checkbox
int ShowHideAll;
/// Input dose values for V metrics
char* VDoseValues;
/// State of Show Cc for V metrics checkbox
bool ShowVMetricsCc;
/// State of Show % for V metrics checkbox
bool ShowVMetricsPercent;
/// Input volume cc values for D metrics
char* DVolumeValuesCc;
/// Input volume % values for D metrics
char* DVolumeValuesPercent;
/// State of Show Gy for D metrics checkbox
bool ShowDMetrics;
/// State of Show dose volumes only checkbox
bool ShowDoseVolumesOnly;
/// Flag determining whether automatic oversampling is used
/// If on, then oversampling is automatically determined based on the segments and dose volume, and used
/// for both dose and segmentation when computing DVH.
bool AutomaticOversampling;
/// Automatic oversampling factors stored for each selected segment.
/// If oversampling is automatic then they need to be stored for reporting purposes.
/// This property is not saved to the scene, as these are temporary values.
std::map<std::string, double> AutomaticOversamplingFactors;
/// Flag telling whether or not to use fractional labelmaps
bool UseFractionalLabelmap;
/// State of dose surface histogram checkbox
bool DoseSurfaceHistogram;
/// Whether to calculate the dose volume histogram from voxels inside/outside the structure
bool UseInsideDoseSurface;
};
#endif