rtp-connect 1.1 → 1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,222 @@
1
+ module RTP
2
+
3
+ # The DoseTracking class.
4
+ #
5
+ # @note Relations:
6
+ # * Parent: Plan
7
+ # * Children: none
8
+ #
9
+ class DoseTracking < Record
10
+
11
+ # The Record which this instance belongs to.
12
+ attr_reader :parent
13
+ # The DoseAction records (if any) that belongs to this DoseTracking.
14
+ attr_reader :dose_actions
15
+ attr_reader :region_name
16
+ attr_reader :region_prior_dose
17
+ # Note: This attribute contains an array of all field_id values (1..10).
18
+ attr_reader :field_ids
19
+ # Note: This attribute contains an array of all reg_coeff values (1..10).
20
+ attr_reader :region_coeffs
21
+ attr_reader :actual_dose
22
+ attr_reader :actual_fractions
23
+
24
+ # Creates a new DoseTracking by parsing a RTPConnect string line.
25
+ #
26
+ # @param [#to_s] string the dose tracking definition record string line
27
+ # @param [Record] parent a record which is used to determine the proper parent of this instance
28
+ # @return [DoseTracking] the created DoseTracking instance
29
+ # @raise [ArgumentError] if given a string containing an invalid number of elements
30
+ #
31
+ def self.load(string, parent)
32
+ # Get the quote-less values:
33
+ values = string.to_s.values
34
+ raise ArgumentError, "Invalid argument 'string': Expected exactly 26 elements, got #{values.length}." unless values.length == 26
35
+ d = self.new(parent)
36
+ # Assign the values to attributes:
37
+ d.keyword = values[0]
38
+ d.region_name = values[1]
39
+ d.region_prior_dose = values[2]
40
+ d.field_ids = values.values_at(3, 5, 7, 9, 11, 13, 15, 17, 19, 21)
41
+ d.region_coeffs = values.values_at(4, 6, 8, 10, 12, 14, 16, 18, 20, 22)
42
+ d.actual_dose = values[23]
43
+ d.actual_fractions = values[24]
44
+ d.crc = values[25]
45
+ return d
46
+ end
47
+
48
+ # Creates a new DoseTracking.
49
+ #
50
+ # @param [Record] parent a record which is used to determine the proper parent of this instance
51
+ #
52
+ def initialize(parent)
53
+ # Child records:
54
+ @dose_actions = Array.new
55
+ # Parent relation (may get more than one type of record here):
56
+ @parent = get_parent(parent.to_record, Plan)
57
+ @parent.add_dose_tracking(self)
58
+ @keyword = 'DOSE_DEF'
59
+ @field_ids = Array.new(10)
60
+ @region_coeffs = Array.new(10)
61
+ end
62
+
63
+ # Checks for equality.
64
+ #
65
+ # Other and self are considered equivalent if they are
66
+ # of compatible types and their attributes are equivalent.
67
+ #
68
+ # @param other an object to be compared with self.
69
+ # @return [Boolean] true if self and other are considered equivalent
70
+ #
71
+ def ==(other)
72
+ if other.respond_to?(:to_dose_tracking)
73
+ other.send(:state) == state
74
+ end
75
+ end
76
+
77
+ alias_method :eql?, :==
78
+
79
+ # As of now, gives an empty array. However, by definition, this record may
80
+ # have dose action (point) records as children, but this is not implemented yet.
81
+ #
82
+ # @return [Array] an emtpy array
83
+ #
84
+ def children
85
+ #return @dose_actions
86
+ return Array.new
87
+ end
88
+
89
+ # Computes a hash code for this object.
90
+ #
91
+ # @note Two objects with the same attributes will have the same hash code.
92
+ #
93
+ # @return [Fixnum] the object's hash code
94
+ #
95
+ def hash
96
+ state.hash
97
+ end
98
+
99
+ # Collects the values (attributes) of this instance.
100
+ #
101
+ # @note The CRC is not considered part of the actual values and is excluded.
102
+ # @return [Array<String>] an array of attributes (in the same order as they appear in the RTP string)
103
+ #
104
+ def values
105
+ return [
106
+ @keyword,
107
+ @region_name,
108
+ @region_prior_dose,
109
+ # Need to join every other two elements from these two arrays together:
110
+ *@field_ids.zip(@region_coeffs).flatten,
111
+ @actual_dose,
112
+ @actual_fractions
113
+ ]
114
+ end
115
+
116
+ # Returns self.
117
+ #
118
+ # @return [DoseTracking] self
119
+ #
120
+ def to_dose_tracking
121
+ self
122
+ end
123
+
124
+ # Encodes the DoseTracking object + any hiearchy of child objects,
125
+ # to a properly formatted RTPConnect ascii string.
126
+ #
127
+ # @return [String] an RTP string with a single or multiple lines/records
128
+ #
129
+ def to_s
130
+ str = encode
131
+ if children
132
+ children.each do |child|
133
+ str += child.to_s
134
+ end
135
+ end
136
+ return str
137
+ end
138
+
139
+ alias :to_str :to_s
140
+
141
+ # Sets the field_ids attribute.
142
+ #
143
+ # @note As opposed to the ordinary (string) attributes, this attribute
144
+ # contains an array holding all 10 Field ID string values.
145
+ # @param [Array<nil, #to_s>] array the new attribute values
146
+ #
147
+ def field_ids=(array)
148
+ array = array.to_a
149
+ raise ArgumentError, "Invalid argument 'array'. Expected length 10, got #{array.length}." unless array.length == 10
150
+ @field_ids = array.collect! {|e| e && e.to_s}
151
+ end
152
+
153
+ # Sets the region_coeffs attribute.
154
+ #
155
+ # @note As opposed to the ordinary (string) attributes, this attribute
156
+ # contains an array holding all 10 Region Coeff string values.
157
+ # @param [Array<nil, #to_s>] array the new attribute values
158
+ #
159
+ def region_coeffs=(array)
160
+ array = array.to_a
161
+ raise ArgumentError, "Invalid argument 'array'. Expected length 10, got #{array.length}." unless array.length == 10
162
+ @region_coeffs = array.collect! {|e| e && e.to_s}
163
+ end
164
+
165
+ # Sets the keyword attribute.
166
+ #
167
+ # @note Since only a specific string is accepted, this is more of an argument check than a traditional setter method
168
+ # @param [#to_s] value the new attribute value
169
+ # @raise [ArgumentError] if given an unexpected keyword
170
+ #
171
+ def keyword=(value)
172
+ value = value.to_s.upcase
173
+ raise ArgumentError, "Invalid keyword. Expected 'DOSE_DEF', got #{value}." unless value == "DOSE_DEF"
174
+ @keyword = value
175
+ end
176
+
177
+ # Sets the region_name attribute.
178
+ #
179
+ # @param [nil, #to_s] value the new attribute value
180
+ #
181
+ def region_name=(value)
182
+ @region_name = value && value.to_s
183
+ end
184
+
185
+ # Sets the region_prior_dose attribute.
186
+ #
187
+ # @param [nil, #to_s] value the new attribute value
188
+ #
189
+ def region_prior_dose=(value)
190
+ @region_prior_dose = value && value.to_s
191
+ end
192
+
193
+ # Sets the actual_dose attribute.
194
+ #
195
+ # @param [nil, #to_s] value the new attribute value
196
+ #
197
+ def actual_dose=(value)
198
+ @actual_dose = value && value.to_s
199
+ end
200
+
201
+ # Sets the actual_fractions attribute.
202
+ #
203
+ # @param [nil, #to_s] value the new attribute value
204
+ #
205
+ def actual_fractions=(value)
206
+ @actual_fractions = value && value.to_s
207
+ end
208
+
209
+
210
+ private
211
+
212
+
213
+ # Collects the attributes of this instance.
214
+ #
215
+ # @note The CRC is not considered part of the attributes of interest and is excluded
216
+ # @return [Array<String>] an array of attributes
217
+ #
218
+ alias_method :state, :values
219
+
220
+ end
221
+
222
+ end
@@ -2,10 +2,9 @@ module RTP
2
2
 
