rtp-connect 1.6 → 1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,6 +24,9 @@ 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
27
30
 
28
31
  # Creates a new SiteSetup by parsing a RTPConnect string line.
29
32
  #
@@ -33,31 +36,8 @@ module RTP
33
36
  # @raise [ArgumentError] if given a string containing an invalid number of elements
34
37
  #
35
38
  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
39
  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
40
+ s.load(string)
61
41
  end
62
42
 
63
43
  # Creates a new SiteSetup.
@@ -65,10 +45,32 @@ module RTP
65
45
  # @param [Record] parent a record which is used to determine the proper parent of this instance
66
46
  #
67
47
  def initialize(parent)
48
+ super('SITE_SETUP_DEF', 5, 19)
68
49
  # Parent relation (always expecting a Prescription here):
69
50
  @parent = get_parent(parent.to_prescription, Prescription)
70
51
  @parent.add_site_setup(self)
71
- @keyword = 'SITE_SETUP_DEF'
52
+ @attributes = [
53
+ # Required:
54
+ :keyword,
55
+ :rx_site_name,
56
+ :patient_orientation,
57
+ :treatment_machine,
58
+ # Optional:
59
+ :tolerance_table,
60
+ :iso_pos_x,
61
+ :iso_pos_y,
62
+ :iso_pos_z,
63
+ :structure_set_uid,
64
+ :frame_of_ref_uid,
65
+ :couch_vertical,
66
+ :couch_lateral,
67
+ :couch_longitudinal,
68
+ :couch_angle,
69
+ :couch_pedestal,
70
+ :table_top_vert_displacement,
71
+ :table_top_long_displacement,
72
+ :table_top_lat_displacement
73
+ ]
72
74
  end
73
75
 
74
76
  # Checks for equality.
@@ -105,31 +107,6 @@ module RTP
105
107
  state.hash
106
108
  end
107
109
 
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
110
  # Encodes the SiteSetup object + any hiearchy of child objects,
134
111
  # to a properly formatted RTPConnect ascii string.
135
112
  #
@@ -155,18 +132,6 @@ module RTP
155
132
  self
156
133
  end
157
134
 
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
135
  # Sets the rx_site_name attribute.
171
136
  #
172
137
  # @param [nil, #to_s] value the new attribute value
@@ -279,6 +244,30 @@ module RTP
279
244
  @couch_pedestal = value && value.to_s.strip
280
245
  end
281
246
 
247
+ # Sets the table_top_vert_displacement attribute.
248
+ #
249
+ # @param [nil, #to_s] value the new attribute value
250
+ #
251
+ def table_top_vert_displacement=(value)
252
+ @table_top_vert_displacement = value && value.to_s.strip
253
+ end
254
+
255
+ # Sets the table_top_long_displacement attribute.
256
+ #
257
+ # @param [nil, #to_s] value the new attribute value
258
+ #
259
+ def table_top_long_displacement=(value)
260
+ @table_top_long_displacement = value && value.to_s.strip
261
+ end
262
+
263
+ # Sets the table_top_lat_displacement attribute.
264
+ #
265
+ # @param [nil, #to_s] value the new attribute value
266
+ #
267
+ def table_top_lat_displacement=(value)
268
+ @table_top_lat_displacement = value && value.to_s.strip
269
+ end
270
+
282
271
 
283
272
  private
284
273
 
@@ -1,6 +1,6 @@
1
1
  module RTP
2
2
 
3
3
  # The RTPConnect library version string.
4
- VERSION = '1.6'
4
+ VERSION = '1.7'
5
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:
@@ -15,14 +15,14 @@ Gem::Specification.new do |s|
15
15
  s.license = 'GPLv3'
16
16
  s.description = 'RTPConnect is a file format used in radiotherapy for export & import of treatment planning data.'
17
17
  s.files = Dir["{lib}/**/*", "[A-Z]*"]
18
- s.rubyforge_project = 'rtp-connect'
19
18
 
20
19
  s.required_ruby_version = '>= 1.9.3'
21
20
 
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')
21
+ s.add_development_dependency('bundler', '~> 1.6')
22
+ s.add_development_dependency('dicom', '~> 0.9', '>= 0.9.6')
23
+ s.add_development_dependency('mocha', '~> 1.1')
24
+ s.add_development_dependency('rake', '~> 10.3')
25
+ s.add_development_dependency('redcarpet', '~> 3.1')
26
+ s.add_development_dependency('rspec', '~> 3.0')
27
+ s.add_development_dependency('yard', '~> 0.8', '>= 0.8.7')
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.7'
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: 2014-09-17 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.6'
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.6'
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.6
38
37
  type: :development
39
38
  prerelease: false
40
39
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
40
  requirements:
43
41
  - - ~>
44
42
  - !ruby/object:Gem::Version
45
- version: 0.9.5
43
+ version: '0.9'
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: 0.9.6
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
  - - ~>
68
66
  - !ruby/object:Gem::Version
69
- version: 0.9.6
67
+ version: '10.3'
70
68
  type: :development
71
69
  prerelease: false
72
70
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
71
  requirements:
75
72
  - - ~>
76
73
  - !ruby/object:Gem::Version
77
- version: 0.9.6
74
+ version: '10.3'
75
+ - !ruby/object:Gem::Dependency
76
+ name: redcarpet
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ~>
80
+ - !ruby/object:Gem::Version
81
+ version: '3.1'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ version: '3.1'
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.0'
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.0'
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.8'
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: 0.8.7
102
113
  type: :development
103
114
  prerelease: false
104
115
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
116
  requirements:
107
117
  - - ~>
108
118
  - !ruby/object:Gem::Version
109
- version: 0.8.5
119
+ version: '0.8'
120
+ - - ! '>='
121
+ - !ruby/object:Gem::Version
122
+ version: 0.8.7
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,31 @@ 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
157
  - GPLv3
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
167
  version: 1.9.3
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.3.0
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
180
  has_rdoc: