1 /*
2 *
3 * Copyright (C) 2008-2012, OFFIS e.V. and ICSMED AG, Oldenburg, Germany
4 * Copyright (C) 2013-2017, J. Riesmeier, Oldenburg, Germany
5 * All rights reserved. See COPYRIGHT file for details.
6 *
7 * Source file for class DRTControlPointSequence
8 *
9 * Generated automatically from DICOM PS 3.3-2017e
10 * File created on 2017-12-05 09:30:54
11 *
12 */
13
14
15 #include "dcmtk/config/osconfig.h" // make sure OS specific configuration is included first
16
17 #include "dcmtk/dcmrt/seq/drtcps.h"
18
19
20 // --- item class ---
21
Item(const OFBool emptyDefaultItem)22 DRTControlPointSequence::Item::Item(const OFBool emptyDefaultItem)
23 : EmptyDefaultItem(emptyDefaultItem),
24 BeamLimitingDeviceAngle(DCM_BeamLimitingDeviceAngle),
25 BeamLimitingDevicePositionSequence(emptyDefaultItem /*emptyDefaultSequence*/),
26 BeamLimitingDeviceRotationDirection(DCM_BeamLimitingDeviceRotationDirection),
27 ControlPointIndex(DCM_ControlPointIndex),
28 CumulativeMetersetWeight(DCM_CumulativeMetersetWeight),
29 DoseRateSet(DCM_DoseRateSet),
30 ExternalContourEntryPoint(DCM_ExternalContourEntryPoint),
31 GantryAngle(DCM_GantryAngle),
32 GantryPitchAngle(DCM_GantryPitchAngle),
33 GantryPitchRotationDirection(DCM_GantryPitchRotationDirection),
34 GantryRotationDirection(DCM_GantryRotationDirection),
35 IsocenterPosition(DCM_IsocenterPosition),
36 NominalBeamEnergy(DCM_NominalBeamEnergy),
37 PatientSupportAngle(DCM_PatientSupportAngle),
38 PatientSupportRotationDirection(DCM_PatientSupportRotationDirection),
39 ReferencedDoseReferenceSequence(emptyDefaultItem /*emptyDefaultSequence*/),
40 ReferencedDoseSequence(emptyDefaultItem /*emptyDefaultSequence*/),
41 SourceToExternalContourDistance(DCM_SourceToExternalContourDistance),
42 SourceToSurfaceDistance(DCM_SourceToSurfaceDistance),
43 SurfaceEntryPoint(DCM_SurfaceEntryPoint),
44 TableTopEccentricAngle(DCM_TableTopEccentricAngle),
45 TableTopEccentricAxisDistance(DCM_TableTopEccentricAxisDistance),
46 TableTopEccentricRotationDirection(DCM_TableTopEccentricRotationDirection),
47 TableTopLateralPosition(DCM_TableTopLateralPosition),
48 TableTopLongitudinalPosition(DCM_TableTopLongitudinalPosition),
49 TableTopPitchAngle(DCM_TableTopPitchAngle),
50 TableTopPitchRotationDirection(DCM_TableTopPitchRotationDirection),
51 TableTopRollAngle(DCM_TableTopRollAngle),
52 TableTopRollRotationDirection(DCM_TableTopRollRotationDirection),
53 TableTopVerticalPosition(DCM_TableTopVerticalPosition),
54 WedgePositionSequence(emptyDefaultItem /*emptyDefaultSequence*/)
55 {
56 }
57
58
Item(const Item & copy)59 DRTControlPointSequence::Item::Item(const Item ©)
60 : EmptyDefaultItem(copy.EmptyDefaultItem),
61 BeamLimitingDeviceAngle(copy.BeamLimitingDeviceAngle),
62 BeamLimitingDevicePositionSequence(copy.BeamLimitingDevicePositionSequence),
63 BeamLimitingDeviceRotationDirection(copy.BeamLimitingDeviceRotationDirection),
64 ControlPointIndex(copy.ControlPointIndex),
65 CumulativeMetersetWeight(copy.CumulativeMetersetWeight),
66 DoseRateSet(copy.DoseRateSet),
67 ExternalContourEntryPoint(copy.ExternalContourEntryPoint),
68 GantryAngle(copy.GantryAngle),
69 GantryPitchAngle(copy.GantryPitchAngle),
70 GantryPitchRotationDirection(copy.GantryPitchRotationDirection),
71 GantryRotationDirection(copy.GantryRotationDirection),
72 IsocenterPosition(copy.IsocenterPosition),
73 NominalBeamEnergy(copy.NominalBeamEnergy),
74 PatientSupportAngle(copy.PatientSupportAngle),
75 PatientSupportRotationDirection(copy.PatientSupportRotationDirection),
76 ReferencedDoseReferenceSequence(copy.ReferencedDoseReferenceSequence),
77 ReferencedDoseSequence(copy.ReferencedDoseSequence),
78 SourceToExternalContourDistance(copy.SourceToExternalContourDistance),
79 SourceToSurfaceDistance(copy.SourceToSurfaceDistance),
80 SurfaceEntryPoint(copy.SurfaceEntryPoint),
81 TableTopEccentricAngle(copy.TableTopEccentricAngle),
82 TableTopEccentricAxisDistance(copy.TableTopEccentricAxisDistance),
83 TableTopEccentricRotationDirection(copy.TableTopEccentricRotationDirection),
84 TableTopLateralPosition(copy.TableTopLateralPosition),
85 TableTopLongitudinalPosition(copy.TableTopLongitudinalPosition),
86 TableTopPitchAngle(copy.TableTopPitchAngle),
87 TableTopPitchRotationDirection(copy.TableTopPitchRotationDirection),
88 TableTopRollAngle(copy.TableTopRollAngle),
89 TableTopRollRotationDirection(copy.TableTopRollRotationDirection),
90 TableTopVerticalPosition(copy.TableTopVerticalPosition),
91 WedgePositionSequence(copy.WedgePositionSequence)
92 {
93 }
94
95
~Item()96 DRTControlPointSequence::Item::~Item()
97 {
98 }
99
100
operator =(const Item & copy)101 DRTControlPointSequence::Item &DRTControlPointSequence::Item::operator=(const Item ©)
102 {
103 if (this != ©)
104 {
105 EmptyDefaultItem = copy.EmptyDefaultItem;
106 BeamLimitingDeviceAngle = copy.BeamLimitingDeviceAngle;
107 BeamLimitingDevicePositionSequence = copy.BeamLimitingDevicePositionSequence;
108 BeamLimitingDeviceRotationDirection = copy.BeamLimitingDeviceRotationDirection;
109 ControlPointIndex = copy.ControlPointIndex;
110 CumulativeMetersetWeight = copy.CumulativeMetersetWeight;
111 DoseRateSet = copy.DoseRateSet;
112 ExternalContourEntryPoint = copy.ExternalContourEntryPoint;
113 GantryAngle = copy.GantryAngle;
114 GantryPitchAngle = copy.GantryPitchAngle;
115 GantryPitchRotationDirection = copy.GantryPitchRotationDirection;
116 GantryRotationDirection = copy.GantryRotationDirection;
117 IsocenterPosition = copy.IsocenterPosition;
118 NominalBeamEnergy = copy.NominalBeamEnergy;
119 PatientSupportAngle = copy.PatientSupportAngle;
120 PatientSupportRotationDirection = copy.PatientSupportRotationDirection;
121 ReferencedDoseReferenceSequence = copy.ReferencedDoseReferenceSequence;
122 ReferencedDoseSequence = copy.ReferencedDoseSequence;
123 SourceToExternalContourDistance = copy.SourceToExternalContourDistance;
124 SourceToSurfaceDistance = copy.SourceToSurfaceDistance;
125 SurfaceEntryPoint = copy.SurfaceEntryPoint;
126 TableTopEccentricAngle = copy.TableTopEccentricAngle;
127 TableTopEccentricAxisDistance = copy.TableTopEccentricAxisDistance;
128 TableTopEccentricRotationDirection = copy.TableTopEccentricRotationDirection;
129 TableTopLateralPosition = copy.TableTopLateralPosition;
130 TableTopLongitudinalPosition = copy.TableTopLongitudinalPosition;
131 TableTopPitchAngle = copy.TableTopPitchAngle;
132 TableTopPitchRotationDirection = copy.TableTopPitchRotationDirection;
133 TableTopRollAngle = copy.TableTopRollAngle;
134 TableTopRollRotationDirection = copy.TableTopRollRotationDirection;
135 TableTopVerticalPosition = copy.TableTopVerticalPosition;
136 WedgePositionSequence = copy.WedgePositionSequence;
137 }
138 return *this;
139 }
140
141
clear()142 void DRTControlPointSequence::Item::clear()
143 {
144 if (!EmptyDefaultItem)
145 {
146 /* clear all DICOM attributes */
147 ControlPointIndex.clear();
148 CumulativeMetersetWeight.clear();
149 ReferencedDoseReferenceSequence.clear();
150 ReferencedDoseSequence.clear();
151 NominalBeamEnergy.clear();
152 DoseRateSet.clear();
153 WedgePositionSequence.clear();
154 BeamLimitingDevicePositionSequence.clear();
155 GantryAngle.clear();
156 GantryRotationDirection.clear();
157 GantryPitchAngle.clear();
158 GantryPitchRotationDirection.clear();
159 BeamLimitingDeviceAngle.clear();
160 BeamLimitingDeviceRotationDirection.clear();
161 PatientSupportAngle.clear();
162 PatientSupportRotationDirection.clear();
163 TableTopEccentricAxisDistance.clear();
164 TableTopEccentricAngle.clear();
165 TableTopEccentricRotationDirection.clear();
166 TableTopPitchAngle.clear();
167 TableTopPitchRotationDirection.clear();
168 TableTopRollAngle.clear();
169 TableTopRollRotationDirection.clear();
170 TableTopVerticalPosition.clear();
171 TableTopLongitudinalPosition.clear();
172 TableTopLateralPosition.clear();
173 IsocenterPosition.clear();
174 SurfaceEntryPoint.clear();
175 ExternalContourEntryPoint.clear();
176 SourceToSurfaceDistance.clear();
177 SourceToExternalContourDistance.clear();
178 }
179 }
180
181
isEmpty()182 OFBool DRTControlPointSequence::Item::isEmpty()
183 {
184 return ControlPointIndex.isEmpty() &&
185 CumulativeMetersetWeight.isEmpty() &&
186 ReferencedDoseReferenceSequence.isEmpty() &&
187 ReferencedDoseSequence.isEmpty() &&
188 NominalBeamEnergy.isEmpty() &&
189 DoseRateSet.isEmpty() &&
190 WedgePositionSequence.isEmpty() &&
191 BeamLimitingDevicePositionSequence.isEmpty() &&
192 GantryAngle.isEmpty() &&
193 GantryRotationDirection.isEmpty() &&
194 GantryPitchAngle.isEmpty() &&
195 GantryPitchRotationDirection.isEmpty() &&
196 BeamLimitingDeviceAngle.isEmpty() &&
197 BeamLimitingDeviceRotationDirection.isEmpty() &&
198 PatientSupportAngle.isEmpty() &&
199 PatientSupportRotationDirection.isEmpty() &&
200 TableTopEccentricAxisDistance.isEmpty() &&
201 TableTopEccentricAngle.isEmpty() &&
202 TableTopEccentricRotationDirection.isEmpty() &&
203 TableTopPitchAngle.isEmpty() &&
204 TableTopPitchRotationDirection.isEmpty() &&
205 TableTopRollAngle.isEmpty() &&
206 TableTopRollRotationDirection.isEmpty() &&
207 TableTopVerticalPosition.isEmpty() &&
208 TableTopLongitudinalPosition.isEmpty() &&
209 TableTopLateralPosition.isEmpty() &&
210 IsocenterPosition.isEmpty() &&
211 SurfaceEntryPoint.isEmpty() &&
212 ExternalContourEntryPoint.isEmpty() &&
213 SourceToSurfaceDistance.isEmpty() &&
214 SourceToExternalContourDistance.isEmpty();
215 }
216
217
isValid() const218 OFBool DRTControlPointSequence::Item::isValid() const
219 {
220 return !EmptyDefaultItem;
221 }
222
223
read(DcmItem & item)224 OFCondition DRTControlPointSequence::Item::read(DcmItem &item)
225 {
226 OFCondition result = EC_IllegalCall;
227 if (!EmptyDefaultItem)
228 {
229 /* re-initialize object */
230 clear();
231 getAndCheckElementFromDataset(item, ControlPointIndex, "1", "1", "ControlPointSequence");
232 getAndCheckElementFromDataset(item, CumulativeMetersetWeight, "1", "2", "ControlPointSequence");
233 ReferencedDoseReferenceSequence.read(item, "1-n", "3", "ControlPointSequence");
234 ReferencedDoseSequence.read(item, "1-n", "1C", "ControlPointSequence");
235 getAndCheckElementFromDataset(item, NominalBeamEnergy, "1", "3", "ControlPointSequence");
236 getAndCheckElementFromDataset(item, DoseRateSet, "1", "3", "ControlPointSequence");
237 WedgePositionSequence.read(item, "1-n", "1C", "ControlPointSequence");
238 BeamLimitingDevicePositionSequence.read(item, "1-n", "1C", "ControlPointSequence");
239 getAndCheckElementFromDataset(item, GantryAngle, "1", "1C", "ControlPointSequence");
240 getAndCheckElementFromDataset(item, GantryRotationDirection, "1", "1C", "ControlPointSequence");
241 getAndCheckElementFromDataset(item, GantryPitchAngle, "1", "3", "ControlPointSequence");
242 getAndCheckElementFromDataset(item, GantryPitchRotationDirection, "1", "3", "ControlPointSequence");
243 getAndCheckElementFromDataset(item, BeamLimitingDeviceAngle, "1", "1C", "ControlPointSequence");
244 getAndCheckElementFromDataset(item, BeamLimitingDeviceRotationDirection, "1", "1C", "ControlPointSequence");
245 getAndCheckElementFromDataset(item, PatientSupportAngle, "1", "1C", "ControlPointSequence");
246 getAndCheckElementFromDataset(item, PatientSupportRotationDirection, "1", "1C", "ControlPointSequence");
247 getAndCheckElementFromDataset(item, TableTopEccentricAxisDistance, "1", "3", "ControlPointSequence");
248 getAndCheckElementFromDataset(item, TableTopEccentricAngle, "1", "1C", "ControlPointSequence");
249 getAndCheckElementFromDataset(item, TableTopEccentricRotationDirection, "1", "1C", "ControlPointSequence");
250 getAndCheckElementFromDataset(item, TableTopPitchAngle, "1", "1C", "ControlPointSequence");
251 getAndCheckElementFromDataset(item, TableTopPitchRotationDirection, "1", "1C", "ControlPointSequence");
252 getAndCheckElementFromDataset(item, TableTopRollAngle, "1", "1C", "ControlPointSequence");
253 getAndCheckElementFromDataset(item, TableTopRollRotationDirection, "1", "1C", "ControlPointSequence");
254 getAndCheckElementFromDataset(item, TableTopVerticalPosition, "1", "2C", "ControlPointSequence");
255 getAndCheckElementFromDataset(item, TableTopLongitudinalPosition, "1", "2C", "ControlPointSequence");
256 getAndCheckElementFromDataset(item, TableTopLateralPosition, "1", "2C", "ControlPointSequence");
257 getAndCheckElementFromDataset(item, IsocenterPosition, "3", "2C", "ControlPointSequence");
258 getAndCheckElementFromDataset(item, SurfaceEntryPoint, "3", "3", "ControlPointSequence");
259 getAndCheckElementFromDataset(item, ExternalContourEntryPoint, "3", "3", "ControlPointSequence");
260 getAndCheckElementFromDataset(item, SourceToSurfaceDistance, "1", "3", "ControlPointSequence");
261 getAndCheckElementFromDataset(item, SourceToExternalContourDistance, "1", "3", "ControlPointSequence");
262 result = EC_Normal;
263 }
264 return result;
265 }
266
267
write(DcmItem & item)268 OFCondition DRTControlPointSequence::Item::write(DcmItem &item)
269 {
270 OFCondition result = EC_IllegalCall;
271 if (!EmptyDefaultItem)
272 {
273 result = EC_Normal;
274 addElementToDataset(result, item, new DcmIntegerString(ControlPointIndex), "1", "1", "ControlPointSequence");
275 addElementToDataset(result, item, new DcmDecimalString(CumulativeMetersetWeight), "1", "2", "ControlPointSequence");
276 if (result.good()) result = ReferencedDoseReferenceSequence.write(item, "1-n", "3", "ControlPointSequence");
277 if (result.good()) result = ReferencedDoseSequence.write(item, "1-n", "1C", "ControlPointSequence");
278 addElementToDataset(result, item, new DcmDecimalString(NominalBeamEnergy), "1", "3", "ControlPointSequence");
279 addElementToDataset(result, item, new DcmDecimalString(DoseRateSet), "1", "3", "ControlPointSequence");
280 if (result.good()) result = WedgePositionSequence.write(item, "1-n", "1C", "ControlPointSequence");
281 if (result.good()) result = BeamLimitingDevicePositionSequence.write(item, "1-n", "1C", "ControlPointSequence");
282 addElementToDataset(result, item, new DcmDecimalString(GantryAngle), "1", "1C", "ControlPointSequence");
283 addElementToDataset(result, item, new DcmCodeString(GantryRotationDirection), "1", "1C", "ControlPointSequence");
284 addElementToDataset(result, item, new DcmFloatingPointSingle(GantryPitchAngle), "1", "3", "ControlPointSequence");
285 addElementToDataset(result, item, new DcmCodeString(GantryPitchRotationDirection), "1", "3", "ControlPointSequence");
286 addElementToDataset(result, item, new DcmDecimalString(BeamLimitingDeviceAngle), "1", "1C", "ControlPointSequence");
287 addElementToDataset(result, item, new DcmCodeString(BeamLimitingDeviceRotationDirection), "1", "1C", "ControlPointSequence");
288 addElementToDataset(result, item, new DcmDecimalString(PatientSupportAngle), "1", "1C", "ControlPointSequence");
289 addElementToDataset(result, item, new DcmCodeString(PatientSupportRotationDirection), "1", "1C", "ControlPointSequence");
290 addElementToDataset(result, item, new DcmDecimalString(TableTopEccentricAxisDistance), "1", "3", "ControlPointSequence");
291 addElementToDataset(result, item, new DcmDecimalString(TableTopEccentricAngle), "1", "1C", "ControlPointSequence");
292 addElementToDataset(result, item, new DcmCodeString(TableTopEccentricRotationDirection), "1", "1C", "ControlPointSequence");
293 addElementToDataset(result, item, new DcmFloatingPointSingle(TableTopPitchAngle), "1", "1C", "ControlPointSequence");
294 addElementToDataset(result, item, new DcmCodeString(TableTopPitchRotationDirection), "1", "1C", "ControlPointSequence");
295 addElementToDataset(result, item, new DcmFloatingPointSingle(TableTopRollAngle), "1", "1C", "ControlPointSequence");
296 addElementToDataset(result, item, new DcmCodeString(TableTopRollRotationDirection), "1", "1C", "ControlPointSequence");
297 addElementToDataset(result, item, new DcmDecimalString(TableTopVerticalPosition), "1", "2C", "ControlPointSequence");
298 addElementToDataset(result, item, new DcmDecimalString(TableTopLongitudinalPosition), "1", "2C", "ControlPointSequence");
299 addElementToDataset(result, item, new DcmDecimalString(TableTopLateralPosition), "1", "2C", "ControlPointSequence");
300 addElementToDataset(result, item, new DcmDecimalString(IsocenterPosition), "3", "2C", "ControlPointSequence");
301 addElementToDataset(result, item, new DcmDecimalString(SurfaceEntryPoint), "3", "3", "ControlPointSequence");
302 addElementToDataset(result, item, new DcmFloatingPointSingle(ExternalContourEntryPoint), "3", "3", "ControlPointSequence");
303 addElementToDataset(result, item, new DcmDecimalString(SourceToSurfaceDistance), "1", "3", "ControlPointSequence");
304 addElementToDataset(result, item, new DcmFloatingPointSingle(SourceToExternalContourDistance), "1", "3", "ControlPointSequence");
305 }
306 return result;
307 }
308
309
getBeamLimitingDeviceAngle(OFString & value,const signed long pos) const310 OFCondition DRTControlPointSequence::Item::getBeamLimitingDeviceAngle(OFString &value, const signed long pos) const
311 {
312 if (EmptyDefaultItem)
313 return EC_IllegalCall;
314 else
315 return getStringValueFromElement(BeamLimitingDeviceAngle, value, pos);
316 }
317
318
getBeamLimitingDeviceAngle(Float64 & value,const unsigned long pos) const319 OFCondition DRTControlPointSequence::Item::getBeamLimitingDeviceAngle(Float64 &value, const unsigned long pos) const
320 {
321 if (EmptyDefaultItem)
322 return EC_IllegalCall;
323 else
324 return OFconst_cast(DcmDecimalString &, BeamLimitingDeviceAngle).getFloat64(value, pos);
325 }
326
327
getBeamLimitingDeviceRotationDirection(OFString & value,const signed long pos) const328 OFCondition DRTControlPointSequence::Item::getBeamLimitingDeviceRotationDirection(OFString &value, const signed long pos) const
329 {
330 if (EmptyDefaultItem)
331 return EC_IllegalCall;
332 else
333 return getStringValueFromElement(BeamLimitingDeviceRotationDirection, value, pos);
334 }
335
336
getControlPointIndex(OFString & value,const signed long pos) const337 OFCondition DRTControlPointSequence::Item::getControlPointIndex(OFString &value, const signed long pos) const
338 {
339 if (EmptyDefaultItem)
340 return EC_IllegalCall;
341 else
342 return getStringValueFromElement(ControlPointIndex, value, pos);
343 }
344
345
getControlPointIndex(Sint32 & value,const unsigned long pos) const346 OFCondition DRTControlPointSequence::Item::getControlPointIndex(Sint32 &value, const unsigned long pos) const
347 {
348 if (EmptyDefaultItem)
349 return EC_IllegalCall;
350 else
351 return OFconst_cast(DcmIntegerString &, ControlPointIndex).getSint32(value, pos);
352 }
353
354
getCumulativeMetersetWeight(OFString & value,const signed long pos) const355 OFCondition DRTControlPointSequence::Item::getCumulativeMetersetWeight(OFString &value, const signed long pos) const
356 {
357 if (EmptyDefaultItem)
358 return EC_IllegalCall;
359 else
360 return getStringValueFromElement(CumulativeMetersetWeight, value, pos);
361 }
362
363
getCumulativeMetersetWeight(Float64 & value,const unsigned long pos) const364 OFCondition DRTControlPointSequence::Item::getCumulativeMetersetWeight(Float64 &value, const unsigned long pos) const
365 {
366 if (EmptyDefaultItem)
367 return EC_IllegalCall;
368 else
369 return OFconst_cast(DcmDecimalString &, CumulativeMetersetWeight).getFloat64(value, pos);
370 }
371
372
getDoseRateSet(OFString & value,const signed long pos) const373 OFCondition DRTControlPointSequence::Item::getDoseRateSet(OFString &value, const signed long pos) const
374 {
375 if (EmptyDefaultItem)
376 return EC_IllegalCall;
377 else
378 return getStringValueFromElement(DoseRateSet, value, pos);
379 }
380
381
getDoseRateSet(Float64 & value,const unsigned long pos) const382 OFCondition DRTControlPointSequence::Item::getDoseRateSet(Float64 &value, const unsigned long pos) const
383 {
384 if (EmptyDefaultItem)
385 return EC_IllegalCall;
386 else
387 return OFconst_cast(DcmDecimalString &, DoseRateSet).getFloat64(value, pos);
388 }
389
390
getExternalContourEntryPoint(Float32 & value,const unsigned long pos) const391 OFCondition DRTControlPointSequence::Item::getExternalContourEntryPoint(Float32 &value, const unsigned long pos) const
392 {
393 if (EmptyDefaultItem)
394 return EC_IllegalCall;
395 else
396 return OFconst_cast(DcmFloatingPointSingle &, ExternalContourEntryPoint).getFloat32(value, pos);
397 }
398
399
getGantryAngle(OFString & value,const signed long pos) const400 OFCondition DRTControlPointSequence::Item::getGantryAngle(OFString &value, const signed long pos) const
401 {
402 if (EmptyDefaultItem)
403 return EC_IllegalCall;
404 else
405 return getStringValueFromElement(GantryAngle, value, pos);
406 }
407
408
getGantryAngle(Float64 & value,const unsigned long pos) const409 OFCondition DRTControlPointSequence::Item::getGantryAngle(Float64 &value, const unsigned long pos) const
410 {
411 if (EmptyDefaultItem)
412 return EC_IllegalCall;
413 else
414 return OFconst_cast(DcmDecimalString &, GantryAngle).getFloat64(value, pos);
415 }
416
417
getGantryPitchAngle(Float32 & value,const unsigned long pos) const418 OFCondition DRTControlPointSequence::Item::getGantryPitchAngle(Float32 &value, const unsigned long pos) const
419 {
420 if (EmptyDefaultItem)
421 return EC_IllegalCall;
422 else
423 return OFconst_cast(DcmFloatingPointSingle &, GantryPitchAngle).getFloat32(value, pos);
424 }
425
426
getGantryPitchRotationDirection(OFString & value,const signed long pos) const427 OFCondition DRTControlPointSequence::Item::getGantryPitchRotationDirection(OFString &value, const signed long pos) const
428 {
429 if (EmptyDefaultItem)
430 return EC_IllegalCall;
431 else
432 return getStringValueFromElement(GantryPitchRotationDirection, value, pos);
433 }
434
435
getGantryRotationDirection(OFString & value,const signed long pos) const436 OFCondition DRTControlPointSequence::Item::getGantryRotationDirection(OFString &value, const signed long pos) const
437 {
438 if (EmptyDefaultItem)
439 return EC_IllegalCall;
440 else
441 return getStringValueFromElement(GantryRotationDirection, value, pos);
442 }
443
444
getIsocenterPosition(OFString & value,const signed long pos) const445 OFCondition DRTControlPointSequence::Item::getIsocenterPosition(OFString &value, const signed long pos) const
446 {
447 if (EmptyDefaultItem)
448 return EC_IllegalCall;
449 else
450 return getStringValueFromElement(IsocenterPosition, value, pos);
451 }
452
453
getIsocenterPosition(Float64 & value,const unsigned long pos) const454 OFCondition DRTControlPointSequence::Item::getIsocenterPosition(Float64 &value, const unsigned long pos) const
455 {
456 if (EmptyDefaultItem)
457 return EC_IllegalCall;
458 else
459 return OFconst_cast(DcmDecimalString &, IsocenterPosition).getFloat64(value, pos);
460 }
461
462
getIsocenterPosition(OFVector<Float64> & value) const463 OFCondition DRTControlPointSequence::Item::getIsocenterPosition(OFVector<Float64> &value) const
464 {
465 if (EmptyDefaultItem)
466 return EC_IllegalCall;
467 else
468 return OFconst_cast(DcmDecimalString &, IsocenterPosition).getFloat64Vector(value);
469 }
470
471
getNominalBeamEnergy(OFString & value,const signed long pos) const472 OFCondition DRTControlPointSequence::Item::getNominalBeamEnergy(OFString &value, const signed long pos) const
473 {
474 if (EmptyDefaultItem)
475 return EC_IllegalCall;
476 else
477 return getStringValueFromElement(NominalBeamEnergy, value, pos);
478 }
479
480
getNominalBeamEnergy(Float64 & value,const unsigned long pos) const481 OFCondition DRTControlPointSequence::Item::getNominalBeamEnergy(Float64 &value, const unsigned long pos) const
482 {
483 if (EmptyDefaultItem)
484 return EC_IllegalCall;
485 else
486 return OFconst_cast(DcmDecimalString &, NominalBeamEnergy).getFloat64(value, pos);
487 }
488
489
getPatientSupportAngle(OFString & value,const signed long pos) const490 OFCondition DRTControlPointSequence::Item::getPatientSupportAngle(OFString &value, const signed long pos) const
491 {
492 if (EmptyDefaultItem)
493 return EC_IllegalCall;
494 else
495 return getStringValueFromElement(PatientSupportAngle, value, pos);
496 }
497
498
getPatientSupportAngle(Float64 & value,const unsigned long pos) const499 OFCondition DRTControlPointSequence::Item::getPatientSupportAngle(Float64 &value, const unsigned long pos) const
500 {
501 if (EmptyDefaultItem)
502 return EC_IllegalCall;
503 else
504 return OFconst_cast(DcmDecimalString &, PatientSupportAngle).getFloat64(value, pos);
505 }
506
507
getPatientSupportRotationDirection(OFString & value,const signed long pos) const508 OFCondition DRTControlPointSequence::Item::getPatientSupportRotationDirection(OFString &value, const signed long pos) const
509 {
510 if (EmptyDefaultItem)
511 return EC_IllegalCall;
512 else
513 return getStringValueFromElement(PatientSupportRotationDirection, value, pos);
514 }
515
516
getSourceToExternalContourDistance(Float32 & value,const unsigned long pos) const517 OFCondition DRTControlPointSequence::Item::getSourceToExternalContourDistance(Float32 &value, const unsigned long pos) const
518 {
519 if (EmptyDefaultItem)
520 return EC_IllegalCall;
521 else
522 return OFconst_cast(DcmFloatingPointSingle &, SourceToExternalContourDistance).getFloat32(value, pos);
523 }
524
525
getSourceToSurfaceDistance(OFString & value,const signed long pos) const526 OFCondition DRTControlPointSequence::Item::getSourceToSurfaceDistance(OFString &value, const signed long pos) const
527 {
528 if (EmptyDefaultItem)
529 return EC_IllegalCall;
530 else
531 return getStringValueFromElement(SourceToSurfaceDistance, value, pos);
532 }
533
534
getSourceToSurfaceDistance(Float64 & value,const unsigned long pos) const535 OFCondition DRTControlPointSequence::Item::getSourceToSurfaceDistance(Float64 &value, const unsigned long pos) const
536 {
537 if (EmptyDefaultItem)
538 return EC_IllegalCall;
539 else
540 return OFconst_cast(DcmDecimalString &, SourceToSurfaceDistance).getFloat64(value, pos);
541 }
542
543
getSurfaceEntryPoint(OFString & value,const signed long pos) const544 OFCondition DRTControlPointSequence::Item::getSurfaceEntryPoint(OFString &value, const signed long pos) const
545 {
546 if (EmptyDefaultItem)
547 return EC_IllegalCall;
548 else
549 return getStringValueFromElement(SurfaceEntryPoint, value, pos);
550 }
551
552
getSurfaceEntryPoint(Float64 & value,const unsigned long pos) const553 OFCondition DRTControlPointSequence::Item::getSurfaceEntryPoint(Float64 &value, const unsigned long pos) const
554 {
555 if (EmptyDefaultItem)
556 return EC_IllegalCall;
557 else
558 return OFconst_cast(DcmDecimalString &, SurfaceEntryPoint).getFloat64(value, pos);
559 }
560
561
getSurfaceEntryPoint(OFVector<Float64> & value) const562 OFCondition DRTControlPointSequence::Item::getSurfaceEntryPoint(OFVector<Float64> &value) const
563 {
564 if (EmptyDefaultItem)
565 return EC_IllegalCall;
566 else
567 return OFconst_cast(DcmDecimalString &, SurfaceEntryPoint).getFloat64Vector(value);
568 }
569
570
getTableTopEccentricAngle(OFString & value,const signed long pos) const571 OFCondition DRTControlPointSequence::Item::getTableTopEccentricAngle(OFString &value, const signed long pos) const
572 {
573 if (EmptyDefaultItem)
574 return EC_IllegalCall;
575 else
576 return getStringValueFromElement(TableTopEccentricAngle, value, pos);
577 }
578
579
getTableTopEccentricAngle(Float64 & value,const unsigned long pos) const580 OFCondition DRTControlPointSequence::Item::getTableTopEccentricAngle(Float64 &value, const unsigned long pos) const
581 {
582 if (EmptyDefaultItem)
583 return EC_IllegalCall;
584 else
585 return OFconst_cast(DcmDecimalString &, TableTopEccentricAngle).getFloat64(value, pos);
586 }
587
588
getTableTopEccentricAxisDistance(OFString & value,const signed long pos) const589 OFCondition DRTControlPointSequence::Item::getTableTopEccentricAxisDistance(OFString &value, const signed long pos) const
590 {
591 if (EmptyDefaultItem)
592 return EC_IllegalCall;
593 else
594 return getStringValueFromElement(TableTopEccentricAxisDistance, value, pos);
595 }
596
597
getTableTopEccentricAxisDistance(Float64 & value,const unsigned long pos) const598 OFCondition DRTControlPointSequence::Item::getTableTopEccentricAxisDistance(Float64 &value, const unsigned long pos) const
599 {
600 if (EmptyDefaultItem)
601 return EC_IllegalCall;
602 else
603 return OFconst_cast(DcmDecimalString &, TableTopEccentricAxisDistance).getFloat64(value, pos);
604 }
605
606
getTableTopEccentricRotationDirection(OFString & value,const signed long pos) const607 OFCondition DRTControlPointSequence::Item::getTableTopEccentricRotationDirection(OFString &value, const signed long pos) const
608 {
609 if (EmptyDefaultItem)
610 return EC_IllegalCall;
611 else
612 return getStringValueFromElement(TableTopEccentricRotationDirection, value, pos);
613 }
614
615
getTableTopLateralPosition(OFString & value,const signed long pos) const616 OFCondition DRTControlPointSequence::Item::getTableTopLateralPosition(OFString &value, const signed long pos) const
617 {
618 if (EmptyDefaultItem)
619 return EC_IllegalCall;
620 else
621 return getStringValueFromElement(TableTopLateralPosition, value, pos);
622 }
623
624
getTableTopLateralPosition(Float64 & value,const unsigned long pos) const625 OFCondition DRTControlPointSequence::Item::getTableTopLateralPosition(Float64 &value, const unsigned long pos) const
626 {
627 if (EmptyDefaultItem)
628 return EC_IllegalCall;
629 else
630 return OFconst_cast(DcmDecimalString &, TableTopLateralPosition).getFloat64(value, pos);
631 }
632
633
getTableTopLongitudinalPosition(OFString & value,const signed long pos) const634 OFCondition DRTControlPointSequence::Item::getTableTopLongitudinalPosition(OFString &value, const signed long pos) const
635 {
636 if (EmptyDefaultItem)
637 return EC_IllegalCall;
638 else
639 return getStringValueFromElement(TableTopLongitudinalPosition, value, pos);
640 }
641
642
getTableTopLongitudinalPosition(Float64 & value,const unsigned long pos) const643 OFCondition DRTControlPointSequence::Item::getTableTopLongitudinalPosition(Float64 &value, const unsigned long pos) const
644 {
645 if (EmptyDefaultItem)
646 return EC_IllegalCall;
647 else
648 return OFconst_cast(DcmDecimalString &, TableTopLongitudinalPosition).getFloat64(value, pos);
649 }
650
651
getTableTopPitchAngle(Float32 & value,const unsigned long pos) const652 OFCondition DRTControlPointSequence::Item::getTableTopPitchAngle(Float32 &value, const unsigned long pos) const
653 {
654 if (EmptyDefaultItem)
655 return EC_IllegalCall;
656 else
657 return OFconst_cast(DcmFloatingPointSingle &, TableTopPitchAngle).getFloat32(value, pos);
658 }
659
660
getTableTopPitchRotationDirection(OFString & value,const signed long pos) const661 OFCondition DRTControlPointSequence::Item::getTableTopPitchRotationDirection(OFString &value, const signed long pos) const
662 {
663 if (EmptyDefaultItem)
664 return EC_IllegalCall;
665 else
666 return getStringValueFromElement(TableTopPitchRotationDirection, value, pos);
667 }
668
669
getTableTopRollAngle(Float32 & value,const unsigned long pos) const670 OFCondition DRTControlPointSequence::Item::getTableTopRollAngle(Float32 &value, const unsigned long pos) const
671 {
672 if (EmptyDefaultItem)
673 return EC_IllegalCall;
674 else
675 return OFconst_cast(DcmFloatingPointSingle &, TableTopRollAngle).getFloat32(value, pos);
676 }
677
678
getTableTopRollRotationDirection(OFString & value,const signed long pos) const679 OFCondition DRTControlPointSequence::Item::getTableTopRollRotationDirection(OFString &value, const signed long pos) const
680 {
681 if (EmptyDefaultItem)
682 return EC_IllegalCall;
683 else
684 return getStringValueFromElement(TableTopRollRotationDirection, value, pos);
685 }
686
687
getTableTopVerticalPosition(OFString & value,const signed long pos) const688 OFCondition DRTControlPointSequence::Item::getTableTopVerticalPosition(OFString &value, const signed long pos) const
689 {
690 if (EmptyDefaultItem)
691 return EC_IllegalCall;
692 else
693 return getStringValueFromElement(TableTopVerticalPosition, value, pos);
694 }
695
696
getTableTopVerticalPosition(Float64 & value,const unsigned long pos) const697 OFCondition DRTControlPointSequence::Item::getTableTopVerticalPosition(Float64 &value, const unsigned long pos) const
698 {
699 if (EmptyDefaultItem)
700 return EC_IllegalCall;
701 else
702 return OFconst_cast(DcmDecimalString &, TableTopVerticalPosition).getFloat64(value, pos);
703 }
704
705
setBeamLimitingDeviceAngle(const OFString & value,const OFBool check)706 OFCondition DRTControlPointSequence::Item::setBeamLimitingDeviceAngle(const OFString &value, const OFBool check)
707 {
708 OFCondition result = EC_IllegalCall;
709 if (!EmptyDefaultItem)
710 {
711 result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
712 if (result.good())
713 result = BeamLimitingDeviceAngle.putOFStringArray(value);
714 }
715 return result;
716 }
717
718
setBeamLimitingDeviceRotationDirection(const OFString & value,const OFBool check)719 OFCondition DRTControlPointSequence::Item::setBeamLimitingDeviceRotationDirection(const OFString &value, const OFBool check)
720 {
721 OFCondition result = EC_IllegalCall;
722 if (!EmptyDefaultItem)
723 {
724 result = (check) ? DcmCodeString::checkStringValue(value, "1") : EC_Normal;
725 if (result.good())
726 result = BeamLimitingDeviceRotationDirection.putOFStringArray(value);
727 }
728 return result;
729 }
730
731
setControlPointIndex(const OFString & value,const OFBool check)732 OFCondition DRTControlPointSequence::Item::setControlPointIndex(const OFString &value, const OFBool check)
733 {
734 OFCondition result = EC_IllegalCall;
735 if (!EmptyDefaultItem)
736 {
737 result = (check) ? DcmIntegerString::checkStringValue(value, "1") : EC_Normal;
738 if (result.good())
739 result = ControlPointIndex.putOFStringArray(value);
740 }
741 return result;
742 }
743
744
setCumulativeMetersetWeight(const OFString & value,const OFBool check)745 OFCondition DRTControlPointSequence::Item::setCumulativeMetersetWeight(const OFString &value, const OFBool check)
746 {
747 OFCondition result = EC_IllegalCall;
748 if (!EmptyDefaultItem)
749 {
750 result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
751 if (result.good())
752 result = CumulativeMetersetWeight.putOFStringArray(value);
753 }
754 return result;
755 }
756
757
setDoseRateSet(const OFString & value,const OFBool check)758 OFCondition DRTControlPointSequence::Item::setDoseRateSet(const OFString &value, const OFBool check)
759 {
760 OFCondition result = EC_IllegalCall;
761 if (!EmptyDefaultItem)
762 {
763 result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
764 if (result.good())
765 result = DoseRateSet.putOFStringArray(value);
766 }
767 return result;
768 }
769
770
setExternalContourEntryPoint(const Float32 value,const unsigned long pos)771 OFCondition DRTControlPointSequence::Item::setExternalContourEntryPoint(const Float32 value, const unsigned long pos)
772 {
773 if (EmptyDefaultItem)
774 return EC_IllegalCall;
775 else
776 return ExternalContourEntryPoint.putFloat32(value, pos);
777 }
778
779
setGantryAngle(const OFString & value,const OFBool check)780 OFCondition DRTControlPointSequence::Item::setGantryAngle(const OFString &value, const OFBool check)
781 {
782 OFCondition result = EC_IllegalCall;
783 if (!EmptyDefaultItem)
784 {
785 result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
786 if (result.good())
787 result = GantryAngle.putOFStringArray(value);
788 }
789 return result;
790 }
791
792
setGantryPitchAngle(const Float32 value,const unsigned long pos)793 OFCondition DRTControlPointSequence::Item::setGantryPitchAngle(const Float32 value, const unsigned long pos)
794 {
795 if (EmptyDefaultItem)
796 return EC_IllegalCall;
797 else
798 return GantryPitchAngle.putFloat32(value, pos);
799 }
800
801
setGantryPitchRotationDirection(const OFString & value,const OFBool check)802 OFCondition DRTControlPointSequence::Item::setGantryPitchRotationDirection(const OFString &value, const OFBool check)
803 {
804 OFCondition result = EC_IllegalCall;
805 if (!EmptyDefaultItem)
806 {
807 result = (check) ? DcmCodeString::checkStringValue(value, "1") : EC_Normal;
808 if (result.good())
809 result = GantryPitchRotationDirection.putOFStringArray(value);
810 }
811 return result;
812 }
813
814
setGantryRotationDirection(const OFString & value,const OFBool check)815 OFCondition DRTControlPointSequence::Item::setGantryRotationDirection(const OFString &value, const OFBool check)
816 {
817 OFCondition result = EC_IllegalCall;
818 if (!EmptyDefaultItem)
819 {
820 result = (check) ? DcmCodeString::checkStringValue(value, "1") : EC_Normal;
821 if (result.good())
822 result = GantryRotationDirection.putOFStringArray(value);
823 }
824 return result;
825 }
826
827
setIsocenterPosition(const OFString & value,const OFBool check)828 OFCondition DRTControlPointSequence::Item::setIsocenterPosition(const OFString &value, const OFBool check)
829 {
830 OFCondition result = EC_IllegalCall;
831 if (!EmptyDefaultItem)
832 {
833 result = (check) ? DcmDecimalString::checkStringValue(value, "3") : EC_Normal;
834 if (result.good())
835 result = IsocenterPosition.putOFStringArray(value);
836 }
837 return result;
838 }
839
840
setNominalBeamEnergy(const OFString & value,const OFBool check)841 OFCondition DRTControlPointSequence::Item::setNominalBeamEnergy(const OFString &value, const OFBool check)
842 {
843 OFCondition result = EC_IllegalCall;
844 if (!EmptyDefaultItem)
845 {
846 result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
847 if (result.good())
848 result = NominalBeamEnergy.putOFStringArray(value);
849 }
850 return result;
851 }
852
853
setPatientSupportAngle(const OFString & value,const OFBool check)854 OFCondition DRTControlPointSequence::Item::setPatientSupportAngle(const OFString &value, const OFBool check)
855 {
856 OFCondition result = EC_IllegalCall;
857 if (!EmptyDefaultItem)
858 {
859 result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
860 if (result.good())
861 result = PatientSupportAngle.putOFStringArray(value);
862 }
863 return result;
864 }
865
866
setPatientSupportRotationDirection(const OFString & value,const OFBool check)867 OFCondition DRTControlPointSequence::Item::setPatientSupportRotationDirection(const OFString &value, const OFBool check)
868 {
869 OFCondition result = EC_IllegalCall;
870 if (!EmptyDefaultItem)
871 {
872 result = (check) ? DcmCodeString::checkStringValue(value, "1") : EC_Normal;
873 if (result.good())
874 result = PatientSupportRotationDirection.putOFStringArray(value);
875 }
876 return result;
877 }
878
879
setSourceToExternalContourDistance(const Float32 value,const unsigned long pos)880 OFCondition DRTControlPointSequence::Item::setSourceToExternalContourDistance(const Float32 value, const unsigned long pos)
881 {
882 if (EmptyDefaultItem)
883 return EC_IllegalCall;
884 else
885 return SourceToExternalContourDistance.putFloat32(value, pos);
886 }
887
888
setSourceToSurfaceDistance(const OFString & value,const OFBool check)889 OFCondition DRTControlPointSequence::Item::setSourceToSurfaceDistance(const OFString &value, const OFBool check)
890 {
891 OFCondition result = EC_IllegalCall;
892 if (!EmptyDefaultItem)
893 {
894 result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
895 if (result.good())
896 result = SourceToSurfaceDistance.putOFStringArray(value);
897 }
898 return result;
899 }
900
901
setSurfaceEntryPoint(const OFString & value,const OFBool check)902 OFCondition DRTControlPointSequence::Item::setSurfaceEntryPoint(const OFString &value, const OFBool check)
903 {
904 OFCondition result = EC_IllegalCall;
905 if (!EmptyDefaultItem)
906 {
907 result = (check) ? DcmDecimalString::checkStringValue(value, "3") : EC_Normal;
908 if (result.good())
909 result = SurfaceEntryPoint.putOFStringArray(value);
910 }
911 return result;
912 }
913
914
setTableTopEccentricAngle(const OFString & value,const OFBool check)915 OFCondition DRTControlPointSequence::Item::setTableTopEccentricAngle(const OFString &value, const OFBool check)
916 {
917 OFCondition result = EC_IllegalCall;
918 if (!EmptyDefaultItem)
919 {
920 result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
921 if (result.good())
922 result = TableTopEccentricAngle.putOFStringArray(value);
923 }
924 return result;
925 }
926
927
setTableTopEccentricAxisDistance(const OFString & value,const OFBool check)928 OFCondition DRTControlPointSequence::Item::setTableTopEccentricAxisDistance(const OFString &value, const OFBool check)
929 {
930 OFCondition result = EC_IllegalCall;
931 if (!EmptyDefaultItem)
932 {
933 result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
934 if (result.good())
935 result = TableTopEccentricAxisDistance.putOFStringArray(value);
936 }
937 return result;
938 }
939
940
setTableTopEccentricRotationDirection(const OFString & value,const OFBool check)941 OFCondition DRTControlPointSequence::Item::setTableTopEccentricRotationDirection(const OFString &value, const OFBool check)
942 {
943 OFCondition result = EC_IllegalCall;
944 if (!EmptyDefaultItem)
945 {
946 result = (check) ? DcmCodeString::checkStringValue(value, "1") : EC_Normal;
947 if (result.good())
948 result = TableTopEccentricRotationDirection.putOFStringArray(value);
949 }
950 return result;
951 }
952
953
setTableTopLateralPosition(const OFString & value,const OFBool check)954 OFCondition DRTControlPointSequence::Item::setTableTopLateralPosition(const OFString &value, const OFBool check)
955 {
956 OFCondition result = EC_IllegalCall;
957 if (!EmptyDefaultItem)
958 {
959 result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
960 if (result.good())
961 result = TableTopLateralPosition.putOFStringArray(value);
962 }
963 return result;
964 }
965
966
setTableTopLongitudinalPosition(const OFString & value,const OFBool check)967 OFCondition DRTControlPointSequence::Item::setTableTopLongitudinalPosition(const OFString &value, const OFBool check)
968 {
969 OFCondition result = EC_IllegalCall;
970 if (!EmptyDefaultItem)
971 {
972 result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
973 if (result.good())
974 result = TableTopLongitudinalPosition.putOFStringArray(value);
975 }
976 return result;
977 }
978
979
setTableTopPitchAngle(const Float32 value,const unsigned long pos)980 OFCondition DRTControlPointSequence::Item::setTableTopPitchAngle(const Float32 value, const unsigned long pos)
981 {
982 if (EmptyDefaultItem)
983 return EC_IllegalCall;
984 else
985 return TableTopPitchAngle.putFloat32(value, pos);
986 }
987
988
setTableTopPitchRotationDirection(const OFString & value,const OFBool check)989 OFCondition DRTControlPointSequence::Item::setTableTopPitchRotationDirection(const OFString &value, const OFBool check)
990 {
991 OFCondition result = EC_IllegalCall;
992 if (!EmptyDefaultItem)
993 {
994 result = (check) ? DcmCodeString::checkStringValue(value, "1") : EC_Normal;
995 if (result.good())
996 result = TableTopPitchRotationDirection.putOFStringArray(value);
997 }
998 return result;
999 }
1000
1001
setTableTopRollAngle(const Float32 value,const unsigned long pos)1002 OFCondition DRTControlPointSequence::Item::setTableTopRollAngle(const Float32 value, const unsigned long pos)
1003 {
1004 if (EmptyDefaultItem)
1005 return EC_IllegalCall;
1006 else
1007 return TableTopRollAngle.putFloat32(value, pos);
1008 }
1009
1010
setTableTopRollRotationDirection(const OFString & value,const OFBool check)1011 OFCondition DRTControlPointSequence::Item::setTableTopRollRotationDirection(const OFString &value, const OFBool check)
1012 {
1013 OFCondition result = EC_IllegalCall;
1014 if (!EmptyDefaultItem)
1015 {
1016 result = (check) ? DcmCodeString::checkStringValue(value, "1") : EC_Normal;
1017 if (result.good())
1018 result = TableTopRollRotationDirection.putOFStringArray(value);
1019 }
1020 return result;
1021 }
1022
1023
setTableTopVerticalPosition(const OFString & value,const OFBool check)1024 OFCondition DRTControlPointSequence::Item::setTableTopVerticalPosition(const OFString &value, const OFBool check)
1025 {
1026 OFCondition result = EC_IllegalCall;
1027 if (!EmptyDefaultItem)
1028 {
1029 result = (check) ? DcmDecimalString::checkStringValue(value, "1") : EC_Normal;
1030 if (result.good())
1031 result = TableTopVerticalPosition.putOFStringArray(value);
1032 }
1033 return result;
1034 }
1035
1036
1037 // --- sequence class ---
1038
DRTControlPointSequence(const OFBool emptyDefaultSequence)1039 DRTControlPointSequence::DRTControlPointSequence(const OFBool emptyDefaultSequence)
1040 : EmptyDefaultSequence(emptyDefaultSequence),
1041 SequenceOfItems(),
1042 CurrentItem(),
1043 EmptyItem(OFTrue /*emptyDefaultItem*/)
1044 {
1045 CurrentItem = SequenceOfItems.end();
1046 }
1047
1048
DRTControlPointSequence(const DRTControlPointSequence & copy)1049 DRTControlPointSequence::DRTControlPointSequence(const DRTControlPointSequence ©)
1050 : EmptyDefaultSequence(copy.EmptyDefaultSequence),
1051 SequenceOfItems(),
1052 CurrentItem(),
1053 EmptyItem(OFTrue /*emptyDefaultItem*/)
1054 {
1055 /* create a copy of the internal sequence of items */
1056 Item *item = NULL;
1057 OFListConstIterator(Item *) current = copy.SequenceOfItems.begin();
1058 const OFListConstIterator(Item *) last = copy.SequenceOfItems.end();
1059 while (current != last)
1060 {
1061 item = new Item(**current);
1062 if (item != NULL)
1063 {
1064 SequenceOfItems.push_back(item);
1065 } else {
1066 /* memory exhausted, there is nothing we can do about it */
1067 break;
1068 }
1069 ++current;
1070 }
1071 CurrentItem = SequenceOfItems.begin();
1072 }
1073
1074
operator =(const DRTControlPointSequence & copy)1075 DRTControlPointSequence &DRTControlPointSequence::operator=(const DRTControlPointSequence ©)
1076 {
1077 if (this != ©)
1078 {
1079 clear();
1080 EmptyDefaultSequence = copy.EmptyDefaultSequence;
1081 /* create a copy of the internal sequence of items */
1082 Item *item = NULL;
1083 OFListConstIterator(Item *) current = copy.SequenceOfItems.begin();
1084 const OFListConstIterator(Item *) last = copy.SequenceOfItems.end();
1085 while (current != last)
1086 {
1087 item = new Item(**current);
1088 if (item != NULL)
1089 {
1090 SequenceOfItems.push_back(item);
1091 } else {
1092 /* memory exhausted, there is nothing we can do about it */
1093 break;
1094 }
1095 ++current;
1096 }
1097 CurrentItem = SequenceOfItems.begin();
1098 }
1099 return *this;
1100 }
1101
1102
~DRTControlPointSequence()1103 DRTControlPointSequence::~DRTControlPointSequence()
1104 {
1105 clear();
1106 }
1107
1108
clear()1109 void DRTControlPointSequence::clear()
1110 {
1111 if (!EmptyDefaultSequence)
1112 {
1113 CurrentItem = SequenceOfItems.begin();
1114 const OFListConstIterator(Item *) last = SequenceOfItems.end();
1115 /* delete all items and free memory */
1116 while (CurrentItem != last)
1117 {
1118 delete (*CurrentItem);
1119 CurrentItem = SequenceOfItems.erase(CurrentItem);
1120 }
1121 /* make sure that the list is empty */
1122 SequenceOfItems.clear();
1123 CurrentItem = SequenceOfItems.end();
1124 }
1125 }
1126
1127
isEmpty()1128 OFBool DRTControlPointSequence::isEmpty()
1129 {
1130 return SequenceOfItems.empty();
1131 }
1132
1133
isValid() const1134 OFBool DRTControlPointSequence::isValid() const
1135 {
1136 return !EmptyDefaultSequence;
1137 }
1138
1139
getNumberOfItems() const1140 size_t DRTControlPointSequence::getNumberOfItems() const
1141 {
1142 return SequenceOfItems.size();
1143 }
1144
1145
gotoFirstItem()1146 OFCondition DRTControlPointSequence::gotoFirstItem()
1147 {
1148 OFCondition result = EC_IllegalCall;
1149 if (!SequenceOfItems.empty())
1150 {
1151 CurrentItem = SequenceOfItems.begin();
1152 result = EC_Normal;
1153 }
1154 return result;
1155 }
1156
1157
gotoNextItem()1158 OFCondition DRTControlPointSequence::gotoNextItem()
1159 {
1160 OFCondition result = EC_IllegalCall;
1161 if (CurrentItem != SequenceOfItems.end())
1162 {
1163 ++CurrentItem;
1164 result = EC_Normal;
1165 }
1166 return result;
1167 }
1168
1169
gotoItem(const size_t num,OFListIterator (Item *)& iterator)1170 OFCondition DRTControlPointSequence::gotoItem(const size_t num, OFListIterator(Item *) &iterator)
1171 {
1172 OFCondition result = EC_IllegalCall;
1173 if (!SequenceOfItems.empty())
1174 {
1175 size_t idx = num + 1;
1176 iterator = SequenceOfItems.begin();
1177 const OFListConstIterator(Item *) last = SequenceOfItems.end();
1178 while ((--idx > 0) && (iterator != last))
1179 ++iterator;
1180 /* specified list item found? */
1181 if ((idx == 0) && (iterator != last))
1182 result = EC_Normal;
1183 else
1184 result = EC_IllegalParameter;
1185 }
1186 return result;
1187 }
1188
1189
gotoItem(const size_t num,OFListConstIterator (Item *)& iterator) const1190 OFCondition DRTControlPointSequence::gotoItem(const size_t num, OFListConstIterator(Item *) &iterator) const
1191 {
1192 OFCondition result = EC_IllegalCall;
1193 if (!SequenceOfItems.empty())
1194 {
1195 size_t idx = num + 1;
1196 iterator = SequenceOfItems.begin();
1197 const OFListConstIterator(Item *) last = SequenceOfItems.end();
1198 while ((--idx > 0) && (iterator != last))
1199 ++iterator;
1200 /* specified list item found? */
1201 if ((idx == 0) && (iterator != last))
1202 result = EC_Normal;
1203 else
1204 result = EC_IllegalParameter;
1205 }
1206 return result;
1207 }
1208
1209
gotoItem(const size_t num)1210 OFCondition DRTControlPointSequence::gotoItem(const size_t num)
1211 {
1212 return gotoItem(num, CurrentItem);
1213 }
1214
1215
getCurrentItem(Item * & item) const1216 OFCondition DRTControlPointSequence::getCurrentItem(Item *&item) const
1217 {
1218 OFCondition result = EC_IllegalCall;
1219 if (CurrentItem != SequenceOfItems.end())
1220 {
1221 item = *CurrentItem;
1222 result = EC_Normal;
1223 }
1224 return result;
1225 }
1226
1227
getCurrentItem()1228 DRTControlPointSequence::Item &DRTControlPointSequence::getCurrentItem()
1229 {
1230 if (CurrentItem != SequenceOfItems.end())
1231 return **CurrentItem;
1232 else
1233 return EmptyItem;
1234 }
1235
1236
getCurrentItem() const1237 const DRTControlPointSequence::Item &DRTControlPointSequence::getCurrentItem() const
1238 {
1239 if (CurrentItem != SequenceOfItems.end())
1240 return **CurrentItem;
1241 else
1242 return EmptyItem;
1243 }
1244
1245
getItem(const size_t num,Item * & item)1246 OFCondition DRTControlPointSequence::getItem(const size_t num, Item *&item)
1247 {
1248 OFListIterator(Item *) iterator;
1249 OFCondition result = gotoItem(num, iterator);
1250 if (result.good())
1251 item = *iterator;
1252 return result;
1253 }
1254
1255
getItem(const size_t num)1256 DRTControlPointSequence::Item &DRTControlPointSequence::getItem(const size_t num)
1257 {
1258 OFListIterator(Item *) iterator;
1259 if (gotoItem(num, iterator).good())
1260 return **iterator;
1261 else
1262 return EmptyItem;
1263 }
1264
1265
getItem(const size_t num) const1266 const DRTControlPointSequence::Item &DRTControlPointSequence::getItem(const size_t num) const
1267 {
1268 OFListConstIterator(Item *) iterator;
1269 if (gotoItem(num, iterator).good())
1270 return **iterator;
1271 else
1272 return EmptyItem;
1273 }
1274
1275
operator [](const size_t num)1276 DRTControlPointSequence::Item &DRTControlPointSequence::operator[](const size_t num)
1277 {
1278 return getItem(num);
1279 }
1280
1281
operator [](const size_t num) const1282 const DRTControlPointSequence::Item &DRTControlPointSequence::operator[](const size_t num) const
1283 {
1284 return getItem(num);
1285 }
1286
1287
addItem(Item * & item)1288 OFCondition DRTControlPointSequence::addItem(Item *&item)
1289 {
1290 OFCondition result = EC_IllegalCall;
1291 if (!EmptyDefaultSequence)
1292 {
1293 item = new Item();
1294 if (item != NULL)
1295 {
1296 SequenceOfItems.push_back(item);
1297 result = EC_Normal;
1298 } else
1299 result = EC_MemoryExhausted;
1300 }
1301 return result;
1302 }
1303
1304
insertItem(const size_t pos,Item * & item)1305 OFCondition DRTControlPointSequence::insertItem(const size_t pos, Item *&item)
1306 {
1307 OFCondition result = EC_IllegalCall;
1308 if (!EmptyDefaultSequence)
1309 {
1310 OFListIterator(Item *) iterator;
1311 result = gotoItem(pos, iterator);
1312 if (result.good())
1313 {
1314 item = new Item();
1315 if (item != NULL)
1316 {
1317 SequenceOfItems.insert(iterator, 1, item);
1318 result = EC_Normal;
1319 } else
1320 result = EC_MemoryExhausted;
1321 } else
1322 result = addItem(item);
1323 }
1324 return result;
1325 }
1326
1327
removeItem(const size_t pos)1328 OFCondition DRTControlPointSequence::removeItem(const size_t pos)
1329 {
1330 OFCondition result = EC_IllegalCall;
1331 if (!EmptyDefaultSequence)
1332 {
1333 OFListIterator(Item *) iterator;
1334 if (gotoItem(pos, iterator).good())
1335 {
1336 delete *iterator;
1337 iterator = SequenceOfItems.erase(iterator);
1338 result = EC_Normal;
1339 } else
1340 result = EC_IllegalParameter;
1341 }
1342 return result;
1343 }
1344
1345
read(DcmItem & dataset,const OFString & card,const OFString & type,const char * moduleName)1346 OFCondition DRTControlPointSequence::read(DcmItem &dataset,
1347 const OFString &card,
1348 const OFString &type,
1349 const char *moduleName)
1350 {
1351 OFCondition result = EC_IllegalCall;
1352 if (!EmptyDefaultSequence)
1353 {
1354 /* re-initialize object */
1355 clear();
1356 /* retrieve sequence element from dataset */
1357 DcmSequenceOfItems *sequence;
1358 result = dataset.findAndGetSequence(DCM_ControlPointSequence, sequence);
1359 if (sequence != NULL)
1360 {
1361 if (checkElementValue(*sequence, card, type, result, moduleName))
1362 {
1363 DcmStack stack;
1364 OFBool first = OFTrue;
1365 /* iterate over all sequence items */
1366 while (result.good() && sequence->nextObject(stack, first /*intoSub*/).good())
1367 {
1368 DcmItem *ditem = OFstatic_cast(DcmItem *, stack.top());
1369 if (ditem != NULL)
1370 {
1371 Item *item = new Item();
1372 if (item != NULL)
1373 {
1374 result = item->read(*ditem);
1375 if (result.good())
1376 {
1377 /* append new item to the end of the list */
1378 SequenceOfItems.push_back(item);
1379 first = OFFalse;
1380 }
1381 } else
1382 result = EC_MemoryExhausted;
1383 } else
1384 result = EC_CorruptedData;
1385 }
1386 }
1387 } else {
1388 DcmSequenceOfItems element(DCM_ControlPointSequence);
1389 checkElementValue(element, card, type, result, moduleName);
1390 }
1391 }
1392 return result;
1393 }
1394
1395
write(DcmItem & dataset,const OFString & card,const OFString & type,const char * moduleName)1396 OFCondition DRTControlPointSequence::write(DcmItem &dataset,
1397 const OFString &card,
1398 const OFString &type,
1399 const char *moduleName)
1400 {
1401 OFCondition result = EC_IllegalCall;
1402 if (!EmptyDefaultSequence)
1403 {
1404 result = EC_MemoryExhausted;
1405 DcmSequenceOfItems *sequence = new DcmSequenceOfItems(DCM_ControlPointSequence);
1406 if (sequence != NULL)
1407 {
1408 result = EC_Normal;
1409 /* an empty optional sequence is not written */
1410 if ((type == "2") || !SequenceOfItems.empty())
1411 {
1412 OFListIterator(Item *) iterator = SequenceOfItems.begin();
1413 const OFListConstIterator(Item *) last = SequenceOfItems.end();
1414 /* iterate over all sequence items */
1415 while (result.good() && (iterator != last))
1416 {
1417 DcmItem *item = new DcmItem();
1418 if (item != NULL)
1419 {
1420 /* append new item to the end of the sequence */
1421 result = sequence->append(item);
1422 if (result.good())
1423 {
1424 result = (*iterator)->write(*item);
1425 ++iterator;
1426 } else
1427 delete item;
1428 } else
1429 result = EC_MemoryExhausted;
1430 }
1431 if (result.good())
1432 {
1433 /* insert sequence element into the dataset */
1434 result = dataset.insert(sequence, OFTrue /*replaceOld*/);
1435 }
1436 if (DCM_dcmrtLogger.isEnabledFor(OFLogger::WARN_LOG_LEVEL))
1437 checkElementValue(*sequence, card, type, result, moduleName);
1438 if (result.good())
1439 {
1440 /* forget reference to sequence object (avoid deletion below) */
1441 sequence = NULL;
1442 }
1443 }
1444 else if (type == "1")
1445 {
1446 /* empty type 1 sequence not allowed */
1447 result = RT_EC_InvalidValue;
1448 if (DCM_dcmrtLogger.isEnabledFor(OFLogger::WARN_LOG_LEVEL))
1449 checkElementValue(*sequence, card, type, result, moduleName);
1450 }
1451 /* delete sequence (if not inserted into the dataset) */
1452 delete sequence;
1453 }
1454 }
1455 return result;
1456 }
1457
1458
1459 // end of source file
1460