3
3
  # The ExtendedField class.
4
4
  #
5
- # === Relations
6
- #
7
- # * Parent: Field
8
- # * Children: none
5
+ # @note Relations:
6
+ # * Parent: Field
7
+ # * Children: none
9
8
  #
10
9
  class ExtendedField < Record
11
10
 
@@ -18,31 +17,29 @@ module RTP
18
17
 
19
18
  # Creates a new (treatment) ExtendedField by parsing a RTPConnect string line.
20
19
  #
21
- # === Parameters
22
- #
23
- # * <tt>string</tt> -- A string containing an extended treatment field record.
24
- # * <tt>parent</tt> -- A Record which is used to determine the proper parent of this instance.
20
+ # @param [#to_s] string the extended treatment field definition record string line
21
+ # @param [Record] parent a record which is used to determine the proper parent of this instance
22
+ # @return [ExtendedField] the created ExtendedField instance
23
+ # @raise [ArgumentError] if given a string containing an invalid number of elements
25
24
  #
26
25
  def self.load(string, parent)
27
26
  # Get the quote-less values:
28
27
  values = string.to_s.values
29
28
  raise ArgumentError, "Invalid argument 'string': Expected exactly 6 elements, got #{values.length}." unless values.length == 6
30
- f = self.new(parent)
29
+ ef = self.new(parent)
31
30
  # Assign the values to attributes:
