rtp-connect 1.9 → 1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/Gemfile.lock +23 -23
- data/README.md +12 -1
- data/lib/rtp-connect/control_point.rb +57 -4
- data/lib/rtp-connect/field.rb +32 -2
- data/lib/rtp-connect/plan.rb +1 -1
- data/lib/rtp-connect/record.rb +9 -2
- data/lib/rtp-connect/version.rb +1 -1
- data/rtp-connect.gemspec +7 -7
- metadata +18 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d562152c2ccba6301fcf82f5bdd7329c8efb0515
|
4
|
+
data.tar.gz: ef3af37f9d5960f1821073345950b7523aa66ee3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc23ea92ce17778ec1c0c253d68c976d3b5079fb80dc7b3f85f3d93afccb3e95f502d812bf0d408ff347d9f88251cd4caa34a1c87febf3847b4ca74ad55db5bd
|
7
|
+
data.tar.gz: 7c5b9a0174462db12b0c015915a9a655ed943f37dc611225b8620444bf47b5c77a54da8ab433766f87cf37851dfe0cd2257ad25b21fd66a7f4b9c5c407349332
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,13 @@
|
|
1
|
-
# 1.
|
1
|
+
# 1.10
|
2
2
|
|
3
3
|
## (Unreleased)
|
4
4
|
|
5
|
+
* Added support for Mosaiq 2.64, which includes three new iso_pos_x/y/z attributes in the Field and ControlPoint records.
|
6
|
+
|
7
|
+
# 1.9
|
8
|
+
|
9
|
+
## 23rd March 2016
|
10
|
+
|
5
11
|
* Added an variable for retrieving a record's attributes (in an array).
|
6
12
|
* Added a sample script for beam parameter modification (useful for linac/plan QA purposes).
|
7
13
|
* Made the parent attribute accessible, and properly update the parent attribute when assigning a record to a new parent.
|
data/Gemfile.lock
CHANGED
@@ -1,45 +1,45 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rtp-connect (1.
|
4
|
+
rtp-connect (1.10)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://www.rubygems.org/
|
8
8
|
specs:
|
9
|
-
dicom (0.9.
|
9
|
+
dicom (0.9.8)
|
10
10
|
diff-lcs (1.2.5)
|
11
11
|
metaclass (0.0.4)
|
12
12
|
mocha (1.1.0)
|
13
13
|
metaclass (~> 0.0.1)
|
14
|
-
rake (
|
15
|
-
redcarpet (3.
|
16
|
-
rspec (3.
|
17
|
-
rspec-core (~> 3.
|
18
|
-
rspec-expectations (~> 3.
|
19
|
-
rspec-mocks (~> 3.
|
20
|
-
rspec-core (3.
|
21
|
-
rspec-support (~> 3.
|
22
|
-
rspec-expectations (3.
|
14
|
+
rake (12.3.1)
|
15
|
+
redcarpet (3.4.0)
|
16
|
+
rspec (3.7.0)
|
17
|
+
rspec-core (~> 3.7.0)
|
18
|
+
rspec-expectations (~> 3.7.0)
|
19
|
+
rspec-mocks (~> 3.7.0)
|
20
|
+
rspec-core (3.7.1)
|
21
|
+
rspec-support (~> 3.7.0)
|
22
|
+
rspec-expectations (3.7.0)
|
23
23
|
diff-lcs (>= 1.2.0, < 2.0)
|
24
|
-
rspec-support (~> 3.
|
25
|
-
rspec-mocks (3.
|
24
|
+
rspec-support (~> 3.7.0)
|
25
|
+
rspec-mocks (3.7.0)
|
26
26
|
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
-
rspec-support (~> 3.
|
28
|
-
rspec-support (3.
|
29
|
-
yard (0.
|
27
|
+
rspec-support (~> 3.7.0)
|
28
|
+
rspec-support (3.7.1)
|
29
|
+
yard (0.9.12)
|
30
30
|
|
31
31
|
PLATFORMS
|
32
32
|
x86-mingw32
|
33
33
|
|
34
34
|
DEPENDENCIES
|
35
|
-
bundler (~> 1.
|
36
|
-
dicom (~> 0.9, >= 0.9.
|
35
|
+
bundler (~> 1.11)
|
36
|
+
dicom (~> 0.9, >= 0.9.8)
|
37
37
|
mocha (~> 1.1)
|
38
|
-
rake (~>
|
39
|
-
redcarpet (~> 3.
|
40
|
-
rspec (~> 3.
|
38
|
+
rake (~> 12.3)
|
39
|
+
redcarpet (~> 3.4)
|
40
|
+
rspec (~> 3.7)
|
41
41
|
rtp-connect!
|
42
|
-
yard (~> 0.
|
42
|
+
yard (~> 0.9, >= 0.9.12)
|
43
43
|
|
44
44
|
BUNDLED WITH
|
45
|
-
1.
|
45
|
+
1.16.5
|
data/README.md
CHANGED
@@ -56,6 +56,17 @@ external dependencies.
|
|
56
56
|
# Write a corrected RTP file:
|
57
57
|
rtp.write('valid.rtp')
|
58
58
|
|
59
|
+
### Write RTP files for specific Mosaiq versions:
|
60
|
+
|
61
|
+
# Mosaiq 2.4:
|
62
|
+
rtp.write('treatment_plan.rtp', version: 2.4)
|
63
|
+
# Mosaiq 2.5:
|
64
|
+
rtp.write('treatment_plan.rtp', version: 2.5)
|
65
|
+
# Mosaiq 2.6 (and 2.62):
|
66
|
+
rtp.write('treatment_plan.rtp', version: 2.6)
|
67
|
+
# By default files are outputted at the latest supported version (currently 2.64) when omitting the version parameter:
|
68
|
+
rtp.write('treatment_plan.rtp')
|
69
|
+
|
59
70
|
### Convert an RTP file to DICOM:
|
60
71
|
|
61
72
|
p = Plan.read('some_file.rtp')
|
@@ -125,7 +136,7 @@ If you encounter an RTP file with an unsupported record type, please contact me.
|
|
125
136
|
|
126
137
|
## COPYRIGHT
|
127
138
|
|
128
|
-
Copyright 2011-
|
139
|
+
Copyright 2011-2018 Christoffer Lervåg
|
129
140
|
|
130
141
|
This program is free software: you can redistribute it and/or modify
|
131
142
|
it under the terms of the GNU General Public License as published by
|
@@ -46,6 +46,9 @@ module RTP
|
|
46
46
|
attr_reader :couch_dir
|
47
47
|
attr_reader :couch_pedestal
|
48
48
|
attr_reader :couch_ped_dir
|
49
|
+
attr_reader :iso_pos_x
|
50
|
+
attr_reader :iso_pos_y
|
51
|
+
attr_reader :iso_pos_z
|
49
52
|
# Note: This attribute contains an array of all MLC LP A values (leaves 1..100).
|
50
53
|
attr_reader :mlc_lp_a
|
51
54
|
# Note: This attribute contains an array of all MLC LP B values (leaves 1..100).
|
@@ -68,7 +71,7 @@ module RTP
|
|
68
71
|
# @param [Record] parent a record which is used to determine the proper parent of this instance
|
69
72
|
#
|
70
73
|
def initialize(parent)
|
71
|
-
super('CONTROL_PT_DEF', 233,
|
74
|
+
super('CONTROL_PT_DEF', 233, 236)
|
72
75
|
# Child:
|
73
76
|
@mlc_shape = nil
|
74
77
|
# Parent relation (may get more than one type of record here):
|
@@ -110,6 +113,9 @@ module RTP
|
|
110
113
|
:couch_dir,
|
111
114
|
:couch_pedestal,
|
112
115
|
:couch_ped_dir,
|
116
|
+
:iso_pos_x,
|
117
|
+
:iso_pos_y,
|
118
|
+
:iso_pos_z,
|
113
119
|
:mlc_lp_a,
|
114
120
|
:mlc_lp_b
|
115
121
|
]
|
@@ -250,6 +256,9 @@ module RTP
|
|
250
256
|
@couch_dir,
|
251
257
|
@couch_pedestal,
|
252
258
|
@couch_ped_dir,
|
259
|
+
@iso_pos_x,
|
260
|
+
@iso_pos_y,
|
261
|
+
@iso_pos_z,
|
253
262
|
*@mlc_lp_a,
|
254
263
|
*@mlc_lp_b
|
255
264
|
]
|
@@ -531,6 +540,30 @@ module RTP
|
|
531
540
|
@couch_ped_dir = value && value.to_s
|
532
541
|
end
|
533
542
|
|
543
|
+
# Sets the iso_pos_x attribute.
|
544
|
+
#
|
545
|
+
# @param [nil, #to_s] value the new attribute value
|
546
|
+
#
|
547
|
+
def iso_pos_x=(value)
|
548
|
+
@iso_pos_x = value && value.to_s.strip
|
549
|
+
end
|
550
|
+
|
551
|
+
# Sets the iso_pos_y attribute.
|
552
|
+
#
|
553
|
+
# @param [nil, #to_s] value the new attribute value
|
554
|
+
#
|
555
|
+
def iso_pos_y=(value)
|
556
|
+
@iso_pos_y = value && value.to_s.strip
|
557
|
+
end
|
558
|
+
|
559
|
+
# Sets the iso_pos_z attribute.
|
560
|
+
#
|
561
|
+
# @param [nil, #to_s] value the new attribute value
|
562
|
+
#
|
563
|
+
def iso_pos_z=(value)
|
564
|
+
@iso_pos_z = value && value.to_s.strip
|
565
|
+
end
|
566
|
+
|
534
567
|
|
535
568
|
private
|
536
569
|
|
@@ -584,10 +617,30 @@ module RTP
|
|
584
617
|
# Note that this method is defined in the parent Record class, where it is
|
585
618
|
# used for most record types. However, because this record has two attributes
|
586
619
|
# which contain an array of values, we use a custom import_indices method.
|
587
|
-
|
620
|
+
#
|
621
|
+
# Furthermore, as of Mosaiq version 2.64, the RTP ControlPoint record includes
|
622
|
+
# 3 new attributes: iso_pos_x/y/z. Since these (unfortunately) are not placed
|
623
|
+
# at the end of the record (which is the norm), but rather inserted before the
|
624
|
+
# MLC leaf positions, we have to take special care here to make sure that this
|
625
|
+
# gets right for records where these are included or excluded.
|
626
|
+
#
|
627
|
+
# Override length:
|
628
|
+
applied_length = 235
|
629
|
+
ind = Array.new(applied_length - NR_SURPLUS_ATTRIBUTES) { |i| [i] }
|
588
630
|
# Override indices for mlc_pl_a and mlc_lp_b:
|
589
|
-
|
590
|
-
|
631
|
+
# Allocation here is dependent on the RTP file version:
|
632
|
+
# For 2.62 and earlier, where length is 232, we dont have the 3 iso_pos_x/y/z values preceeding the mlc arrays leaf position arrays.
|
633
|
+
# For 2.64 (and later), where length is 235, we have the 3 iso_pos_x/y/z values preceeding the mlc leaf position arrays.
|
634
|
+
if length == 232
|
635
|
+
ind[32] = nil
|
636
|
+
ind[33] = nil
|
637
|
+
ind[34] = nil
|
638
|
+
ind[35] = (32..131).to_a
|
639
|
+
ind[36] = (132..231).to_a
|
640
|
+
else # (length = 235)
|
641
|
+
ind[35] = (35..134).to_a
|
642
|
+
ind[36] = (135..234).to_a
|
643
|
+
end
|
591
644
|
ind
|
592
645
|
end
|
593
646
|
|
data/lib/rtp-connect/field.rb
CHANGED
@@ -61,6 +61,9 @@ module RTP
|
|
61
61
|
attr_reader :portfilm_delta_open
|
62
62
|
attr_reader :portfilm_mu_treat
|
63
63
|
attr_reader :portfilm_coeff_treat
|
64
|
+
attr_reader :iso_pos_x
|
65
|
+
attr_reader :iso_pos_y
|
66
|
+
attr_reader :iso_pos_z
|
64
67
|
|
65
68
|
# Creates a new (treatment) Field by parsing a RTPConnect string line.
|
66
69
|
#
|
@@ -79,7 +82,7 @@ module RTP
|
|
79
82
|
# @param [Record] parent a record which is used to determine the proper parent of this instance
|
80
83
|
#
|
81
84
|
def initialize(parent)
|
82
|
-
super('FIELD_DEF', 27,
|
85
|
+
super('FIELD_DEF', 27, 52)
|
83
86
|
# Child records:
|
84
87
|
@control_points = Array.new
|
85
88
|
@extended_field = nil
|
@@ -136,7 +139,10 @@ module RTP
|
|
136
139
|
:portfilm_coeff_open,
|
137
140
|
:portfilm_delta_open,
|
138
141
|
:portfilm_mu_treat,
|
139
|
-
:portfilm_coeff_treat
|
142
|
+
:portfilm_coeff_treat,
|
143
|
+
:iso_pos_x,
|
144
|
+
:iso_pos_y,
|
145
|
+
:iso_pos_z
|
140
146
|
]
|
141
147
|
end
|
142
148
|
|
@@ -635,6 +641,30 @@ module RTP
|
|
635
641
|
@portfilm_coeff_treat = value && value.to_s
|
636
642
|
end
|
637
643
|
|
644
|
+
# Sets the iso_pos_x attribute.
|
645
|
+
#
|
646
|
+
# @param [nil, #to_s] value the new attribute value
|
647
|
+
#
|
648
|
+
def iso_pos_x=(value)
|
649
|
+
@iso_pos_x = value && value.to_s.strip
|
650
|
+
end
|
651
|
+
|
652
|
+
# Sets the iso_pos_y attribute.
|
653
|
+
#
|
654
|
+
# @param [nil, #to_s] value the new attribute value
|
655
|
+
#
|
656
|
+
def iso_pos_y=(value)
|
657
|
+
@iso_pos_y = value && value.to_s.strip
|
658
|
+
end
|
659
|
+
|
660
|
+
# Sets the iso_pos_z attribute.
|
661
|
+
#
|
662
|
+
# @param [nil, #to_s] value the new attribute value
|
663
|
+
#
|
664
|
+
def iso_pos_z=(value)
|
665
|
+
@iso_pos_z = value && value.to_s.strip
|
666
|
+
end
|
667
|
+
|
638
668
|
|
639
669
|
private
|
640
670
|
|
data/lib/rtp-connect/plan.rb
CHANGED
data/lib/rtp-connect/record.rb
CHANGED
@@ -161,8 +161,11 @@ module RTP
|
|
161
161
|
#
|
162
162
|
def set_attributes(values)
|
163
163
|
import_indices([values.length - 1, @max_elements - 1].min).each_with_index do |indices, i|
|
164
|
-
param =
|
165
|
-
|
164
|
+
param = nil
|
165
|
+
if indices
|
166
|
+
param = values.values_at(*indices)
|
167
|
+
param = param[0] if param.length == 1
|
168
|
+
end
|
166
169
|
self.send("#{@attributes[i]}=", param)
|
167
170
|
end
|
168
171
|
@crc = values[-1]
|
@@ -190,8 +193,12 @@ module RTP
|
|
190
193
|
case self
|
191
194
|
when SiteSetup
|
192
195
|
options[:version].to_f >= 2.6 ? values : values[0..-4]
|
196
|
+
when Field
|
197
|
+
options[:version].to_f >= 2.64 ? values : values[0..-4]
|
193
198
|
when ExtendedField
|
194
199
|
options[:version].to_f >= 2.4 ? values : values[0..-5]
|
200
|
+
when ControlPoint
|
201
|
+
options[:version].to_f >= 2.64 ? values : values[0..31] + values[35..-1]
|
195
202
|
else
|
196
203
|
values
|
197
204
|
end
|
data/lib/rtp-connect/version.rb
CHANGED
data/rtp-connect.gemspec
CHANGED
@@ -16,13 +16,13 @@ Gem::Specification.new do |s|
|
|
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
18
|
|
19
|
-
s.required_ruby_version = '>=
|
19
|
+
s.required_ruby_version = '>= 2.2'
|
20
20
|
|
21
|
-
s.add_development_dependency('bundler', '~> 1.
|
22
|
-
s.add_development_dependency('dicom', '~> 0.9', '>= 0.9.
|
21
|
+
s.add_development_dependency('bundler', '~> 1.11')
|
22
|
+
s.add_development_dependency('dicom', '~> 0.9', '>= 0.9.8')
|
23
23
|
s.add_development_dependency('mocha', '~> 1.1')
|
24
|
-
s.add_development_dependency('rake', '~>
|
25
|
-
s.add_development_dependency('redcarpet', '~> 3.
|
26
|
-
s.add_development_dependency('rspec', '~> 3.
|
27
|
-
s.add_development_dependency('yard', '~> 0.
|
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,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rtp-connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.10'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christoffer Lervag
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.11'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.11'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: dicom
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: '0.9'
|
34
34
|
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: 0.9.
|
36
|
+
version: 0.9.8
|
37
37
|
type: :development
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0.9'
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.9.
|
46
|
+
version: 0.9.8
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: mocha
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,62 +64,62 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '12.3'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
74
|
+
version: '12.3'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: redcarpet
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '3.
|
81
|
+
version: '3.4'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '3.
|
88
|
+
version: '3.4'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: rspec
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '3.
|
95
|
+
version: '3.7'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '3.
|
102
|
+
version: '3.7'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: yard
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '0.
|
109
|
+
version: '0.9'
|
110
110
|
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: 0.
|
112
|
+
version: 0.9.12
|
113
113
|
type: :development
|
114
114
|
prerelease: false
|
115
115
|
version_requirements: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
117
|
- - "~>"
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version: '0.
|
119
|
+
version: '0.9'
|
120
120
|
- - ">="
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: 0.
|
122
|
+
version: 0.9.12
|
123
123
|
description: RTPConnect is a file format used in radiotherapy for export & import
|
124
124
|
of treatment planning data.
|
125
125
|
email: chris.lervag@gmail.com
|
@@ -164,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
164
|
requirements:
|
165
165
|
- - ">="
|
166
166
|
- !ruby/object:Gem::Version
|
167
|
-
version:
|
167
|
+
version: '2.2'
|
168
168
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
169
|
requirements:
|
170
170
|
- - ">="
|
@@ -172,9 +172,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
172
|
version: '0'
|
173
173
|
requirements: []
|
174
174
|
rubyforge_project:
|
175
|
-
rubygems_version: 2.
|
175
|
+
rubygems_version: 2.6.8
|
176
176
|
signing_key:
|
177
177
|
specification_version: 4
|
178
178
|
summary: Library for handling RTPConnect files.
|
179
179
|
test_files: []
|
180
|
-
has_rdoc:
|