rtp-connect 1.6 → 1.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,7 +9,7 @@ module RTP
9
9
  class SiteSetup < Record
10
10
 
11
11
  # The Record which this instance belongs to.
12
- attr_reader :parent
12
+ attr_accessor :parent
13
13
  attr_reader :rx_site_name
14
14
  attr_reader :patient_orientation
15
15
  attr_reader :treatment_machine
@@ -24,6 +24,15 @@ module RTP
24
24
  attr_reader :couch_longitudinal
25
25
  attr_reader :couch_angle
26
26
  attr_reader :couch_pedestal
27
+ attr_reader :table_top_vert_displacement
28
+ attr_reader :table_top_long_displacement
29
+ attr_reader :table_top_lat_displacement
30
+ attr_reader :mrl_coil_name
31
+ attr_reader :mrl_coil_index
32
+ attr_reader :couch_reference
33
+ attr_reader :couch_reference_index
34
+ attr_reader :respiratory_motion_compensation_technique
35
+ attr_reader :respiratory_signal_source
27
36
 
28
37
  # Creates a new SiteSetup by parsing a RTPConnect string line.
29
38
  #
@@ -33,31 +42,8 @@ module RTP
33
42
  # @raise [ArgumentError] if given a string containing an invalid number of elements
34
43
  #
35
44
  def self.load(string, parent)
36
- # Get the quote-less values:
37
- values = string.to_s.values
38
- low_limit = 5
39
- high_limit = 16
40
- raise ArgumentError, "Invalid argument 'string': Expected at least #{low_limit} elements, got #{values.length}." if values.length < low_limit
41
- RTP.logger.warn "The number of elements (#{values.length}) for this SiteSetup record exceeds the known number of data items for this record (#{high_limit}). This may indicate an invalid record or that the RTP format has recently been expanded with new items." if values.length > high_limit
42
45
  s = self.new(parent)
43
- # Assign the values to attributes:
44
- s.keyword = values[0]
45
- s.rx_site_name = values[1]
46
- s.patient_orientation = values[2]
47
- s.treatment_machine = values[3]
48
- s.tolerance_table = values[4]
49
- s.iso_pos_x = values[5]
50
- s.iso_pos_y = values[6]
51
- s.iso_pos_z = values[7]
52
- s.structure_set_uid = values[8]
53
- s.frame_of_ref_uid = values[9]
54
- s.couch_vertical = values[10]
55
- s.couch_lateral = values[11]
56
- s.couch_longitudinal = values[12]
57
- s.couch_angle = values[13]
58
- s.couch_pedestal = values[14]
59
- s.crc = values[-1]
60
- return s
46
+ s.load(string)
61
47
  end
62
48
 
63
49
  # Creates a new SiteSetup.
@@ -65,10 +51,38 @@ module RTP
65
51
  # @param [Record] parent a record which is used to determine the proper parent of this instance
66
52
  #
67
53
  def initialize(parent)
54
+ super('SITE_SETUP_DEF', 5, 25)
68
55
  # Parent relation (always expecting a Prescription here):
69
56
  @parent = get_parent(parent.to_prescription, Prescription)
70
57
  @parent.add_site_setup(self)
71
- @keyword = 'SITE_SETUP_DEF'
58
+ @attributes = [
59
+ # Required:
60
+ :keyword,
61
+ :rx_site_name,
62
+ :patient_orientation,
63
+ :treatment_machine,
64
+ # Optional:
65
+ :tolerance_table,
66
+ :iso_pos_x,
67
+ :iso_pos_y,
68
+ :iso_pos_z,
69
+ :structure_set_uid,
70
+ :frame_of_ref_uid,
71
+ :couch_vertical,
72
+ :couch_lateral,
73
+ :couch_longitudinal,
74
+ :couch_angle,
75
+ :couch_pedestal,
76
+ :table_top_vert_displacement,
77
+ :table_top_long_displacement,
78
+ :table_top_lat_displacement,
79
+ :mrl_coil_name,
80
+ :mrl_coil_index,
81
+ :couch_reference,
82
+ :couch_reference_index,
83
+ :respiratory_motion_compensation_technique,
84
+ :respiratory_signal_source
85
+ ]
72
86
  end
73
87
 
74
88
  # Checks for equality.
@@ -105,48 +119,6 @@ module RTP
105
119
  state.hash
106
120
  end
107
121
 