32
- f.keyword = values[0]
33
- f.field_id = values[1]
34
- f.original_plan_uid = values[2]
35
- f.original_beam_number = values[3]
36
- f.original_beam_name = values[4]
37
- f.crc = values[5]
38
- return f
31
+ ef.keyword = values[0]
32
+ ef.field_id = values[1]
33
+ ef.original_plan_uid = values[2]
34
+ ef.original_beam_number = values[3]
35
+ ef.original_beam_name = values[4]
36
+ ef.crc = values[5]
37
+ return ef
39
38
  end
40
39
 
41
40
  # Creates a new (treatment) ExtendedField.
42
41
  #
43
- # === Parameters
44
- #
45
- # * <tt>parent</tt> -- A Record which is used to determine the proper parent of this instance.
42
+ # @param [Record] parent a record which is used to determine the proper parent of this instance
46
43
  #
47
44
  def initialize(parent)
48
45
  # Parent relation (may get more than one type of record here):
@@ -51,7 +48,13 @@ module RTP
51
48
  @keyword = 'EXTENDED_FIELD_DEF'
52
49
  end
53
50
 
54
- # Returns true if the argument is an instance with attributes equal to self.
51
+ # Checks for equality.
52
+ #
53
+ # Other and self are considered equivalent if they are
54
+ # of compatible types and their attributes are equivalent.
55
+ #
56
+ # @param other an object to be compared with self.
57
+ # @return [Boolean] true if self and other are considered equivalent
55
58
  #
56
59
  def ==(other)
57
60
  if other.respond_to?(:to_extended_field)
@@ -61,20 +64,28 @@ module RTP
61
64
 
62
65
  alias_method :eql?, :==
63
66
 
64
- # Returns an empty array, as these instances are child-less by definition.
67
+ # Gives an empty array, as these instances are child-less by definition.
68
+ #
69
+ # @return [Array] an emtpy array
65
70
  #
66
71
  def children
67
72
  return Array.new
68
73
  end
69
74
 
70
- # Generates a Fixnum hash value for this instance.
75
+ # Computes a hash code for this object.
76
+ #
77
+ # @note Two objects with the same attributes will have the same hash code.
78
+ #
79
+ # @return [Fixnum] the object's hash code
71
80
  #
72
81
  def hash
73
82
  state.hash
74
83
  end
75
84
 
76
- # Returns the values of this instance in an array.
77
- # The values does not include the CRC.
85
+ # Collects the values (attributes) of this instance.
86
+ #
87
+ # @note The CRC is not considered part of the actual values and is excluded.
88
+ # @return [Array<String>] an array of attributes (in the same order as they appear in the RTP string)
78
89
  #
79
90
  def values
80
91
  return [
@@ -88,13 +99,17 @@ module RTP
88
99
 
89
100
  # Returns self.
90
101
  #
102
+ # @return [ExtendedField] self
103
+ #
91
104
  def to_extended_field
92
105
  self
93
106
  end
94
107
 
95
- # Writes the ExtendedField object + any hiearchy of child objects,
108
+ # Encodes the ExtendedField object + any hiearchy of child objects,
96
109
  # to a properly formatted RTPConnect ascii string.
97
110
  #
111
+ # @return [String] an RTP string with a single or multiple lines/records
112
+ #
98
113
  def to_s
99
114
  str = encode
100
115
  if children
@@ -109,6 +124,10 @@ module RTP
109
124
 
110
125
  # Sets the keyword attribute.
111
126
  #
127
+ # @note Since only a specific string is accepted, this is more of an argument check than a traditional setter method
128
+ # @param [#to_s] value the new attribute value
129
+ # @raise [ArgumentError] if given an unexpected keyword
130
+ #
112
131
  def keyword=(value)
113
132
  value = value.to_s.upcase
114
133
  raise ArgumentError, "Invalid keyword. Expected 'EXTENDED_FIELD_DEF', got #{value}." unless value == "EXTENDED_FIELD_DEF"
@@ -117,24 +136,32 @@ module RTP
117
136
 
118
137
  # Sets the field_id attribute.
119
138
  #
139
+ # @param [nil, #to_s] value the new attribute value
140
+ #
120
141
  def field_id=(value)
121
142
  @field_id = value && value.to_s
122
143
  end
123
144
 
124
145
  # Sets the original_plan_uid attribute.
125
146
  #
147
+ # @param [nil, #to_s] value the new attribute value
148
+ #
126
149
  def original_plan_uid=(value)
127
150
  @original_plan_uid = value && value.to_s
128
151
  end
129
152
 
130
153
  # Sets the original_beam_number attribute.
131
154
  #
155
+ # @param [nil, #to_s] value the new attribute value
156
+ #
132
157
  def original_beam_number=(value)
133
158
  @original_beam_number = value && value.to_s
134
159
  end
135
160
 
136
161
  # Sets the original_beam_name attribute.
137
162
  #
163
+ # @param [nil, #to_s] value the new attribute value
164
+ #
138
165
  def original_beam_name=(value)
139
166
  @original_beam_name = value && value.to_s
140
167
  end
@@ -143,7 +170,10 @@ module RTP
143
170
  private
144
171
 
145
172
 
146
- # Returns the attributes of this instance in an array (for comparison purposes).
173
+ # Collects the attributes of this instance.
174
+ #
175
+ # @note The CRC is not considered part of the attributes of interest and is excluded
176
+ # @return [Array<String>] an array of attributes
147
177
  #
148
178
  alias_method :state, :values
149
179
 
@@ -2,10 +2,9 @@ module RTP
2
2
 
3
3
  # The treatment Field class.
4
4
  #
5
- # === Relations
6
- #
7
- # * Parent: Prescription
8
- # * Children: ExtendedField, ControlPoint
5
+ # @note Relations:
6
+ # * Parent: Prescription
7
+ # * Children: ExtendedField, ControlPoint
9
8
  #
10
9
  class Field < Record
11
10
 
@@ -65,10 +64,10 @@ module RTP
65
64
 
66
65
  # Creates a new (treatment) Field by parsing a RTPConnect string line.
67
66
  #
68
- # === Parameters
69
- #
70
- # * <tt>string</tt> -- A string containing a treatment field record.
71
- # * <tt>parent</tt> -- A Record which is used to determine the proper parent of this instance.
67
+ # @param [#to_s] string the treatment 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 Field instance
70
+ # @raise [ArgumentError] if given a string containing an invalid number of elements
72
71
  #
73
72
  def self.load(string, parent)
74
73
  # Get the quote-less values:
@@ -130,9 +129,7 @@ module RTP
130
129
 
131
130
  # Creates a new (treatment) Field.
132
131
  #
133
- # === Parameters
134
- #
135
- # * <tt>parent</tt> -- A Record which is used to determine the proper parent of this instance.
132
+ # @param [Record] parent a record which is used to determine the proper parent of this instance
136
133
  #
137
134
  def initialize(parent)
138
135
  # Child records:
@@ -144,7 +141,13 @@ module RTP
144
141
  @keyword = 'FIELD_DEF'
145
142
  end
146
143
 
147
- # Returns true if the argument is an instance with attributes equal to self.
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
148
151
  #
149
152
  def ==(other)
150
153
  if other.respond_to?(:to_field)
@@ -156,30 +159,42 @@ module RTP
156
159
 
157
160
  # Adds a control point record to this instance.
158
161
  #
162
+ # @param [ControlPoint] child a ControlPoint instance which is to be associated with self
163
+ #
159
164
  def add_control_point(child)
160
165
  @control_points << child.to_control_point
161
166
  end
162
167
 
163
- # Connects an extended treatment field record to this instance.
168
+ # Adds an extended treatment field record to this instance.
169
+ #
170
+ # @param [ExtendedField] child an ExtendedField instance which is to be associated with self
164
171
  #
165
172
  def add_extended_field(child)
166
173
  @extended_field = child.to_extended_field
167
174
  end
168
175
 
169
- # Returns nil, as these instances are child-less by definition.
176
+ # Collects the child records of this instance in a properly sorted array.
177
+ #
178
+ # @return [Array<ExtendedField, ControlPoint>] a sorted array of self's child records
170
179
  #
171
180
  def children
172
181
  return [@extended_field, @control_points].flatten.compact
173
182
  end
174
183
 
175
- # Generates a Fixnum hash value for this instance.
184
+ # Computes a hash code for this object.
185
+ #
186
+ # @note Two objects with the same attributes will have the same hash code.
187
+ #
188
+ # @return [Fixnum] the object's hash code
176
189
  #
177
190
  def hash
178
191
  state.hash
179
192
  end
180
193
 
181
- # Returns the values of this instance in an array.
182
- # The values does not include the CRC.
194
+ # Collects the values (attributes) of this instance.
195
+ #
196
+ # @note The CRC is not considered part of the actual values and is excluded.
197
+ # @return [Array<String>] an array of attributes (in the same order as they appear in the RTP string)
183
198
  #
184
199
  def values
185
200
  return [
@@ -236,13 +251,17 @@ module RTP
236
251
 
237
252
  # Returns self.
238
253
  #
254
+ # @return [Field] self
255
+ #
239
256
  def to_field
240
257
  self
241
258
  end
242
259
 
243
- # Writes the Field object + any hiearchy of child objects,
260
+ # Encodes the Field object + any hiearchy of child objects,
244
261
  # to a properly formatted RTPConnect ascii string.
245
262
  #
263
+ # @return [String] an RTP string with a single or multiple lines/records
264
+ #
246
265
  def to_s
247
266
  str = encode
248
267
  if children
@@ -257,6 +276,10 @@ module RTP
257
276
 
258
277
  # Sets the keyword attribute.
259
278
  #
279
+ # @note Since only a specific string is accepted, this is more of an argument check than a traditional setter method
280
+ # @param [#to_s] value the new attribute value
281
+ # @raise [ArgumentError] if given an unexpected keyword
282
+ #
260
283
  def keyword=(value)
261
284
  value = value.to_s.upcase
262
285
  raise ArgumentError, "Invalid keyword. Expected 'FIELD_DEF', got #{value}." unless value == "FIELD_DEF"
@@ -265,282 +288,376 @@ module RTP
265
288
 
266
289
  # Sets the rx_site_name attribute.
267
290
  #
291
+ # @param [nil, #to_s] value the new attribute value
292
+ #
268
293
  def rx_site_name=(value)
269
294
  @rx_site_name = value && value.to_s
270
295
  end
271
296
 
272
297
  # Sets the field_name attribute.
273
298
  #
299
+ # @param [nil, #to_s] value the new attribute value
300
+ #
274
301
  def field_name=(value)
275
302
  @field_name = value && value.to_s
276
303
  end
277
304
 
278
305
  # Sets the field_id attribute.
279
306
  #
307
+ # @param [nil, #to_s] value the new attribute value
308
+ #
280
309
  def field_id=(value)
281
310
  @field_id = value && value.to_s
282
311
  end
283
312
 
284
313
  # Sets the field_note attribute.
285
314
  #
315
+ # @param [nil, #to_s] value the new attribute value
316
+ #
286
317
  def field_note=(value)
287
318
  @field_note = value && value.to_s
288
319
  end
289
320
 
290
321
  # Sets the field_dose attribute.
291
322
  #
323
+ # @param [nil, #to_s] value the new attribute value
324
+ #
292
325
  def field_dose=(value)
293
- @field_dose = value && value.to_s
326
+ @field_dose = value && value.to_s.strip
294
327
  end
295
328
 
296
329
  # Sets the field_monitor_units attribute.
297
330
  #
331
+ # @param [nil, #to_s] value the new attribute value
332
+ #
298
333
  def field_monitor_units=(value)
299
- @field_monitor_units = value && value.to_s
334
+ @field_monitor_units = value && value.to_s.strip
300
335
  end
301
336
 
302
337
  # Sets the wedge_monitor_units attribute.
303
338
  #
339
+ # @param [nil, #to_s] value the new attribute value
340
+ #
304
341
  def wedge_monitor_units=(value)
305
- @wedge_monitor_units = value && value.to_s
342
+ @wedge_monitor_units = value && value.to_s.strip
306
343
  end
307
344
 
308
345
  # Sets the treatment_machine attribute.
309
346
  #
347
+ # @param [nil, #to_s] value the new attribute value
348
+ #
310
349
  def treatment_machine=(value)
311
350
  @treatment_machine = value && value.to_s
312
351
  end
313
352
 
314
353
  # Sets the treatment_type attribute.
315
354
  #
355
+ # @param [nil, #to_s] value the new attribute value
356
+ #
316
357
  def treatment_type=(value)
317
358
  @treatment_type = value && value.to_s
318
359
  end
319
360
 
320
361
  # Sets the modality attribute.
321
362
  #
363
+ # @param [nil, #to_s] value the new attribute value
364
+ #
322
365
  def modality=(value)
323
366
  @modality = value && value.to_s
324
367
  end
325
368
 
326
369
  # Sets the energy attribute.
327
370
  #
371
+ # @param [nil, #to_s] value the new attribute value
372
+ #
328
373
  def energy=(value)
329
374
  @energy = value && value.to_s
330
375
  end
331
376
 
332
377
  # Sets the time attribute.
333
378
  #
379
+ # @param [nil, #to_s] value the new attribute value
380
+ #
334
381
  def time=(value)
335
- @time = value && value.to_s
382
+ @time = value && value.to_s.strip
336
383
  end
337
384
 
338
385
  # Sets the doserate attribute.
339
386
  #
387
+ # @param [nil, #to_s] value the new attribute value
388
+ #
340
389
  def doserate=(value)
341
- @doserate = value && value.to_s
390
+ @doserate = value && value.to_s.strip
342
391
  end
343
392
 
344
393
  # Sets the sad attribute.
345
394
  #
395
+ # @param [nil, #to_s] value the new attribute value
396
+ #
346
397
  def sad=(value)
347
- @sad = value && value.to_s
398
+ @sad = value && value.to_s.strip
348
399
  end
349
400
 
350
401
  # Sets the ssd attribute.
351
402
  #
403
+ # @param [nil, #to_s] value the new attribute value
404
+ #
352
405
  def ssd=(value)
353
- @ssd = value && value.to_s
406
+ @ssd = value && value.to_s.strip
354
407
  end
355
408
 
356
409
  # Sets the gantry_angle attribute.
357
410
  #
411
+ # @param [nil, #to_s] value the new attribute value
412
+ #
358
413
  def gantry_angle=(value)
359
- @gantry_angle = value && value.to_s
414
+ @gantry_angle = value && value.to_s.strip
360
415
  end
361
416
 
362
417
  # Sets the collimator_angle attribute.
363
418
  #
419
+ # @param [nil, #to_s] value the new attribute value
420
+ #
364
421
  def collimator_angle=(value)
365
- @collimator_angle = value && value.to_s
422
+ @collimator_angle = value && value.to_s.strip
366
423
  end
367
424
 
368
425
  # Sets the field_x_mode attribute.
369
426
  #
427
+ # @param [nil, #to_s] value the new attribute value
428
+ #
370
429
  def field_x_mode=(value)
371
430
  @field_x_mode = value && value.to_s
372
431
  end
373
432
 
374
433
  # Sets the field_x attribute.
375
434
  #
435
+ # @param [nil, #to_s] value the new attribute value
436
+ #
376
437
  def field_x=(value)
377
- @field_x = value && value.to_s
438
+ @field_x = value && value.to_s.strip
378
439
  end
379
440
 
380
441
  # Sets the collimator_x1 attribute.
381
442
  #
443
+ # @param [nil, #to_s] value the new attribute value
444
+ #
382
445
  def collimator_x1=(value)
383
- @collimator_x1 = value && value.to_s
446
+ @collimator_x1 = value && value.to_s.strip
384
447
  end
385
448
 
386
449
  # Sets the collimator_x2 attribute.
387
450
  #
451
+ # @param [nil, #to_s] value the new attribute value
452
+ #
388
453
  def collimator_x2=(value)
389
- @collimator_x2 = value && value.to_s
454
+ @collimator_x2 = value && value.to_s.strip
390
455
  end
391
456
 
392
457
  # Sets the field_y_mode attribute.
393
458
  #
459
+ # @param [nil, #to_s] value the new attribute value
460
+ #
394
461
  def field_y_mode=(value)
395
462
  @field_y_mode = value && value.to_s
396
463
  end
397
464
 
398
465
  # Sets the field_y attribute.
399
466
  #
467
+ # @param [nil, #to_s] value the new attribute value
468
+ #
400
469
  def field_y=(value)
401
- @field_y = value && value.to_s
470
+ @field_y = value && value.to_s.strip
402
471
  end
403
472
 
404
473
  # Sets the collimator_y1 attribute.
405
474
  #
475
+ # @param [nil, #to_s] value the new attribute value
476
+ #
406
477
  def collimator_y1=(value)
407
- @collimator_y1 = value && value.to_s
478
+ @collimator_y1 = value && value.to_s.strip
408
479
  end
409
480
 
410
481
  # Sets the collimator_y2 attribute.
411
482
  #
483
+ # @param [nil, #to_s] value the new attribute value
484
+ #
412
485
  def collimator_y2=(value)
413
- @collimator_y2 = value && value.to_s
486
+ @collimator_y2 = value && value.to_s.strip
414
487
  end
415
488
 
416
489
  # Sets the couch_vertical attribute.
417
490
  #
491
+ # @param [nil, #to_s] value the new attribute value
492
+ #
418
493
  def couch_vertical=(value)
419
- @couch_vertical = value && value.to_s
494
+ @couch_vertical = value && value.to_s.strip
420
495
  end
421
496
 
422
497
  # Sets the couch_lateral attribute.
423
498
  #
499
+ # @param [nil, #to_s] value the new attribute value
500
+ #
424
501
  def couch_lateral=(value)
425
- @couch_lateral = value && value.to_s
502
+ @couch_lateral = value && value.to_s.strip
426
503
  end
427
504
 
428
505
  # Sets the couch_longitudinal attribute.
429
506
  #
507
+ # @param [nil, #to_s] value the new attribute value
508
+ #
430
509
  def couch_longitudinal=(value)
431
- @couch_longitudinal = value && value.to_s
510
+ @couch_longitudinal = value && value.to_s.strip
432
511
  end
433
512
 
434
513
  # Sets the couch_angle attribute.
435
514
  #
515
+ # @param [nil, #to_s] value the new attribute value
516
+ #
436
517
  def couch_angle=(value)
437
- @couch_angle = value && value.to_s
518
+ @couch_angle = value && value.to_s.strip.strip
438
519
  end
439
520
 
440
521
  # Sets the couch_pedestal attribute.
441
522
  #
523
+ # @param [nil, #to_s] value the new attribute value
524
+ #
442
525
  def couch_pedestal=(value)
443
- @couch_pedestal = value && value.to_s
526
+ @couch_pedestal = value && value.to_s.strip
444
527
  end
445
528
 
446
529
  # Sets the tolerance_table attribute.
447
530
  #
531
+ # @param [nil, #to_s] value the new attribute value
532
+ #
448
533
  def tolerance_table=(value)
449
- @tolerance_table = value && value.to_s
534
+ @tolerance_table = value && value.to_s.strip
450
535
  end
451
536
 
452
537
  # Sets the arc_direction attribute.
453
538
  #
539
+ # @param [nil, #to_s] value the new attribute value
540
+ #
454
541
  def arc_direction=(value)
455
542
  @arc_direction = value && value.to_s
456
543
  end
457
544
 
458
545
  # Sets the arc_start_angle attribute.
459
546
  #
547
+ # @param [nil, #to_s] value the new attribute value
548
+ #
460
549
  def arc_start_angle=(value)
461
- @arc_start_angle = value && value.to_s
550
+ @arc_start_angle = value && value.to_s.strip
462
551
  end
463
552
 
464
553
  # Sets the arc_stop_angle attribute.
465
554
  #
555
+ # @param [nil, #to_s] value the new attribute value
556
+ #
466
557
  def arc_stop_angle=(value)
467
- @arc_stop_angle = value && value.to_s
558
+ @arc_stop_angle = value && value.to_s.strip
468
559
  end
469
560
 
470
561
  # Sets the arc_mu_degree attribute.
471
562
  #
563
+ # @param [nil, #to_s] value the new attribute value
564
+ #
472
565
  def arc_mu_degree=(value)
473
- @arc_mu_degree = value && value.to_s
566
+ @arc_mu_degree = value && value.to_s.strip
474
567
  end
475
568
 
476
569
  # Sets the wedge attribute.
477
570
  #
571
+ # @param [nil, #to_s] value the new attribute value
572
+ #
478
573
  def wedge=(value)
479
574
  @wedge = value && value.to_s
480
575
  end
481
576
 
482
577
  # Sets the dynamic_wedge attribute.
483
578
  #
579
+ # @param [nil, #to_s] value the new attribute value
580
+ #
484
581
  def dynamic_wedge=(value)
485
582
  @dynamic_wedge = value && value.to_s
486
583
  end
487
584
 
488
585
  # Sets the block attribute.
489
586
  #
587
+ # @param [nil, #to_s] value the new attribute value
588
+ #
490
589
  def block=(value)
491
590
  @block = value && value.to_s
492
591
  end
493
592
 
494
593
  # Sets the compensator attribute.
495
594
  #
595
+ # @param [nil, #to_s] value the new attribute value
596
+ #
496
597
  def compensator=(value)
497
598
  @compensator = value && value.to_s
498
599
  end
499
600
 
500
601
  # Sets the e_applicator attribute.
501
602
  #
603
+ # @param [nil, #to_s] value the new attribute value
604
+ #
502
605
  def e_applicator=(value)
503
606
  @e_applicator = value && value.to_s
504
607
  end
505
608
 
506
609
  # Sets the e_field_def_aperture attribute.
507
610
  #
611
+ # @param [nil, #to_s] value the new attribute value
612
+ #
508
613
  def e_field_def_aperture=(value)
509
614
  @e_field_def_aperture = value && value.to_s
510
615
  end
511
616
 
512
617
  # Sets the bolus attribute.
513
618
  #
619
+ # @param [nil, #to_s] value the new attribute value
620
+ #
514
621
  def bolus=(value)
515
622
  @bolus = value && value.to_s
516
623
  end
517
624
 
518
625
  # Sets the portfilm_mu_open attribute.
519
626
  #
627
+ # @param [nil, #to_s] value the new attribute value
628
+ #
520
629
  def portfilm_mu_open=(value)
521
630
  @portfilm_mu_open = value && value.to_s
522
631
  end
523
632
 
524
633
  # Sets the portfilm_coeff_open attribute.
525
634
  #
635
+ # @param [nil, #to_s] value the new attribute value
636
+ #
526
637
  def portfilm_coeff_open=(value)
527
638
  @portfilm_coeff_open = value && value.to_s
528
639
  end
529
640
 
530
641
  # Sets the portfilm_delta_open attribute.
531
642
  #
643
+ # @param [nil, #to_s] value the new attribute value
644
+ #
532
645
  def portfilm_delta_open=(value)
533
646
  @portfilm_delta_open = value && value.to_s
534
647
  end
535
648
 
536
649
  # Sets the portfilm_mu_treat attribute.
537
650
  #
651
+ # @param [nil, #to_s] value the new attribute value
652
+ #
538
653
  def portfilm_mu_treat=(value)
539
654
  @portfilm_mu_treat = value && value.to_s
540
655
  end
541
656
 
542
657
  # Sets the portfilm_coeff_treat attribute.
543
658
  #
659
+ # @param [nil, #to_s] value the new attribute value
660
+ #
544
661
  def portfilm_coeff_treat=(value)
545
662
  @portfilm_coeff_treat = value && value.to_s
546
663
  end
@@ -549,7 +666,10 @@ module RTP
549
666
  private
550
667
 
551
668
 
552
- # Returns the attributes of this instance in an array (for comparison purposes).
669
+ # Collects the attributes of this instance.
670
+ #
671
+ # @note The CRC is not considered part of the attributes of interest and is excluded
672
+ # @return [Array<String>] an array of attributes
553
673
  #
554
674
  alias_method :state, :values
555
675