rtp-connect 1.8 → 1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/CHANGELOG.md +124 -114
- data/COPYING +674 -674
- data/Gemfile +2 -2
- data/Gemfile.lock +23 -19
- data/README.md +149 -149
- data/lib/rtp-connect/constants.rb +58 -58
- data/lib/rtp-connect/control_point.rb +38 -95
- data/lib/rtp-connect/dose_tracking.rb +19 -33
- data/lib/rtp-connect/extended_field.rb +1 -20
- data/lib/rtp-connect/extended_plan.rb +115 -134
- data/lib/rtp-connect/field.rb +30 -20
- data/lib/rtp-connect/methods.rb +85 -77
- data/lib/rtp-connect/plan.rb +645 -624
- data/lib/rtp-connect/plan_to_dcm.rb +668 -656
- data/lib/rtp-connect/prescription.rb +39 -20
- data/lib/rtp-connect/record.rb +201 -143
- data/lib/rtp-connect/simulation_field.rb +606 -625
- data/lib/rtp-connect/site_setup.rb +1 -20
- data/lib/rtp-connect/version.rb +5 -5
- data/rtp-connect.gemspec +27 -27
- metadata +32 -32
data/Gemfile
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
source "http://www.rubygems.org"
|
2
|
-
|
1
|
+
source "http://www.rubygems.org"
|
2
|
+
|
3
3
|
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rtp-connect (1.
|
4
|
+
rtp-connect (1.9)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://www.rubygems.org/
|
@@ -11,31 +11,35 @@ GEM
|
|
11
11
|
metaclass (0.0.4)
|
12
12
|
mocha (1.1.0)
|
13
13
|
metaclass (~> 0.0.1)
|
14
|
-
rake (10.
|
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.0
|
14
|
+
rake (10.5.0)
|
15
|
+
redcarpet (3.3.3)
|
16
|
+
rspec (3.4.0)
|
17
|
+
rspec-core (~> 3.4.0)
|
18
|
+
rspec-expectations (~> 3.4.0)
|
19
|
+
rspec-mocks (~> 3.4.0)
|
20
|
+
rspec-core (3.4.1)
|
21
|
+
rspec-support (~> 3.4.0)
|
22
|
+
rspec-expectations (3.4.0)
|
23
23
|
diff-lcs (>= 1.2.0, < 2.0)
|
24
|
-
rspec-support (~> 3.
|
25
|
-
rspec-mocks (3.0
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
rspec-support (~> 3.4.0)
|
25
|
+
rspec-mocks (3.4.0)
|
26
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
+
rspec-support (~> 3.4.0)
|
28
|
+
rspec-support (3.4.0)
|
29
|
+
yard (0.8.7.6)
|
29
30
|
|
30
31
|
PLATFORMS
|
31
32
|
x86-mingw32
|
32
33
|
|
33
34
|
DEPENDENCIES
|
34
|
-
bundler (~> 1.
|
35
|
+
bundler (~> 1.8)
|
35
36
|
dicom (~> 0.9, >= 0.9.6)
|
36
37
|
mocha (~> 1.1)
|
37
|
-
rake (~> 10.
|
38
|
-
redcarpet (~> 3.
|
39
|
-
rspec (~> 3.
|
38
|
+
rake (~> 10.4)
|
39
|
+
redcarpet (~> 3.2)
|
40
|
+
rspec (~> 3.2)
|
40
41
|
rtp-connect!
|
41
42
|
yard (~> 0.8, >= 0.8.7)
|
43
|
+
|
44
|
+
BUNDLED WITH
|
45
|
+
1.11.2
|
data/README.md
CHANGED
@@ -1,150 +1,150 @@
|
|
1
|
-
[![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.11752.png)](http://dx.doi.org/10.5281/zenodo.11752)
|
2
|
-
|
3
|
-
# RTPConnect
|
4
|
-
|
5
|
-
The RTPConnect library allows you to read, edit and write RTPConnect files in Ruby.
|
6
|
-
RTPConnect is a file format used in radiotherapy (e.g. Mosaiq) for export & import
|
7
|
-
of treatment planning data. The library is written entirely in Ruby and has no
|
8
|
-
external dependencies.
|
9
|
-
|
10
|
-
|
11
|
-
## INSTALLATION
|
12
|
-
|
13
|
-
gem install rtp-connect
|
14
|
-
|
15
|
-
|
16
|
-
## REQUIREMENTS
|
17
|
-
|
18
|
-
* Ruby 1.9.3 (or higher)
|
19
|
-
|
20
|
-
|
21
|
-
## BASIC USAGE
|
22
|
-
|
23
|
-
### Load & Include
|
24
|
-
|
25
|
-
require 'rtp-connect'
|
26
|
-
include RTP
|
27
|
-
|
28
|
-
### Read, modify and write
|
29
|
-
|
30
|
-
# Read file:
|
31
|
-
rtp = Plan.read('some_file.rtp')
|
32
|
-
# Extract the Patient's Name:
|
33
|
-
name = rtp.patient_last_name
|
34
|
-
# Modify the Patient's Name:
|
35
|
-
rtp.patient_last_name = 'Anonymous'
|
36
|
-
# Write to file:
|
37
|
-
rtp.write('new_file.rtp')
|
38
|
-
|
39
|
-
### Create a new Plan Definition Record from scratch
|
40
|
-
|
41
|
-
# Create the instance:
|
42
|
-
rtp = Plan.new
|
43
|
-
# Set the Patient's ID attribute:
|
44
|
-
rtp.patient_id = '12345'
|
45
|
-
# Export the instance to an RTP string (with CRC):
|
46
|
-
output = rtp.to_s
|
47
|
-
|
48
|
-
### Fix invalid RTP files:
|
49
|
-
|
50
|
-
# Read an RTP file containing invalid checksum(s):
|
51
|
-
rtp = Plan.read('invalid_crc.rtp', ignore_crc: true)
|
52
|
-
# Read an RTP file containing unknown record type(s):
|
53
|
-
rtp = Plan.read('custom.rtp', skip_unknown: true)
|
54
|
-
# Read an RTP file containing invalid CSV format:
|
55
|
-
rtp = Plan.read('invalid_csv.rtp', repair: true)
|
56
|
-
# Write a corrected RTP file:
|
57
|
-
rtp.write('valid.rtp')
|
58
|
-
|
59
|
-
### Convert an RTP file to DICOM:
|
60
|
-
|
61
|
-
p = Plan.read('some_file.rtp')
|
62
|
-
dcm = p.to_dcm
|
63
|
-
dcm.write('rtplan.dcm')
|
64
|
-
|
65
|
-
### Log settings
|
66
|
-
|
67
|
-
# Change the log level so that only error messages are displayed:
|
68
|
-
RTP.logger.level = Logger::ERROR
|
69
|
-
# Setting up a simple file log:
|
70
|
-
l = Logger.new('my_logfile.log')
|
71
|
-
RTP.logger = l
|
72
|
-
# Create a logger which ages logfile daily/monthly:
|
73
|
-
RTP.logger = Logger.new('foo.log', 'daily')
|
74
|
-
RTP.logger = Logger.new('foo.log', 'monthly')
|
75
|
-
|
76
|
-
### Scripts
|
77
|
-
|
78
|
-
For more comprehensive and useful examples, check out the scripts folder
|
79
|
-
which contains various Ruby scripts that intends to show off real world
|
80
|
-
usage scenarios of the RTPConnect library.
|
81
|
-
|
82
|
-
### IRB Tip
|
83
|
-
|
84
|
-
When working with the RTPConnect library in irb, you may be annoyed with all
|
85
|
-
the information that is printed to screen, regardless of your log level.
|
86
|
-
This is because in irb every variable loaded in the program is
|
87
|
-
automatically printed to the screen. A useful hack to avoid this effect is
|
88
|
-
to append ";0" after a command.
|
89
|
-
|
90
|
-
Example:
|
91
|
-
|
92
|
-
rtp = Plan.read('some_file.rtp') ;0
|
93
|
-
|
94
|
-
|
95
|
-
## RESOURCES
|
96
|
-
|
97
|
-
* [Rubygems download](https://rubygems.org/gems/rtp-connect)
|
98
|
-
* [Documentation](http://rubydoc.info/gems/rtp-connect/frames)
|
99
|
-
* [Source code repository](https://github.com/dicom/rtp-connect)
|
100
|
-
|
101
|
-
|
102
|
-
## RESTRICTIONS
|
103
|
-
|
104
|
-
### Supported records
|
105
|
-
|
106
|
-
* Plan definition [PLAN_DEF]
|
107
|
-
* Extended plan definition [EXTENDED_PLAN_DEF]
|
108
|
-
* Prescription site [RX_DEF]
|
109
|
-
* Site setup [SITE_SETUP_DEF]
|
110
|
-
* Simulation field [SIM_DEF]
|
111
|
-
* Treatment field [FIELD_DEF]
|
112
|
-
* Extended treatment field [EXTENDED_FIELD_DEF]
|
113
|
-
* Control point record [CONTROL_PT_DEF]
|
114
|
-
* Dose tracking record [DOSE_DEF]
|
115
|
-
|
116
|
-
### Unsupported records
|
117
|
-
|
118
|
-
* Document based treatment field [PDF_FIELD_DEF]
|
119
|
-
* Multileaf collimator [MLC_DEF]
|
120
|
-
* MLC shape [MLC_SHAPE_DEF]
|
121
|
-
* Dose action points [DOSE_ACTION]
|
122
|
-
|
123
|
-
If you encounter an RTP file with an unsupported record type, please contact me.
|
124
|
-
|
125
|
-
|
126
|
-
## COPYRIGHT
|
127
|
-
|
128
|
-
Copyright 2011-
|
129
|
-
|
130
|
-
This program is free software: you can redistribute it and/or modify
|
131
|
-
it under the terms of the GNU General Public License as published by
|
132
|
-
the Free Software Foundation, either version 3 of the License, or
|
133
|
-
(at your option) any later version.
|
134
|
-
|
135
|
-
This program is distributed in the hope that it will be useful,
|
136
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
137
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
138
|
-
GNU General Public License for more details.
|
139
|
-
|
140
|
-
You should have received a copy of the GNU General Public License
|
141
|
-
along with this program. If not, see http://www.gnu.org/licenses/ .
|
142
|
-
|
143
|
-
|
144
|
-
## ABOUT THE AUTHOR
|
145
|
-
|
146
|
-
* Name: Christoffer Lervåg
|
147
|
-
* Location: Norway
|
148
|
-
* Email: chris.lervag [@nospam.com] @gmail.com
|
149
|
-
|
1
|
+
[![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.11752.png)](http://dx.doi.org/10.5281/zenodo.11752)
|
2
|
+
|
3
|
+
# RTPConnect
|
4
|
+
|
5
|
+
The RTPConnect library allows you to read, edit and write RTPConnect files in Ruby.
|
6
|
+
RTPConnect is a file format used in radiotherapy (e.g. Mosaiq) for export & import
|
7
|
+
of treatment planning data. The library is written entirely in Ruby and has no
|
8
|
+
external dependencies.
|
9
|
+
|
10
|
+
|
11
|
+
## INSTALLATION
|
12
|
+
|
13
|
+
gem install rtp-connect
|
14
|
+
|
15
|
+
|
16
|
+
## REQUIREMENTS
|
17
|
+
|
18
|
+
* Ruby 1.9.3 (or higher)
|
19
|
+
|
20
|
+
|
21
|
+
## BASIC USAGE
|
22
|
+
|
23
|
+
### Load & Include
|
24
|
+
|
25
|
+
require 'rtp-connect'
|
26
|
+
include RTP
|
27
|
+
|
28
|
+
### Read, modify and write
|
29
|
+
|
30
|
+
# Read file:
|
31
|
+
rtp = Plan.read('some_file.rtp')
|
32
|
+
# Extract the Patient's Name:
|
33
|
+
name = rtp.patient_last_name
|
34
|
+
# Modify the Patient's Name:
|
35
|
+
rtp.patient_last_name = 'Anonymous'
|
36
|
+
# Write to file:
|
37
|
+
rtp.write('new_file.rtp')
|
38
|
+
|
39
|
+
### Create a new Plan Definition Record from scratch
|
40
|
+
|
41
|
+
# Create the instance:
|
42
|
+
rtp = Plan.new
|
43
|
+
# Set the Patient's ID attribute:
|
44
|
+
rtp.patient_id = '12345'
|
45
|
+
# Export the instance to an RTP string (with CRC):
|
46
|
+
output = rtp.to_s
|
47
|
+
|
48
|
+
### Fix invalid RTP files:
|
49
|
+
|
50
|
+
# Read an RTP file containing invalid checksum(s):
|
51
|
+
rtp = Plan.read('invalid_crc.rtp', ignore_crc: true)
|
52
|
+
# Read an RTP file containing unknown record type(s):
|
53
|
+
rtp = Plan.read('custom.rtp', skip_unknown: true)
|
54
|
+
# Read an RTP file containing invalid CSV format:
|
55
|
+
rtp = Plan.read('invalid_csv.rtp', repair: true)
|
56
|
+
# Write a corrected RTP file:
|
57
|
+
rtp.write('valid.rtp')
|
58
|
+
|
59
|
+
### Convert an RTP file to DICOM:
|
60
|
+
|
61
|
+
p = Plan.read('some_file.rtp')
|
62
|
+
dcm = p.to_dcm
|
63
|
+
dcm.write('rtplan.dcm')
|
64
|
+
|
65
|
+
### Log settings
|
66
|
+
|
67
|
+
# Change the log level so that only error messages are displayed:
|
68
|
+
RTP.logger.level = Logger::ERROR
|
69
|
+
# Setting up a simple file log:
|
70
|
+
l = Logger.new('my_logfile.log')
|
71
|
+
RTP.logger = l
|
72
|
+
# Create a logger which ages logfile daily/monthly:
|
73
|
+
RTP.logger = Logger.new('foo.log', 'daily')
|
74
|
+
RTP.logger = Logger.new('foo.log', 'monthly')
|
75
|
+
|
76
|
+
### Scripts
|
77
|
+
|
78
|
+
For more comprehensive and useful examples, check out the scripts folder
|
79
|
+
which contains various Ruby scripts that intends to show off real world
|
80
|
+
usage scenarios of the RTPConnect library.
|
81
|
+
|
82
|
+
### IRB Tip
|
83
|
+
|
84
|
+
When working with the RTPConnect library in irb, you may be annoyed with all
|
85
|
+
the information that is printed to screen, regardless of your log level.
|
86
|
+
This is because in irb every variable loaded in the program is
|
87
|
+
automatically printed to the screen. A useful hack to avoid this effect is
|
88
|
+
to append ";0" after a command.
|
89
|
+
|
90
|
+
Example:
|
91
|
+
|
92
|
+
rtp = Plan.read('some_file.rtp') ;0
|
93
|
+
|
94
|
+
|
95
|
+
## RESOURCES
|
96
|
+
|
97
|
+
* [Rubygems download](https://rubygems.org/gems/rtp-connect)
|
98
|
+
* [Documentation](http://rubydoc.info/gems/rtp-connect/frames)
|
99
|
+
* [Source code repository](https://github.com/dicom/rtp-connect)
|
100
|
+
|
101
|
+
|
102
|
+
## RESTRICTIONS
|
103
|
+
|
104
|
+
### Supported records
|
105
|
+
|
106
|
+
* Plan definition [PLAN_DEF]
|
107
|
+
* Extended plan definition [EXTENDED_PLAN_DEF]
|
108
|
+
* Prescription site [RX_DEF]
|
109
|
+
* Site setup [SITE_SETUP_DEF]
|
110
|
+
* Simulation field [SIM_DEF]
|
111
|
+
* Treatment field [FIELD_DEF]
|
112
|
+
* Extended treatment field [EXTENDED_FIELD_DEF]
|
113
|
+
* Control point record [CONTROL_PT_DEF]
|
114
|
+
* Dose tracking record [DOSE_DEF]
|
115
|
+
|
116
|
+
### Unsupported records
|
117
|
+
|
118
|
+
* Document based treatment field [PDF_FIELD_DEF]
|
119
|
+
* Multileaf collimator [MLC_DEF]
|
120
|
+
* MLC shape [MLC_SHAPE_DEF]
|
121
|
+
* Dose action points [DOSE_ACTION]
|
122
|
+
|
123
|
+
If you encounter an RTP file with an unsupported record type, please contact me.
|
124
|
+
|
125
|
+
|
126
|
+
## COPYRIGHT
|
127
|
+
|
128
|
+
Copyright 2011-2016 Christoffer Lervåg
|
129
|
+
|
130
|
+
This program is free software: you can redistribute it and/or modify
|
131
|
+
it under the terms of the GNU General Public License as published by
|
132
|
+
the Free Software Foundation, either version 3 of the License, or
|
133
|
+
(at your option) any later version.
|
134
|
+
|
135
|
+
This program is distributed in the hope that it will be useful,
|
136
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
137
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
138
|
+
GNU General Public License for more details.
|
139
|
+
|
140
|
+
You should have received a copy of the GNU General Public License
|
141
|
+
along with this program. If not, see http://www.gnu.org/licenses/ .
|
142
|
+
|
143
|
+
|
144
|
+
## ABOUT THE AUTHOR
|
145
|
+
|
146
|
+
* Name: Christoffer Lervåg
|
147
|
+
* Location: Norway
|
148
|
+
* Email: chris.lervag [@nospam.com] @gmail.com
|
149
|
+
|
150
150
|
Please don't hesitate to email me if you have any feedback related to this project!
|
@@ -1,59 +1,59 @@
|
|
1
|
-
module RTP
|
2
|
-
|
3
|
-
# The seed value used in the RTPConnect implementation of the CCITT algorithm.
|
4
|
-
CRC_SEED = 0x0521
|
5
|
-
|
6
|
-
# The table & values used in the RTPConnect implementation of the CCITT algorithm.
|
7
|
-
CRC_TABLE = [
|
8
|
-
0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
|
9
|
-
0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
|
10
|
-
0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
|
11
|
-
0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,
|
12
|
-
0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,
|
13
|
-
0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,
|
14
|
-
0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,
|
15
|
-
0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,
|
16
|
-
0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,
|
17
|
-
0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,
|
18
|
-
0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,
|
19
|
-
0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,
|
20
|
-
0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,
|
21
|
-
0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,
|
22
|
-
0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,
|
23
|
-
0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,
|
24
|
-
0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,
|
25
|
-
0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,
|
26
|
-
0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,
|
27
|
-
0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,
|
28
|
-
0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,
|
29
|
-
0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,
|
30
|
-
0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,
|
31
|
-
0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,
|
32
|
-
0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,
|
33
|
-
0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,
|
34
|
-
0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,
|
35
|
-
0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,
|
36
|
-
0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,
|
37
|
-
0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41,
|
38
|
-
0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,
|
39
|
-
0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040
|
40
|
-
]
|
41
|
-
|
42
|
-
# Pairs of RTPConnect keywords and parse method names.
|
43
|
-
PARSE_METHOD = {
|
44
|
-
"PLAN_DEF" => :plan_definition,
|
45
|
-
"EXTENDED_PLAN_DEF" => :extended_plan_def,
|
46
|
-
"RX_DEF" => :prescription_site,
|
47
|
-
"SITE_SETUP_DEF" => :site_setup,
|
48
|
-
"SIM_DEF" => :simulation_field,
|
49
|
-
"FIELD_DEF" => :treatment_field,
|
50
|
-
"EXTENDED_FIELD_DEF" => :extended_treatment_field,
|
51
|
-
"PDF_FIELD_DEF" => :document_based_treatment_field,
|
52
|
-
"MLC_DEF" => :multileaf_collimator,
|
53
|
-
"CONTROL_PT_DEF" => :control_point,
|
54
|
-
"MLC_SHAPE_DEF" => :mlc_shape,
|
55
|
-
"DOSE_DEF" => :dose_tracking,
|
56
|
-
"DOSE_ACTION" => :dose_action,
|
57
|
-
}
|
58
|
-
|
1
|
+
module RTP
|
2
|
+
|
3
|
+
# The seed value used in the RTPConnect implementation of the CCITT algorithm.
|
4
|
+
CRC_SEED = 0x0521
|
5
|
+
|
6
|
+
# The table & values used in the RTPConnect implementation of the CCITT algorithm.
|
7
|
+
CRC_TABLE = [
|
8
|
+
0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
|
9
|
+
0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
|
10
|
+
0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,
|
11
|
+
0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,
|
12
|
+
0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,
|
13
|
+
0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,
|
14
|
+
0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,
|
15
|
+
0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,
|
16
|
+
0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,
|
17
|
+
0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,
|
18
|
+
0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,
|
19
|
+
0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,
|
20
|
+
0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,
|
21
|
+
0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,
|
22
|
+
0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,
|
23
|
+
0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,
|
24
|
+
0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,
|
25
|
+
0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,
|
26
|
+
0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,
|
27
|
+
0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,
|
28
|
+
0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,
|
29
|
+
0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,
|
30
|
+
0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,
|
31
|
+
0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,
|
32
|
+
0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,
|
33
|
+
0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,
|
34
|
+
0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,
|
35
|
+
0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,
|
36
|
+
0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,
|
37
|
+
0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41,
|
38
|
+
0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,
|
39
|
+
0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040
|
40
|
+
]
|
41
|
+
|
42
|
+
# Pairs of RTPConnect keywords and parse method names.
|
43
|
+
PARSE_METHOD = {
|
44
|
+
"PLAN_DEF" => :plan_definition,
|
45
|
+
"EXTENDED_PLAN_DEF" => :extended_plan_def,
|
46
|
+
"RX_DEF" => :prescription_site,
|
47
|
+
"SITE_SETUP_DEF" => :site_setup,
|
48
|
+
"SIM_DEF" => :simulation_field,
|
49
|
+
"FIELD_DEF" => :treatment_field,
|
50
|
+
"EXTENDED_FIELD_DEF" => :extended_treatment_field,
|
51
|
+
"PDF_FIELD_DEF" => :document_based_treatment_field,
|
52
|
+
"MLC_DEF" => :multileaf_collimator,
|
53
|
+
"CONTROL_PT_DEF" => :control_point,
|
54
|
+
"MLC_SHAPE_DEF" => :mlc_shape,
|
55
|
+
"DOSE_DEF" => :dose_tracking,
|
56
|
+
"DOSE_ACTION" => :dose_action,
|
57
|
+
}
|
58
|
+
|
59
59
|
end
|