108
- # Collects the values (attributes) of this instance.
109
- #
110
- # @note The CRC is not considered part of the actual values and is excluded.
111
- # @return [Array<String>] an array of attributes (in the same order as they appear in the RTP string)
112
- #
113
- def values
114
- return [
115
- @keyword,
116
- @rx_site_name,
117
- @patient_orientation,
118
- @treatment_machine,
119
- @tolerance_table,
120
- @iso_pos_x,
121
- @iso_pos_y,
122
- @iso_pos_z,
123
- @structure_set_uid,
124
- @frame_of_ref_uid,
125
- @couch_vertical,
126
- @couch_lateral,
127
- @couch_longitudinal,
128
- @couch_angle,
129
- @couch_pedestal
130
- ]
131
- end
132
-
133
- # Encodes the SiteSetup object + any hiearchy of child objects,
134
- # to a properly formatted RTPConnect ascii string.
135
- #
136
- # @return [String] an RTP string with a single or multiple lines/records
137
- #
138
- def to_s
139
- str = encode
140
- if children
141
- children.each do |child|
142
- str += child.to_s
143
- end
144
- end
145
- return str
146
- end
147
-
148
- alias :to_str :to_s
149
-
150
122
  # Returns self.
151
123
  #
152
124
  # @return [SiteSetup] self
@@ -155,18 +127,6 @@ module RTP
155
127
  self
156
128
  end
157
129
 
158
- # Sets the keyword attribute.
159
- #
160
- # @note Since only a specific string is accepted, this is more of an argument check than a traditional setter method
161
- # @param [#to_s] value the new attribute value
162
- # @raise [ArgumentError] if given an unexpected keyword
163
- #
164
- def keyword=(value)
165
- value = value.to_s.upcase
166
- raise ArgumentError, "Invalid keyword. Expected 'SITE_SETUP_DEF', got #{value}." unless value == "SITE_SETUP_DEF"
167
- @keyword = value
168
- end
169
-
170
130
  # Sets the rx_site_name attribute.
171
131
  #
172
132
  # @param [nil, #to_s] value the new attribute value
@@ -279,6 +239,78 @@ module RTP
279
239
  @couch_pedestal = value && value.to_s.strip
280
240
  end
281
241
 
242
+ # Sets the table_top_vert_displacement attribute.
243
+ #
244
+ # @param [nil, #to_s] value the new attribute value
245
+ #
246
+ def table_top_vert_displacement=(value)
247
+ @table_top_vert_displacement = value && value.to_s.strip
248
+ end
249
+
250
+ # Sets the table_top_long_displacement attribute.
251
+ #
252
+ # @param [nil, #to_s] value the new attribute value
253
+ #
254
+ def table_top_long_displacement=(value)
255
+ @table_top_long_displacement = value && value.to_s.strip
256
+ end
257
+
258
+ # Sets the table_top_lat_displacement attribute.
259
+ #
260
+ # @param [nil, #to_s] value the new attribute value
261
+ #
262
+ def table_top_lat_displacement=(value)
263
+ @table_top_lat_displacement = value && value.to_s.strip
264
+ end
265
+
266
+ # Sets the mrl_coil_name attribute.
267
+ #
268
+ # @param [nil, #to_s] value the new attribute value
269
+ #
270
+ def mrl_coil_name=(value)
271
+ @mrl_coil_name = value && value.to_s.strip
272
+ end
273
+
274
+ # Sets the mrl_coil_index attribute.
275
+ #
276
+ # @param [nil, #to_s] value the new attribute value
277
+ #
278
+ def mrl_coil_index=(value)
279
+ @mrl_coil_index = value && value.to_s.strip
280
+ end
281
+
282
+ # Sets the couch_reference attribute.
283
+ #
284
+ # @param [nil, #to_s] value the new attribute value
285
+ #
286
+ def couch_reference=(value)
287
+ @couch_reference = value && value.to_s.strip
288
+ end
289
+
290
+ # Sets the couch_reference_index attribute.
291
+ #
292
+ # @param [nil, #to_s] value the new attribute value
293
+ #
294
+ def couch_reference_index=(value)
295
+ @couch_reference_index = value && value.to_s.strip
296
+ end
297
+
298
+ # Sets the respiratory_motion_compensation_technique attribute.
299
+ #
300
+ # @param [nil, #to_s] value the new attribute value
301
+ #
302
+ def respiratory_motion_compensation_technique=(value)
303
+ @respiratory_motion_compensation_technique = value && value.to_s.strip
304
+ end
305
+
306
+ # Sets the respiratory_signal_source attribute.
307
+ #
308
+ # @param [nil, #to_s] value the new attribute value
309
+ #
310
+ def respiratory_signal_source=(value)
311
+ @respiratory_signal_source = value && value.to_s.strip
312
+ end
313
+
282
314
 
283
315
  private
