rtp-connect 1.6 → 1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/{CHANGELOG.rdoc → CHANGELOG.md} +137 -90
- data/COPYING +674 -674
- data/Gemfile +2 -2
- data/Gemfile.lock +31 -21
- data/README.md +161 -0
- data/lib/rtp-connect.rb +1 -0
- data/lib/rtp-connect/constants.rb +58 -57
- data/lib/rtp-connect/control_point.rb +158 -118
- data/lib/rtp-connect/dose_tracking.rb +37 -54
- data/lib/rtp-connect/extended_field.rb +36 -69
- data/lib/rtp-connect/extended_plan.rb +127 -0
- data/lib/rtp-connect/field.rb +158 -143
- data/lib/rtp-connect/methods.rb +85 -62
- data/lib/rtp-connect/plan.rb +645 -636
- data/lib/rtp-connect/plan_to_dcm.rb +668 -694
- data/lib/rtp-connect/prescription.rb +57 -74
- data/lib/rtp-connect/record.rb +225 -57
- data/lib/rtp-connect/ruby_extensions.rb +34 -3
- data/lib/rtp-connect/simulation_field.rb +606 -701
- data/lib/rtp-connect/site_setup.rb +112 -80
- data/lib/rtp-connect/version.rb +5 -5
- data/rakefile.rb +0 -1
- data/rtp-connect.gemspec +27 -27
- metadata +67 -58
- data/README.rdoc +0 -136
@@ -26,6 +26,17 @@ class String
|
|
26
26
|
self.split(',')
|
27
27
|
end
|
28
28
|
|
29
|
+
# Reformats a string, attempting to fix broken CSV format. Note that this
|
30
|
+
# method attempts to fix the CSV in a rather primitive, crude way: Any attributes
|
31
|
+
# containing a " character, will have these characters simply removed.
|
32
|
+
#
|
33
|
+
# @return [String] the processed string
|
34
|
+
#
|
35
|
+
def repair_csv
|
36
|
+
arr = self[1..-2].split('","')
|
37
|
+
"\"#{arr.collect{|e| e.gsub('"', '')}.join('","')}\""
|
38
|
+
end
|
39
|
+
|
29
40
|
# Removes leading & trailing double quotes from a string.
|
30
41
|
#
|
31
42
|
# @return [String] the processed string
|
@@ -38,14 +49,24 @@ class String
|
|
38
49
|
# quotation (leading and trailing double-quote characters) from the extracted
|
39
50
|
# string elements.
|
40
51
|
#
|
52
|
+
# @param [Boolean] repair if true, the method will attempt to repair a string that fails CSV processing, and then try to process it a second time
|
41
53
|
# @return [Array<String>] an array of the comma separated values
|
42
54
|
#
|
43
|
-
def values
|
55
|
+
def values(repair=false)
|
44
56
|
begin
|
45
57
|
CSV.parse(self).first
|
46
58
|
rescue StandardError => e
|
47
|
-
|
48
|
-
|
59
|
+
if repair
|
60
|
+
RTP.logger.warn("CSV processing failed. Will attempt to reformat and reprocess the string record.")
|
61
|
+
begin
|
62
|
+
CSV.parse(self.repair_csv).first
|
63
|
+
rescue StandardError => e
|
64
|
+
RTP.logger.error("Unable to parse the given string record. Probably the CSV format is invalid and beyond repair: #{self}")
|
65
|
+
end
|
66
|
+
else
|
67
|
+
RTP.logger.error("Unable to parse the given string record. Probably invalid CSV format: #{self}")
|
68
|
+
raise e
|
69
|
+
end
|
49
70
|
end
|
50
71
|
end
|
51
72
|
|
@@ -76,6 +97,16 @@ class Array
|
|
76
97
|
return wrapped.join(',')
|
77
98
|
end
|
78
99
|
|
100
|
+
# Validates the number of elements in an array and converts all elements
|
101
|
+
# to strings.
|
102
|
+
#
|
103
|
+
# @param [Integer] nr the required number of elements in the array
|
104
|
+
#
|
105
|
+
def validate_and_process(nr)
|
106
|
+
raise ArgumentError, "Invalid array length. Expected exactly #{nr} elements, got #{self.length}." unless self.length == nr
|
107
|
+
self.collect {|e| e && e.to_s.strip}
|
108
|
+
end
|
109
|
+
|
79
110
|
end
|
80
111
|
|
81
112
|
# An extension to the NilClass, facilitating a transformation from nil to
|
@@ -1,702 +1,607 @@
|
|
1
|
-
module RTP
|
2
|
-
|
3
|
-
# The simulation field class.
|
4
|
-
#
|
5
|
-
# @note Relations:
|
6
|
-
# * Parent: Prescription
|
7
|
-
# * Children: none
|
8
|
-
#
|
9
|
-
class SimulationField < Record
|
10
|
-
|
11
|
-
# The Record which this instance belongs to.
|
12
|
-
|
13
|
-
attr_reader :rx_site_name
|
14
|
-
attr_reader :field_name
|
15
|
-
attr_reader :field_id
|
16
|
-
attr_reader :field_note
|
17
|
-
attr_reader :treatment_machine
|
18
|
-
attr_reader :gantry_angle
|
19
|
-
attr_reader :collimator_angle
|
20
|
-
attr_reader :field_x_mode
|
21
|
-
attr_reader :field_x
|
22
|
-
attr_reader :collimator_x1
|
23
|
-
attr_reader :collimator_x2
|
24
|
-
attr_reader :field_y_mode
|
25
|
-
attr_reader :field_y
|
26
|
-
attr_reader :collimator_y1
|
27
|
-
attr_reader :collimator_y2
|
28
|
-
attr_reader :couch_vertical
|
29
|
-
attr_reader :couch_lateral
|
30
|
-
attr_reader :couch_longitudinal
|
31
|
-
attr_reader :couch_angle
|
32
|
-
attr_reader :couch_pedestal
|
33
|
-
attr_reader :sad
|
34
|
-
attr_reader :ap_separation
|
35
|
-
attr_reader :pa_separation
|
36
|
-
attr_reader :lateral_separation
|
37
|
-
attr_reader :tangential_separation
|
38
|
-
attr_reader :other_label_1
|
39
|
-
attr_reader :ssd_1
|
40
|
-
attr_reader :sfd_1
|
41
|
-
attr_reader :other_label_2
|
42
|
-
attr_reader :other_measurement_1
|
43
|
-
attr_reader :other_measurement_2
|
44
|
-
attr_reader :other_label_3
|
45
|
-
attr_reader :other_measurement_3
|
46
|
-
attr_reader :other_measurement_4
|
47
|
-
attr_reader :other_label_4
|
48
|
-
attr_reader :other_measurement_5
|
49
|
-
attr_reader :other_measurement_6
|
50
|
-
attr_reader :blade_x_mode
|
51
|
-
attr_reader :blade_x
|
52
|
-
attr_reader :blade_x1
|
53
|
-
attr_reader :blade_x2
|
54
|
-
attr_reader :blade_y_mode
|
55
|
-
attr_reader :blade_y
|
56
|
-
attr_reader :blade_y1
|
57
|
-
attr_reader :blade_y2
|
58
|
-
attr_reader :ii_lateral
|
59
|
-
attr_reader :ii_longitudinal
|
60
|
-
attr_reader :ii_vertical
|
61
|
-
attr_reader :kvp
|
62
|
-
attr_reader :ma
|
63
|
-
attr_reader :seconds
|
64
|
-
|
65
|
-
# Creates a new SimulationField by parsing a RTPConnect string line.
|
66
|
-
#
|
67
|
-
# @param [#to_s] string the simulation field definition record string line
|
68
|
-
# @param [Record] parent a record which is used to determine the proper parent of this instance
|
69
|
-
# @return [Field] the created SimulationField instance
|
70
|
-
# @raise [ArgumentError] if given a string containing an invalid number of elements
|
71
|
-
#
|
72
|
-
def self.load(string, parent)
|
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
|
-
#
|
284
|
-
#
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
#
|
291
|
-
#
|
292
|
-
#
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
#
|
299
|
-
#
|
300
|
-
#
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
#
|
307
|
-
#
|
308
|
-
#
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
#
|
315
|
-
#
|
316
|
-
#
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
#
|
323
|
-
#
|
324
|
-
#
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
#
|
331
|
-
#
|
332
|
-
#
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
#
|
339
|
-
#
|
340
|
-
#
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
#
|
347
|
-
#
|
348
|
-
#
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
#
|
355
|
-
#
|
356
|
-
#
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
#
|
363
|
-
#
|
364
|
-
#
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
#
|
371
|
-
#
|
372
|
-
#
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
#
|
379
|
-
#
|
380
|
-
#
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
#
|
387
|
-
#
|
388
|
-
#
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
#
|
395
|
-
#
|
396
|
-
#
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
#
|
403
|
-
#
|
404
|
-
#
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
#
|
411
|
-
#
|
412
|
-
#
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
#
|
419
|
-
#
|
420
|
-
#
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
#
|
427
|
-
#
|
428
|
-
#
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
#
|
435
|
-
#
|
436
|
-
#
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
#
|
443
|
-
#
|
444
|
-
#
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
#
|
451
|
-
#
|
452
|
-
#
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
#
|
459
|
-
#
|
460
|
-
#
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
#
|
467
|
-
#
|
468
|
-
#
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
#
|
475
|
-
#
|
476
|
-
#
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
#
|
483
|
-
#
|
484
|
-
#
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
#
|
491
|
-
#
|
492
|
-
#
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
#
|
499
|
-
#
|
500
|
-
#
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
#
|
507
|
-
#
|
508
|
-
#
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
#
|
515
|
-
#
|
516
|
-
#
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
#
|
523
|
-
#
|
524
|
-
#
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
#
|
531
|
-
#
|
532
|
-
#
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
#
|
539
|
-
#
|
540
|
-
#
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
#
|
547
|
-
#
|
548
|
-
#
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
#
|
555
|
-
#
|
556
|
-
#
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
#
|
563
|
-
#
|
564
|
-
#
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
#
|
571
|
-
#
|
572
|
-
#
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
#
|
579
|
-
#
|
580
|
-
#
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
#
|
587
|
-
#
|
588
|
-
#
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
#
|
602
|
-
#
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
end
|
608
|
-
|
609
|
-
# Sets the blade_y_mode attribute.
|
610
|
-
#
|
611
|
-
# @param [nil, #to_s] value the new attribute value
|
612
|
-
#
|
613
|
-
def blade_y_mode=(value)
|
614
|
-
@blade_y_mode = value && value.to_s
|
615
|
-
end
|
616
|
-
|
617
|
-
# Sets the blade_y attribute.
|
618
|
-
#
|
619
|
-
# @param [nil, #to_s] value the new attribute value
|
620
|
-
#
|
621
|
-
def blade_y=(value)
|
622
|
-
@blade_y = value && value.to_s
|
623
|
-
end
|
624
|
-
|
625
|
-
# Sets the blade_y1 attribute.
|
626
|
-
#
|
627
|
-
# @param [nil, #to_s] value the new attribute value
|
628
|
-
#
|
629
|
-
def blade_y1=(value)
|
630
|
-
@blade_y1 = value && value.to_s
|
631
|
-
end
|
632
|
-
|
633
|
-
# Sets the blade_y2 attribute.
|
634
|
-
#
|
635
|
-
# @param [nil, #to_s] value the new attribute value
|
636
|
-
#
|
637
|
-
def blade_y2=(value)
|
638
|
-
@blade_y2 = value && value.to_s
|
639
|
-
end
|
640
|
-
|
641
|
-
# Sets the ii_lateral attribute.
|
642
|
-
#
|
643
|
-
# @param [nil, #to_s] value the new attribute value
|
644
|
-
#
|
645
|
-
def ii_lateral=(value)
|
646
|
-
@ii_lateral = value && value.to_s
|
647
|
-
end
|
648
|
-
|
649
|
-
# Sets the ii_longitudinal attribute.
|
650
|
-
#
|
651
|
-
# @param [nil, #to_s] value the new attribute value
|
652
|
-
#
|
653
|
-
def ii_longitudinal=(value)
|
654
|
-
@ii_longitudinal = value && value.to_s
|
655
|
-
end
|
656
|
-
|
657
|
-
# Sets the ii_vertical attribute.
|
658
|
-
#
|
659
|
-
# @param [nil, #to_s] value the new attribute value
|
660
|
-
#
|
661
|
-
def ii_vertical=(value)
|
662
|
-
@ii_vertical = value && value.to_s
|
663
|
-
end
|
664
|
-
|
665
|
-
# Sets the kvp attribute.
|
666
|
-
#
|
667
|
-
# @param [nil, #to_s] value the new attribute value
|
668
|
-
#
|
669
|
-
def kvp=(value)
|
670
|
-
@kvp = value && value.to_s
|
671
|
-
end
|
672
|
-
|
673
|
-
# Sets the ma attribute.
|
674
|
-
#
|
675
|
-
# @param [nil, #to_s] value the new attribute value
|
676
|
-
#
|
677
|
-
def ma=(value)
|
678
|
-
@ma = value && value.to_s
|
679
|
-
end
|
680
|
-
|
681
|
-
# Sets the seconds attribute.
|
682
|
-
#
|
683
|
-
# @param [nil, #to_s] value the new attribute value
|
684
|
-
#
|
685
|
-
def seconds=(value)
|
686
|
-
@seconds = value && value.to_s
|
687
|
-
end
|
688
|
-
|
689
|
-
|
690
|
-
private
|
691
|
-
|
692
|
-
|
693
|
-
# Collects the attributes of this instance.
|
694
|
-
#
|
695
|
-
# @note The CRC is not considered part of the attributes of interest and is excluded
|
696
|
-
# @return [Array<String>] an array of attributes
|
697
|
-
#
|
698
|
-
alias_method :state, :values
|
699
|
-
|
700
|
-
end
|
701
|
-
|
1
|
+
module RTP
|
2
|
+
|
3
|
+
# The simulation field class.
|
4
|
+
#
|
5
|
+
# @note Relations:
|
6
|
+
# * Parent: Prescription
|
7
|
+
# * Children: none
|
8
|
+
#
|
9
|
+
class SimulationField < Record
|
10
|
+
|
11
|
+
# The Record which this instance belongs to.
|
12
|
+
attr_accessor :parent
|
13
|
+
attr_reader :rx_site_name
|
14
|
+
attr_reader :field_name
|
15
|
+
attr_reader :field_id
|
16
|
+
attr_reader :field_note
|
17
|
+
attr_reader :treatment_machine
|
18
|
+
attr_reader :gantry_angle
|
19
|
+
attr_reader :collimator_angle
|
20
|
+
attr_reader :field_x_mode
|
21
|
+
attr_reader :field_x
|
22
|
+
attr_reader :collimator_x1
|
23
|
+
attr_reader :collimator_x2
|
24
|
+
attr_reader :field_y_mode
|
25
|
+
attr_reader :field_y
|
26
|
+
attr_reader :collimator_y1
|
27
|
+
attr_reader :collimator_y2
|
28
|
+
attr_reader :couch_vertical
|
29
|
+
attr_reader :couch_lateral
|
30
|
+
attr_reader :couch_longitudinal
|
31
|
+
attr_reader :couch_angle
|
32
|
+
attr_reader :couch_pedestal
|
33
|
+
attr_reader :sad
|
34
|
+
attr_reader :ap_separation
|
35
|
+
attr_reader :pa_separation
|
36
|
+
attr_reader :lateral_separation
|
37
|
+
attr_reader :tangential_separation
|
38
|
+
attr_reader :other_label_1
|
39
|
+
attr_reader :ssd_1
|
40
|
+
attr_reader :sfd_1
|
41
|
+
attr_reader :other_label_2
|
42
|
+
attr_reader :other_measurement_1
|
43
|
+
attr_reader :other_measurement_2
|
44
|
+
attr_reader :other_label_3
|
45
|
+
attr_reader :other_measurement_3
|
46
|
+
attr_reader :other_measurement_4
|
47
|
+
attr_reader :other_label_4
|
48
|
+
attr_reader :other_measurement_5
|
49
|
+
attr_reader :other_measurement_6
|
50
|
+
attr_reader :blade_x_mode
|
51
|
+
attr_reader :blade_x
|
52
|
+
attr_reader :blade_x1
|
53
|
+
attr_reader :blade_x2
|
54
|
+
attr_reader :blade_y_mode
|
55
|
+
attr_reader :blade_y
|
56
|
+
attr_reader :blade_y1
|
57
|
+
attr_reader :blade_y2
|
58
|
+
attr_reader :ii_lateral
|
59
|
+
attr_reader :ii_longitudinal
|
60
|
+
attr_reader :ii_vertical
|
61
|
+
attr_reader :kvp
|
62
|
+
attr_reader :ma
|
63
|
+
attr_reader :seconds
|
64
|
+
|
65
|
+
# Creates a new SimulationField by parsing a RTPConnect string line.
|
66
|
+
#
|
67
|
+
# @param [#to_s] string the simulation field definition record string line
|
68
|
+
# @param [Record] parent a record which is used to determine the proper parent of this instance
|
69
|
+
# @return [Field] the created SimulationField instance
|
70
|
+
# @raise [ArgumentError] if given a string containing an invalid number of elements
|
71
|
+
#
|
72
|
+
def self.load(string, parent)
|
73
|
+
sf = self.new(parent)
|
74
|
+
sf.load(string)
|
75
|
+
end
|
76
|
+
|
77
|
+
# Creates a new SimulationField.
|
78
|
+
#
|
79
|
+
# @param [Record] parent a record which is used to determine the proper parent of this instance
|
80
|
+
#
|
81
|
+
def initialize(parent)
|
82
|
+
super('SIM_DEF', 17, 53)
|
83
|
+
# Parent relation (may get more than one type of record here):
|
84
|
+
@parent = get_parent(parent.to_record, Prescription)
|
85
|
+
@parent.add_simulation_field(self)
|
86
|
+
@attributes = [
|
87
|
+
# Required:
|
88
|
+
:keyword,
|
89
|
+
:rx_site_name,
|
90
|
+
:field_name,
|
91
|
+
:field_id,
|
92
|
+
:field_note,
|
93
|
+
:treatment_machine,
|
94
|
+
:gantry_angle,
|
95
|
+
:collimator_angle,
|
96
|
+
:field_x_mode,
|
97
|
+
:field_x,
|
98
|
+
:collimator_x1,
|
99
|
+
:collimator_x2,
|
100
|
+
:field_y_mode,
|
101
|
+
:field_y,
|
102
|
+
:collimator_y1,
|
103
|
+
:collimator_y2,
|
104
|
+
# Optional:
|
105
|
+
:couch_vertical,
|
106
|
+
:couch_lateral,
|
107
|
+
:couch_longitudinal,
|
108
|
+
:couch_angle,
|
109
|
+
:couch_pedestal,
|
110
|
+
:sad,
|
111
|
+
:ap_separation,
|
112
|
+
:pa_separation,
|
113
|
+
:lateral_separation,
|
114
|
+
:tangential_separation,
|
115
|
+
:other_label_1,
|
116
|
+
:ssd_1,
|
117
|
+
:sfd_1,
|
118
|
+
:other_label_2,
|
119
|
+
:other_measurement_1,
|
120
|
+
:other_measurement_2,
|
121
|
+
:other_label_3,
|
122
|
+
:other_measurement_3,
|
123
|
+
:other_measurement_4,
|
124
|
+
:other_label_4,
|
125
|
+
:other_measurement_5,
|
126
|
+
:other_measurement_6,
|
127
|
+
:blade_x_mode,
|
128
|
+
:blade_x,
|
129
|
+
:blade_x1,
|
130
|
+
:blade_x2,
|
131
|
+
:blade_y_mode,
|
132
|
+
:blade_y,
|
133
|
+
:blade_y1,
|
134
|
+
:blade_y2,
|
135
|
+
:ii_lateral,
|
136
|
+
:ii_longitudinal,
|
137
|
+
:ii_vertical,
|
138
|
+
:kvp,
|
139
|
+
:ma,
|
140
|
+
:seconds
|
141
|
+
]
|
142
|
+
end
|
143
|
+
|
144
|
+
# Checks for equality.
|
145
|
+
#
|
146
|
+
# Other and self are considered equivalent if they are
|
147
|
+
# of compatible types and their attributes are equivalent.
|
148
|
+
#
|
149
|
+
# @param other an object to be compared with self.
|
150
|
+
# @return [Boolean] true if self and other are considered equivalent
|
151
|
+
#
|
152
|
+
def ==(other)
|
153
|
+
if other.respond_to?(:to_simulation_field)
|
154
|
+
other.send(:state) == state
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
alias_method :eql?, :==
|
159
|
+
|
160
|
+
# Collects the child records of this instance in a properly sorted array.
|
161
|
+
#
|
162
|
+
# @return [Array] an emtpy array
|
163
|
+
#
|
164
|
+
def children
|
165
|
+
return Array.new
|
166
|
+
end
|
167
|
+
|
168
|
+
# Computes a hash code for this object.
|
169
|
+
#
|
170
|
+
# @note Two objects with the same attributes will have the same hash code.
|
171
|
+
#
|
172
|
+
# @return [Fixnum] the object's hash code
|
173
|
+
#
|
174
|
+
def hash
|
175
|
+
state.hash
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns self.
|
179
|
+
#
|
180
|
+
# @return [SimulationField] self
|
181
|
+
#
|
182
|
+
def to_simulation_field
|
183
|
+
self
|
184
|
+
end
|
185
|
+
|
186
|
+
# Sets the rx_site_name attribute.
|
187
|
+
#
|
188
|
+
# @param [nil, #to_s] value the new attribute value
|
189
|
+
#
|
190
|
+
def rx_site_name=(value)
|
191
|
+
@rx_site_name = value && value.to_s
|
192
|
+
end
|
193
|
+
|
194
|
+
# Sets the field_name attribute.
|
195
|
+
#
|
196
|
+
# @param [nil, #to_s] value the new attribute value
|
197
|
+
#
|
198
|
+
def field_name=(value)
|
199
|
+
@field_name = value && value.to_s
|
200
|
+
end
|
201
|
+
|
202
|
+
# Sets the field_id attribute.
|
203
|
+
#
|
204
|
+
# @param [nil, #to_s] value the new attribute value
|
205
|
+
#
|
206
|
+
def field_id=(value)
|
207
|
+
@field_id = value && value.to_s
|
208
|
+
end
|
209
|
+
|
210
|
+
# Sets the field_note attribute.
|
211
|
+
#
|
212
|
+
# @param [nil, #to_s] value the new attribute value
|
213
|
+
#
|
214
|
+
def field_note=(value)
|
215
|
+
@field_note = value && value.to_s
|
216
|
+
end
|
217
|
+
|
218
|
+
# Sets the treatment_machine attribute.
|
219
|
+
#
|
220
|
+
# @param [nil, #to_s] value the new attribute value
|
221
|
+
#
|
222
|
+
def treatment_machine=(value)
|
223
|
+
@treatment_machine = value && value.to_s
|
224
|
+
end
|
225
|
+
|
226
|
+
# Sets the gantry_angle attribute.
|
227
|
+
#
|
228
|
+
# @param [nil, #to_s] value the new attribute value
|
229
|
+
#
|
230
|
+
def gantry_angle=(value)
|
231
|
+
@gantry_angle = value && value.to_s.strip
|
232
|
+
end
|
233
|
+
|
234
|
+
# Sets the collimator_angle attribute.
|
235
|
+
#
|
236
|
+
# @param [nil, #to_s] value the new attribute value
|
237
|
+
#
|
238
|
+
def collimator_angle=(value)
|
239
|
+
@collimator_angle = value && value.to_s.strip
|
240
|
+
end
|
241
|
+
|
242
|
+
# Sets the field_x_mode attribute.
|
243
|
+
#
|
244
|
+
# @param [nil, #to_s] value the new attribute value
|
245
|
+
#
|
246
|
+
def field_x_mode=(value)
|
247
|
+
@field_x_mode = value && value.to_s
|
248
|
+
end
|
249
|
+
|
250
|
+
# Sets the field_x attribute.
|
251
|
+
#
|
252
|
+
# @param [nil, #to_s] value the new attribute value
|
253
|
+
#
|
254
|
+
def field_x=(value)
|
255
|
+
@field_x = value && value.to_s.strip
|
256
|
+
end
|
257
|
+
|
258
|
+
# Sets the collimator_x1 attribute.
|
259
|
+
#
|
260
|
+
# @param [nil, #to_s] value the new attribute value
|
261
|
+
#
|
262
|
+
def collimator_x1=(value)
|
263
|
+
@collimator_x1 = value && value.to_s.strip
|
264
|
+
end
|
265
|
+
|
266
|
+
# Sets the collimator_x2 attribute.
|
267
|
+
#
|
268
|
+
# @param [nil, #to_s] value the new attribute value
|
269
|
+
#
|
270
|
+
def collimator_x2=(value)
|
271
|
+
@collimator_x2 = value && value.to_s.strip
|
272
|
+
end
|
273
|
+
|
274
|
+
# Sets the field_y_mode attribute.
|
275
|
+
#
|
276
|
+
# @param [nil, #to_s] value the new attribute value
|
277
|
+
#
|
278
|
+
def field_y_mode=(value)
|
279
|
+
@field_y_mode = value && value.to_s
|
280
|
+
end
|
281
|
+
|
282
|
+
# Sets the field_y attribute.
|
283
|
+
#
|
284
|
+
# @param [nil, #to_s] value the new attribute value
|
285
|
+
#
|
286
|
+
def field_y=(value)
|
287
|
+
@field_y = value && value.to_s.strip
|
288
|
+
end
|
289
|
+
|
290
|
+
# Sets the collimator_y1 attribute.
|
291
|
+
#
|
292
|
+
# @param [nil, #to_s] value the new attribute value
|
293
|
+
#
|
294
|
+
def collimator_y1=(value)
|
295
|
+
@collimator_y1 = value && value.to_s.strip
|
296
|
+
end
|
297
|
+
|
298
|
+
# Sets the collimator_y2 attribute.
|
299
|
+
#
|
300
|
+
# @param [nil, #to_s] value the new attribute value
|
301
|
+
#
|
302
|
+
def collimator_y2=(value)
|
303
|
+
@collimator_y2 = value && value.to_s.strip
|
304
|
+
end
|
305
|
+
|
306
|
+
# Sets the couch_vertical attribute.
|
307
|
+
#
|
308
|
+
# @param [nil, #to_s] value the new attribute value
|
309
|
+
#
|
310
|
+
def couch_vertical=(value)
|
311
|
+
@couch_vertical = value && value.to_s.strip
|
312
|
+
end
|
313
|
+
|
314
|
+
# Sets the couch_lateral attribute.
|
315
|
+
#
|
316
|
+
# @param [nil, #to_s] value the new attribute value
|
317
|
+
#
|
318
|
+
def couch_lateral=(value)
|
319
|
+
@couch_lateral = value && value.to_s.strip
|
320
|
+
end
|
321
|
+
|
322
|
+
# Sets the couch_longitudinal attribute.
|
323
|
+
#
|
324
|
+
# @param [nil, #to_s] value the new attribute value
|
325
|
+
#
|
326
|
+
def couch_longitudinal=(value)
|
327
|
+
@couch_longitudinal = value && value.to_s.strip
|
328
|
+
end
|
329
|
+
|
330
|
+
# Sets the couch_angle attribute.
|
331
|
+
#
|
332
|
+
# @param [nil, #to_s] value the new attribute value
|
333
|
+
#
|
334
|
+
def couch_angle=(value)
|
335
|
+
@couch_angle = value && value.to_s.strip.strip
|
336
|
+
end
|
337
|
+
|
338
|
+
# Sets the couch_pedestal attribute.
|
339
|
+
#
|
340
|
+
# @param [nil, #to_s] value the new attribute value
|
341
|
+
#
|
342
|
+
def couch_pedestal=(value)
|
343
|
+
@couch_pedestal = value && value.to_s.strip
|
344
|
+
end
|
345
|
+
|
346
|
+
# Sets the sad attribute.
|
347
|
+
#
|
348
|
+
# @param [nil, #to_s] value the new attribute value
|
349
|
+
#
|
350
|
+
def sad=(value)
|
351
|
+
@sad = value && value.to_s.strip
|
352
|
+
end
|
353
|
+
|
354
|
+
# Sets the ap_separation attribute.
|
355
|
+
#
|
356
|
+
# @param [nil, #to_s] value the new attribute value
|
357
|
+
#
|
358
|
+
def ap_separation=(value)
|
359
|
+
@ap_separation = value && value.to_s
|
360
|
+
end
|
361
|
+
|
362
|
+
# Sets the pa_separation attribute.
|
363
|
+
#
|
364
|
+
# @param [nil, #to_s] value the new attribute value
|
365
|
+
#
|
366
|
+
def pa_separation=(value)
|
367
|
+
@pa_separation = value && value.to_s.strip
|
368
|
+
end
|
369
|
+
|
370
|
+
# Sets the lateral_separation attribute.
|
371
|
+
#
|
372
|
+
# @param [nil, #to_s] value the new attribute value
|
373
|
+
#
|
374
|
+
def lateral_separation=(value)
|
375
|
+
@lateral_separation = value && value.to_s.strip
|
376
|
+
end
|
377
|
+
|
378
|
+
# Sets the tangential_separation attribute.
|
379
|
+
#
|
380
|
+
# @param [nil, #to_s] value the new attribute value
|
381
|
+
#
|
382
|
+
def tangential_separation=(value)
|
383
|
+
@tangential_separation = value && value.to_s.strip
|
384
|
+
end
|
385
|
+
|
386
|
+
# Sets the other_label_1 attribute.
|
387
|
+
#
|
388
|
+
# @param [nil, #to_s] value the new attribute value
|
389
|
+
#
|
390
|
+
def other_label_1=(value)
|
391
|
+
@other_label_1 = value && value.to_s
|
392
|
+
end
|
393
|
+
|
394
|
+
# Sets the ssd_1 attribute.
|
395
|
+
#
|
396
|
+
# @param [nil, #to_s] value the new attribute value
|
397
|
+
#
|
398
|
+
def ssd_1=(value)
|
399
|
+
@ssd_1 = value && value.to_s
|
400
|
+
end
|
401
|
+
|
402
|
+
# Sets the sfd_1 attribute.
|
403
|
+
#
|
404
|
+
# @param [nil, #to_s] value the new attribute value
|
405
|
+
#
|
406
|
+
def sfd_1=(value)
|
407
|
+
@sfd_1 = value && value.to_s
|
408
|
+
end
|
409
|
+
|
410
|
+
# Sets the other_label_2 attribute.
|
411
|
+
#
|
412
|
+
# @param [nil, #to_s] value the new attribute value
|
413
|
+
#
|
414
|
+
def other_label_2=(value)
|
415
|
+
@other_label_2 = value && value.to_s
|
416
|
+
end
|
417
|
+
|
418
|
+
# Sets the other_measurement_1 attribute.
|
419
|
+
#
|
420
|
+
# @param [nil, #to_s] value the new attribute value
|
421
|
+
#
|
422
|
+
def other_measurement_1=(value)
|
423
|
+
@other_measurement_1 = value && value.to_s
|
424
|
+
end
|
425
|
+
|
426
|
+
# Sets the other_measurement_2 attribute.
|
427
|
+
#
|
428
|
+
# @param [nil, #to_s] value the new attribute value
|
429
|
+
#
|
430
|
+
def other_measurement_2=(value)
|
431
|
+
@other_measurement_2 = value && value.to_s
|
432
|
+
end
|
433
|
+
|
434
|
+
# Sets the other_label_3 attribute.
|
435
|
+
#
|
436
|
+
# @param [nil, #to_s] value the new attribute value
|
437
|
+
#
|
438
|
+
def other_label_3=(value)
|
439
|
+
@other_label_3 = value && value.to_s
|
440
|
+
end
|
441
|
+
|
442
|
+
# Sets the other_measurement_3 attribute.
|
443
|
+
#
|
444
|
+
# @param [nil, #to_s] value the new attribute value
|
445
|
+
#
|
446
|
+
def other_measurement_3=(value)
|
447
|
+
@other_measurement_3 = value && value.to_s
|
448
|
+
end
|
449
|
+
|
450
|
+
# Sets the other_measurement_4 attribute.
|
451
|
+
#
|
452
|
+
# @param [nil, #to_s] value the new attribute value
|
453
|
+
#
|
454
|
+
def other_measurement_4=(value)
|
455
|
+
@other_measurement_4 = value && value.to_s
|
456
|
+
end
|
457
|
+
|
458
|
+
# Sets the other_label_4 attribute.
|
459
|
+
#
|
460
|
+
# @param [nil, #to_s] value the new attribute value
|
461
|
+
#
|
462
|
+
def other_label_4=(value)
|
463
|
+
@other_label_4 = value && value.to_s
|
464
|
+
end
|
465
|
+
|
466
|
+
# Sets the other_measurement_5 attribute.
|
467
|
+
#
|
468
|
+
# @param [nil, #to_s] value the new attribute value
|
469
|
+
#
|
470
|
+
def other_measurement_5=(value)
|
471
|
+
@other_measurement_5 = value && value.to_s
|
472
|
+
end
|
473
|
+
|
474
|
+
# Sets the other_measurement_6 attribute.
|
475
|
+
#
|
476
|
+
# @param [nil, #to_s] value the new attribute value
|
477
|
+
#
|
478
|
+
def other_measurement_6=(value)
|
479
|
+
@other_measurement_6 = value && value.to_s
|
480
|
+
end
|
481
|
+
|
482
|
+
# Sets the blade_x_mode attribute.
|
483
|
+
#
|
484
|
+
# @param [nil, #to_s] value the new attribute value
|
485
|
+
#
|
486
|
+
def blade_x_mode=(value)
|
487
|
+
@blade_x_mode = value && value.to_s
|
488
|
+
end
|
489
|
+
|
490
|
+
# Sets the blade_x attribute.
|
491
|
+
#
|
492
|
+
# @param [nil, #to_s] value the new attribute value
|
493
|
+
#
|
494
|
+
def blade_x=(value)
|
495
|
+
@blade_x = value && value.to_s
|
496
|
+
end
|
497
|
+
|
498
|
+
# Sets the blade_x1 attribute.
|
499
|
+
#
|
500
|
+
# @param [nil, #to_s] value the new attribute value
|
501
|
+
#
|
502
|
+
def blade_x1=(value)
|
503
|
+
@blade_x1 = value && value.to_s
|
504
|
+
end
|
505
|
+
|
506
|
+
# Sets the blade_x2 attribute.
|
507
|
+
#
|
508
|
+
# @param [nil, #to_s] value the new attribute value
|
509
|
+
#
|
510
|
+
def blade_x2=(value)
|
511
|
+
@blade_x2 = value && value.to_s
|
512
|
+
end
|
513
|
+
|
514
|
+
# Sets the blade_y_mode attribute.
|
515
|
+
#
|
516
|
+
# @param [nil, #to_s] value the new attribute value
|
517
|
+
#
|
518
|
+
def blade_y_mode=(value)
|
519
|
+
@blade_y_mode = value && value.to_s
|
520
|
+
end
|
521
|
+
|
522
|
+
# Sets the blade_y attribute.
|
523
|
+
#
|
524
|
+
# @param [nil, #to_s] value the new attribute value
|
525
|
+
#
|
526
|
+
def blade_y=(value)
|
527
|
+
@blade_y = value && value.to_s
|
528
|
+
end
|
529
|
+
|
530
|
+
# Sets the blade_y1 attribute.
|
531
|
+
#
|
532
|
+
# @param [nil, #to_s] value the new attribute value
|
533
|
+
#
|
534
|
+
def blade_y1=(value)
|
535
|
+
@blade_y1 = value && value.to_s
|
536
|
+
end
|
537
|
+
|
538
|
+
# Sets the blade_y2 attribute.
|
539
|
+
#
|
540
|
+
# @param [nil, #to_s] value the new attribute value
|
541
|
+
#
|
542
|
+
def blade_y2=(value)
|
543
|
+
@blade_y2 = value && value.to_s
|
544
|
+
end
|
545
|
+
|
546
|
+
# Sets the ii_lateral attribute.
|
547
|
+
#
|
548
|
+
# @param [nil, #to_s] value the new attribute value
|
549
|
+
#
|
550
|
+
def ii_lateral=(value)
|
551
|
+
@ii_lateral = value && value.to_s
|
552
|
+
end
|
553
|
+
|
554
|
+
# Sets the ii_longitudinal attribute.
|
555
|
+
#
|
556
|
+
# @param [nil, #to_s] value the new attribute value
|
557
|
+
#
|
558
|
+
def ii_longitudinal=(value)
|
559
|
+
@ii_longitudinal = value && value.to_s
|
560
|
+
end
|
561
|
+
|
562
|
+
# Sets the ii_vertical attribute.
|
563
|
+
#
|
564
|
+
# @param [nil, #to_s] value the new attribute value
|
565
|
+
#
|
566
|
+
def ii_vertical=(value)
|
567
|
+
@ii_vertical = value && value.to_s
|
568
|
+
end
|
569
|
+
|
570
|
+
# Sets the kvp attribute.
|
571
|
+
#
|
572
|
+
# @param [nil, #to_s] value the new attribute value
|
573
|
+
#
|
574
|
+
def kvp=(value)
|
575
|
+
@kvp = value && value.to_s
|
576
|
+
end
|
577
|
+
|
578
|
+
# Sets the ma attribute.
|
579
|
+
#
|
580
|
+
# @param [nil, #to_s] value the new attribute value
|
581
|
+
#
|
582
|
+
def ma=(value)
|
583
|
+
@ma = value && value.to_s
|
584
|
+
end
|
585
|
+
|
586
|
+
# Sets the seconds attribute.
|
587
|
+
#
|
588
|
+
# @param [nil, #to_s] value the new attribute value
|
589
|
+
#
|
590
|
+
def seconds=(value)
|
591
|
+
@seconds = value && value.to_s
|
592
|
+
end
|
593
|
+
|
594
|
+
|
595
|
+
private
|
596
|
+
|
597
|
+
|
598
|
+
# Collects the attributes of this instance.
|
599
|
+
#
|
600
|
+
# @note The CRC is not considered part of the attributes of interest and is excluded
|
601
|
+
# @return [Array<String>] an array of attributes
|
602
|
+
#
|
603
|
+
alias_method :state, :values
|
604
|
+
|
605
|
+
end
|
606
|
+
|
702
607
|
end
|