284
316
 
@@ -1,6 +1,6 @@
1
- module RTP
2
-
3
- # The RTPConnect library version string.
4
- VERSION = '1.6'
5
-
1
+ module RTP
2
+
3
+ # The RTPConnect library version string.
4
+ VERSION = '1.11'
5
+
6
6
  end
@@ -16,7 +16,6 @@ require 'yard'
16
16
  gem_spec = eval(File.read('rtp-connect.gemspec'))
17
17
  Gem::PackageTask.new(gem_spec) do |pkg|
18
18
  pkg.gem_spec = gem_spec
19
- #pkg.need_tar = true
20
19
  end
21
20
 
22
21
  # RSpec 2:
@@ -1,28 +1,28 @@
1
- # encoding: UTF-8
2
-
3
- require File.expand_path('../lib/rtp-connect/version', __FILE__)
4
-
5
- Gem::Specification.new do |s|
6
- s.platform = Gem::Platform::RUBY
7
- s.name = 'rtp-connect'
8
- s.version = RTP::VERSION
9
- s.date = Time.now
10
- s.summary = 'Library for handling RTPConnect files.'
11
- s.require_paths = ['lib']
12
- s.author = 'Christoffer Lervag'
13
- s.email = 'chris.lervag@gmail.com'
14
- s.homepage = 'https://github.com/dicom/rtp-connect'
15
- s.license = 'GPLv3'
16
- s.description = 'RTPConnect is a file format used in radiotherapy for export & import of treatment planning data.'
17
- s.files = Dir["{lib}/**/*", "[A-Z]*"]
18
- s.rubyforge_project = 'rtp-connect'
19
-
20
- s.required_ruby_version = '>= 1.9.3'
21
-
22
- s.add_development_dependency('bundler', '~> 1.3')
23
- s.add_development_dependency('dicom', '~> 0.9.5')
24
- s.add_development_dependency('mocha', '~> 0.13')
25
- s.add_development_dependency('rake', '~> 0.9.6')
26
- s.add_development_dependency('rspec', '~> 2.13')
27
- s.add_development_dependency('yard', '~> 0.8.5')
1
+ # encoding: UTF-8
2
+
3
+ require File.expand_path('../lib/rtp-connect/version', __FILE__)
4
+
5
+ Gem::Specification.new do |s|
6
+ s.platform = Gem::Platform::RUBY
7
+ s.name = 'rtp-connect'
8
+ s.version = RTP::VERSION
9
+ s.date = Time.now
10
+ s.summary = 'Library for handling RTPConnect files.'
11
+ s.require_paths = ['lib']
12
+ s.author = 'Christoffer Lervag'
13
+ s.email = 'chris.lervag@gmail.com'
14
+ s.homepage = 'https://github.com/dicom/rtp-connect'
15
+ s.license = 'GPL-3.0'
16
+ s.description = 'RTPConnect is a file format used in radiotherapy for export & import of treatment planning data.'
17
+ s.files = Dir["{lib}/**/*", "[A-Z]*"]
18
+
19
+ s.required_ruby_version = '>= 2.2'
20
+
21
+ s.add_development_dependency('bundler', '~> 1.11')
22
+ s.add_development_dependency('dicom', '~> 0.9', '>= 0.9.8')
23
+ s.add_development_dependency('mocha', '~> 1.1')
24
+ s.add_development_dependency('rake', '~> 12.3')
25
+ s.add_development_dependency('redcarpet', '~> 3.4')
26
+ s.add_development_dependency('rspec', '~> 3.7')
27
+ s.add_development_dependency('yard', '~> 0.9', '>= 0.9.12')
28
28
  end
metadata CHANGED
@@ -1,112 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtp-connect
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.6'
5
- prerelease:
4
+ version: '1.11'
6
5
  platform: ruby
7
6
  authors:
8
7
  - Christoffer Lervag
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-12-12 00:00:00.000000000 Z
11
+ date: 2020-09-10 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '1.3'
19
+ version: '1.11'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '1.3'
26
+ version: '1.11'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: dicom
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
- version: 0.9.5
33
+ version: '0.9'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 0.9.8
38
37
  type: :development
39
38
  prerelease: false
40
39
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
40
  requirements:
43
- - - ~>
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '0.9'
44
+ - - ">="
44
45
  - !ruby/object:Gem::Version
45
- version: 0.9.5
46
+ version: 0.9.8
46
47
  - !ruby/object:Gem::Dependency
47
48
  name: mocha
48
49
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
50
  requirements:
51
- - - ~>
51
+ - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0.13'
53
+ version: '1.1'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
57
  requirements:
59
- - - ~>
58
+ - - "~>"
60
59
  - !ruby/object:Gem::Version
61
- version: '0.13'
60
+ version: '1.1'
62
61
  - !ruby/object:Gem::Dependency
63
62
  name: rake
64
63
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
64
  requirements:
67
- - - ~>
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '12.3'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '12.3'
75
+ - !ruby/object:Gem::Dependency
76
+ name: redcarpet
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
68
80
  - !ruby/object:Gem::Version
69
- version: 0.9.6
81
+ version: '3.4'
70
82
  type: :development
71
83
  prerelease: false
72
84
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
85
  requirements:
75
- - - ~>
86
+ - - "~>"
76
87
  - !ruby/object:Gem::Version
77
- version: 0.9.6
88
+ version: '3.4'
78
89
  - !ruby/object:Gem::Dependency
79
90
  name: rspec
80
91
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
92
  requirements:
83
- - - ~>
93
+ - - "~>"
84
94
  - !ruby/object:Gem::Version
85
- version: '2.13'
95
+ version: '3.7'
86
96
  type: :development
87
97
  prerelease: false
88
98
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
99
  requirements:
91
- - - ~>
100
+ - - "~>"
92
101
  - !ruby/object:Gem::Version
93
- version: '2.13'
102
+ version: '3.7'
94
103
  - !ruby/object:Gem::Dependency
95
104
  name: yard
96
105
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
106
  requirements:
99
- - - ~>
107
+ - - "~>"
100
108
  - !ruby/object:Gem::Version
101
- version: 0.8.5
109
+ version: '0.9'
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 0.9.12
102
113
  type: :development
103
114
  prerelease: false
104
115
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
116
  requirements:
107
- - - ~>
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: '0.9'
120
+ - - ">="
108
121
  - !ruby/object:Gem::Version
109
- version: 0.8.5
122
+ version: 0.9.12
110
123
  description: RTPConnect is a file format used in radiotherapy for export & import
111
124
  of treatment planning data.
112
125
  email: chris.lervag@gmail.com
@@ -114,10 +127,17 @@ executables: []
114
127
  extensions: []
115
128
  extra_rdoc_files: []
116
129
  files:
130
+ - CHANGELOG.md
131
+ - COPYING
132
+ - Gemfile
133
+ - Gemfile.lock
134
+ - README.md
135
+ - lib/rtp-connect.rb
117
136
  - lib/rtp-connect/constants.rb
118
137
  - lib/rtp-connect/control_point.rb
119
138
  - lib/rtp-connect/dose_tracking.rb
120
139
  - lib/rtp-connect/extended_field.rb
140
+ - lib/rtp-connect/extended_plan.rb
121
141
  - lib/rtp-connect/field.rb
122
142
  - lib/rtp-connect/logging.rb
123
143
  - lib/rtp-connect/methods.rb
@@ -130,41 +150,30 @@ files:
130
150
  - lib/rtp-connect/site_setup.rb
131
151
  - lib/rtp-connect/variables.rb
132
152
  - lib/rtp-connect/version.rb
133
- - lib/rtp-connect.rb
134
- - CHANGELOG.rdoc
135
- - COPYING
136
- - Gemfile
137
- - Gemfile.lock
138
153
  - rakefile.rb
139
- - README.rdoc
140
154
  - rtp-connect.gemspec
141
155
  homepage: https://github.com/dicom/rtp-connect
142
156
  licenses:
143
- - GPLv3
157
+ - GPL-3.0
158
+ metadata: {}
144
159
  post_install_message:
145
160
  rdoc_options: []
146
161
  require_paths:
147
162
  - lib
148
163
  required_ruby_version: !ruby/object:Gem::Requirement
149
- none: false
150
164
  requirements:
151
- - - ! '>='
165
+ - - ">="
152
166
  - !ruby/object:Gem::Version
153
- version: 1.9.3
167
+ version: '2.2'
154
168
  required_rubygems_version: !ruby/object:Gem::Requirement
155
- none: false
156
169
  requirements:
157
- - - ! '>='
170
+ - - ">="
158
171
  - !ruby/object:Gem::Version
159
172
  version: '0'
160
- segments:
161
- - 0
162
- hash: -111446803
163
173
  requirements: []
164
- rubyforge_project: rtp-connect
165
- rubygems_version: 1.8.24
174
+ rubyforge_project:
175
+ rubygems_version: 2.6.8
166
176
  signing_key:
167
- specification_version: 3
177
+ specification_version: 4
168
178
  summary: Library for handling RTPConnect files.
169
179
  test_files: []
170
- has_rdoc: