Class: RTP::Field
Overview
Relations:
-
Parent: Prescription
-
Children: ExtendedField, ControlPoint
The treatment Field class.
Constant Summary
Constants inherited from Record
Instance Attribute Summary collapse
-
#arc_direction ⇒ Object
Returns the value of attribute arc_direction.
-
#arc_mu_degree ⇒ Object
Returns the value of attribute arc_mu_degree.
-
#arc_start_angle ⇒ Object
Returns the value of attribute arc_start_angle.
-
#arc_stop_angle ⇒ Object
Returns the value of attribute arc_stop_angle.
-
#block ⇒ Object
Returns the value of attribute block.
-
#bolus ⇒ Object
Returns the value of attribute bolus.
-
#collimator_angle ⇒ Object
Returns the value of attribute collimator_angle.
-
#collimator_x1 ⇒ Object
Returns the value of attribute collimator_x1.
-
#collimator_x2 ⇒ Object
Returns the value of attribute collimator_x2.
-
#collimator_y1 ⇒ Object
Returns the value of attribute collimator_y1.
-
#collimator_y2 ⇒ Object
Returns the value of attribute collimator_y2.
-
#compensator ⇒ Object
Returns the value of attribute compensator.
-
#control_points ⇒ Object
readonly
An array of ControlPoint records (if any) that belongs to this Field.
-
#couch_angle ⇒ Object
Returns the value of attribute couch_angle.
-
#couch_lateral ⇒ Object
Returns the value of attribute couch_lateral.
-
#couch_longitudinal ⇒ Object
Returns the value of attribute couch_longitudinal.
-
#couch_pedestal ⇒ Object
Returns the value of attribute couch_pedestal.
-
#couch_vertical ⇒ Object
Returns the value of attribute couch_vertical.
-
#doserate ⇒ Object
Returns the value of attribute doserate.
-
#dynamic_wedge ⇒ Object
Returns the value of attribute dynamic_wedge.
-
#e_applicator ⇒ Object
Returns the value of attribute e_applicator.
-
#e_field_def_aperture ⇒ Object
Returns the value of attribute e_field_def_aperture.
-
#energy ⇒ Object
Returns the value of attribute energy.
-
#extended_field ⇒ Object
readonly
The ExtendedField record (if any) that belongs to this Field.
-
#field_dose ⇒ Object
Returns the value of attribute field_dose.
-
#field_id ⇒ Object
Returns the value of attribute field_id.
-
#field_monitor_units ⇒ Object
Returns the value of attribute field_monitor_units.
-
#field_name ⇒ Object
Returns the value of attribute field_name.
-
#field_note ⇒ Object
Returns the value of attribute field_note.
-
#field_x ⇒ Object
Returns the value of attribute field_x.
-
#field_x_mode ⇒ Object
Returns the value of attribute field_x_mode.
-
#field_y ⇒ Object
Returns the value of attribute field_y.
-
#field_y_mode ⇒ Object
Returns the value of attribute field_y_mode.
-
#gantry_angle ⇒ Object
Returns the value of attribute gantry_angle.
-
#iso_pos_x ⇒ Object
Returns the value of attribute iso_pos_x.
-
#iso_pos_y ⇒ Object
Returns the value of attribute iso_pos_y.
-
#iso_pos_z ⇒ Object
Returns the value of attribute iso_pos_z.
-
#modality ⇒ Object
Returns the value of attribute modality.
-
#parent ⇒ Object
The Record which this instance belongs to.
-
#portfilm_coeff_open ⇒ Object
Returns the value of attribute portfilm_coeff_open.
-
#portfilm_coeff_treat ⇒ Object
Returns the value of attribute portfilm_coeff_treat.
-
#portfilm_delta_open ⇒ Object
Returns the value of attribute portfilm_delta_open.
-
#portfilm_mu_open ⇒ Object
Returns the value of attribute portfilm_mu_open.
-
#portfilm_mu_treat ⇒ Object
Returns the value of attribute portfilm_mu_treat.
-
#rx_site_name ⇒ Object
Returns the value of attribute rx_site_name.
-
#sad ⇒ Object
Returns the value of attribute sad.
-
#ssd ⇒ Object
Returns the value of attribute ssd.
-
#time ⇒ Object
Returns the value of attribute time.
-
#tolerance_table ⇒ Object
Returns the value of attribute tolerance_table.
-
#treatment_machine ⇒ Object
Returns the value of attribute treatment_machine.
-
#treatment_type ⇒ Object
Returns the value of attribute treatment_type.
-
#wedge ⇒ Object
Returns the value of attribute wedge.
-
#wedge_monitor_units ⇒ Object
Returns the value of attribute wedge_monitor_units.
Attributes inherited from Record
Class Method Summary collapse
-
.load(string, parent) ⇒ Field
Creates a new (treatment) Field by parsing a RTPConnect string line.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
Checks for equality.
-
#add_control_point(child) ⇒ Object
Adds a control point record to this instance.
-
#add_extended_field(child) ⇒ Object
Adds an extended treatment field record to this instance.
-
#children ⇒ Array<ExtendedField, ControlPoint>
Collects the child records of this instance in a properly sorted array.
-
#dcm_collimator_x1 ⇒ Float
Converts the collimator_x1 attribute to proper DICOM format.
-
#dcm_collimator_x2 ⇒ Float
Converts the collimator_x2 attribute to proper DICOM format.
-
#dcm_collimator_y1 ⇒ Float
Converts the collimator_y1 attribute to proper DICOM format.
-
#dcm_collimator_y2 ⇒ Float
Converts the collimator_y2 attribute to proper DICOM format.
-
#delete(record) ⇒ Object
Removes the reference of the given instance from this instance.
-
#delete_control_points ⇒ Object
Removes all control point references from this instance.
-
#delete_extended_field ⇒ Object
Removes the extended field reference from this instance.
-
#hash ⇒ Fixnum
Computes a hash code for this object.
-
#initialize(parent) ⇒ Field
constructor
Creates a new (treatment) Field.
-
#to_field ⇒ Field
Returns self.
Methods inherited from Record
#encode, #get_parent, #load, #to_record, #to_s, #values
Constructor Details
#initialize(parent) ⇒ Field
Creates a new (treatment) Field.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/rtp-connect/field.rb', line 84 def initialize(parent) super('FIELD_DEF', 27, 52) # Child records: @control_points = Array.new @extended_field = nil # Parent relation (may get more than one type of record here): @parent = get_parent(parent.to_record, Prescription) @parent.add_field(self) @attributes = [ # Required: :keyword, :rx_site_name, :field_name, :field_id, :field_note, :field_dose, :field_monitor_units, :wedge_monitor_units, :treatment_machine, :treatment_type, :modality, :energy, :time, :doserate, :sad, :ssd, :gantry_angle, :collimator_angle, :field_x_mode, :field_x, :collimator_x1, :collimator_x2, :field_y_mode, :field_y, :collimator_y1, :collimator_y2, # Optional: :couch_vertical, :couch_lateral, :couch_longitudinal, :couch_angle, :couch_pedestal, :tolerance_table, :arc_direction, :arc_start_angle, :arc_stop_angle, :arc_mu_degree, :wedge, :dynamic_wedge, :block, :compensator, :e_applicator, :e_field_def_aperture, :bolus, :portfilm_mu_open, :portfilm_coeff_open, :portfilm_delta_open, :portfilm_mu_treat, :portfilm_coeff_treat, :iso_pos_x, :iso_pos_y, :iso_pos_z ] end |
Instance Attribute Details
#arc_direction ⇒ Object
Returns the value of attribute arc_direction.
48 49 50 |
# File 'lib/rtp-connect/field.rb', line 48 def arc_direction @arc_direction end |
#arc_mu_degree ⇒ Object
Returns the value of attribute arc_mu_degree.
51 52 53 |
# File 'lib/rtp-connect/field.rb', line 51 def arc_mu_degree @arc_mu_degree end |
#arc_start_angle ⇒ Object
Returns the value of attribute arc_start_angle.
49 50 51 |
# File 'lib/rtp-connect/field.rb', line 49 def arc_start_angle @arc_start_angle end |
#arc_stop_angle ⇒ Object
Returns the value of attribute arc_stop_angle.
50 51 52 |
# File 'lib/rtp-connect/field.rb', line 50 def arc_stop_angle @arc_stop_angle end |
#block ⇒ Object
Returns the value of attribute block.
54 55 56 |
# File 'lib/rtp-connect/field.rb', line 54 def block @block end |
#bolus ⇒ Object
Returns the value of attribute bolus.
58 59 60 |
# File 'lib/rtp-connect/field.rb', line 58 def bolus @bolus end |
#collimator_angle ⇒ Object
Returns the value of attribute collimator_angle.
33 34 35 |
# File 'lib/rtp-connect/field.rb', line 33 def collimator_angle @collimator_angle end |
#collimator_x1 ⇒ Object
Returns the value of attribute collimator_x1.
36 37 38 |
# File 'lib/rtp-connect/field.rb', line 36 def collimator_x1 @collimator_x1 end |
#collimator_x2 ⇒ Object
Returns the value of attribute collimator_x2.
37 38 39 |
# File 'lib/rtp-connect/field.rb', line 37 def collimator_x2 @collimator_x2 end |
#collimator_y1 ⇒ Object
Returns the value of attribute collimator_y1.
40 41 42 |
# File 'lib/rtp-connect/field.rb', line 40 def collimator_y1 @collimator_y1 end |
#collimator_y2 ⇒ Object
Returns the value of attribute collimator_y2.
41 42 43 |
# File 'lib/rtp-connect/field.rb', line 41 def collimator_y2 @collimator_y2 end |
#compensator ⇒ Object
Returns the value of attribute compensator.
55 56 57 |
# File 'lib/rtp-connect/field.rb', line 55 def compensator @compensator end |
#control_points ⇒ Object (readonly)
An array of ControlPoint records (if any) that belongs to this Field.
16 17 18 |
# File 'lib/rtp-connect/field.rb', line 16 def control_points @control_points end |
#couch_angle ⇒ Object
Returns the value of attribute couch_angle.
45 46 47 |
# File 'lib/rtp-connect/field.rb', line 45 def couch_angle @couch_angle end |
#couch_lateral ⇒ Object
Returns the value of attribute couch_lateral.
43 44 45 |
# File 'lib/rtp-connect/field.rb', line 43 def couch_lateral @couch_lateral end |
#couch_longitudinal ⇒ Object
Returns the value of attribute couch_longitudinal.
44 45 46 |
# File 'lib/rtp-connect/field.rb', line 44 def couch_longitudinal @couch_longitudinal end |
#couch_pedestal ⇒ Object
Returns the value of attribute couch_pedestal.
46 47 48 |
# File 'lib/rtp-connect/field.rb', line 46 def couch_pedestal @couch_pedestal end |
#couch_vertical ⇒ Object
Returns the value of attribute couch_vertical.
42 43 44 |
# File 'lib/rtp-connect/field.rb', line 42 def couch_vertical @couch_vertical end |
#doserate ⇒ Object
Returns the value of attribute doserate.
29 30 31 |
# File 'lib/rtp-connect/field.rb', line 29 def doserate @doserate end |
#dynamic_wedge ⇒ Object
Returns the value of attribute dynamic_wedge.
53 54 55 |
# File 'lib/rtp-connect/field.rb', line 53 def dynamic_wedge @dynamic_wedge end |
#e_applicator ⇒ Object
Returns the value of attribute e_applicator.
56 57 58 |
# File 'lib/rtp-connect/field.rb', line 56 def e_applicator @e_applicator end |
#e_field_def_aperture ⇒ Object
Returns the value of attribute e_field_def_aperture.
57 58 59 |
# File 'lib/rtp-connect/field.rb', line 57 def e_field_def_aperture @e_field_def_aperture end |
#energy ⇒ Object
Returns the value of attribute energy.
27 28 29 |
# File 'lib/rtp-connect/field.rb', line 27 def energy @energy end |
#extended_field ⇒ Object (readonly)
The ExtendedField record (if any) that belongs to this Field.
14 15 16 |
# File 'lib/rtp-connect/field.rb', line 14 def extended_field @extended_field end |
#field_dose ⇒ Object
Returns the value of attribute field_dose.
21 22 23 |
# File 'lib/rtp-connect/field.rb', line 21 def field_dose @field_dose end |
#field_id ⇒ Object
Returns the value of attribute field_id.
19 20 21 |
# File 'lib/rtp-connect/field.rb', line 19 def field_id @field_id end |
#field_monitor_units ⇒ Object
Returns the value of attribute field_monitor_units.
22 23 24 |
# File 'lib/rtp-connect/field.rb', line 22 def field_monitor_units @field_monitor_units end |
#field_name ⇒ Object
Returns the value of attribute field_name.
18 19 20 |
# File 'lib/rtp-connect/field.rb', line 18 def field_name @field_name end |
#field_note ⇒ Object
Returns the value of attribute field_note.
20 21 22 |
# File 'lib/rtp-connect/field.rb', line 20 def field_note @field_note end |
#field_x ⇒ Object
Returns the value of attribute field_x.
35 36 37 |
# File 'lib/rtp-connect/field.rb', line 35 def field_x @field_x end |
#field_x_mode ⇒ Object
Returns the value of attribute field_x_mode.
34 35 36 |
# File 'lib/rtp-connect/field.rb', line 34 def field_x_mode @field_x_mode end |
#field_y ⇒ Object
Returns the value of attribute field_y.
39 40 41 |
# File 'lib/rtp-connect/field.rb', line 39 def field_y @field_y end |
#field_y_mode ⇒ Object
Returns the value of attribute field_y_mode.
38 39 40 |
# File 'lib/rtp-connect/field.rb', line 38 def field_y_mode @field_y_mode end |
#gantry_angle ⇒ Object
Returns the value of attribute gantry_angle.
32 33 34 |
# File 'lib/rtp-connect/field.rb', line 32 def gantry_angle @gantry_angle end |
#iso_pos_x ⇒ Object
Returns the value of attribute iso_pos_x.
64 65 66 |
# File 'lib/rtp-connect/field.rb', line 64 def iso_pos_x @iso_pos_x end |
#iso_pos_y ⇒ Object
Returns the value of attribute iso_pos_y.
65 66 67 |
# File 'lib/rtp-connect/field.rb', line 65 def iso_pos_y @iso_pos_y end |
#iso_pos_z ⇒ Object
Returns the value of attribute iso_pos_z.
66 67 68 |
# File 'lib/rtp-connect/field.rb', line 66 def iso_pos_z @iso_pos_z end |
#modality ⇒ Object
Returns the value of attribute modality.
26 27 28 |
# File 'lib/rtp-connect/field.rb', line 26 def modality @modality end |
#parent ⇒ Object
The Record which this instance belongs to.
12 13 14 |
# File 'lib/rtp-connect/field.rb', line 12 def parent @parent end |
#portfilm_coeff_open ⇒ Object
Returns the value of attribute portfilm_coeff_open.
60 61 62 |
# File 'lib/rtp-connect/field.rb', line 60 def portfilm_coeff_open @portfilm_coeff_open end |
#portfilm_coeff_treat ⇒ Object
Returns the value of attribute portfilm_coeff_treat.
63 64 65 |
# File 'lib/rtp-connect/field.rb', line 63 def portfilm_coeff_treat @portfilm_coeff_treat end |
#portfilm_delta_open ⇒ Object
Returns the value of attribute portfilm_delta_open.
61 62 63 |
# File 'lib/rtp-connect/field.rb', line 61 def portfilm_delta_open @portfilm_delta_open end |
#portfilm_mu_open ⇒ Object
Returns the value of attribute portfilm_mu_open.
59 60 61 |
# File 'lib/rtp-connect/field.rb', line 59 def portfilm_mu_open @portfilm_mu_open end |
#portfilm_mu_treat ⇒ Object
Returns the value of attribute portfilm_mu_treat.
62 63 64 |
# File 'lib/rtp-connect/field.rb', line 62 def portfilm_mu_treat @portfilm_mu_treat end |
#rx_site_name ⇒ Object
Returns the value of attribute rx_site_name.
17 18 19 |
# File 'lib/rtp-connect/field.rb', line 17 def rx_site_name @rx_site_name end |
#sad ⇒ Object
Returns the value of attribute sad.
30 31 32 |
# File 'lib/rtp-connect/field.rb', line 30 def sad @sad end |
#ssd ⇒ Object
Returns the value of attribute ssd.
31 32 33 |
# File 'lib/rtp-connect/field.rb', line 31 def ssd @ssd end |
#time ⇒ Object
Returns the value of attribute time.
28 29 30 |
# File 'lib/rtp-connect/field.rb', line 28 def time @time end |
#tolerance_table ⇒ Object
Returns the value of attribute tolerance_table.
47 48 49 |
# File 'lib/rtp-connect/field.rb', line 47 def tolerance_table @tolerance_table end |
#treatment_machine ⇒ Object
Returns the value of attribute treatment_machine.
24 25 26 |
# File 'lib/rtp-connect/field.rb', line 24 def treatment_machine @treatment_machine end |
#treatment_type ⇒ Object
Returns the value of attribute treatment_type.
25 26 27 |
# File 'lib/rtp-connect/field.rb', line 25 def treatment_type @treatment_type end |
#wedge ⇒ Object
Returns the value of attribute wedge.
52 53 54 |
# File 'lib/rtp-connect/field.rb', line 52 def wedge @wedge end |
#wedge_monitor_units ⇒ Object
Returns the value of attribute wedge_monitor_units.
23 24 25 |
# File 'lib/rtp-connect/field.rb', line 23 def wedge_monitor_units @wedge_monitor_units end |
Class Method Details
.load(string, parent) ⇒ Field
Creates a new (treatment) Field by parsing a RTPConnect string line.
75 76 77 78 |
# File 'lib/rtp-connect/field.rb', line 75 def self.load(string, parent) f = self.new(parent) f.load(string) end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
Checks for equality.
Other and self are considered equivalent if they are of compatible types and their attributes are equivalent.
157 158 159 160 161 |
# File 'lib/rtp-connect/field.rb', line 157 def ==(other) if other.respond_to?(:to_field) other.send(:state) == state end end |
#add_control_point(child) ⇒ Object
Adds a control point record to this instance.
169 170 171 172 |
# File 'lib/rtp-connect/field.rb', line 169 def add_control_point(child) @control_points << child.to_control_point child.parent = self end |
#add_extended_field(child) ⇒ Object
Adds an extended treatment field record to this instance.
178 179 180 181 |
# File 'lib/rtp-connect/field.rb', line 178 def add_extended_field(child) @extended_field = child.to_extended_field child.parent = self end |
#children ⇒ Array<ExtendedField, ControlPoint>
Collects the child records of this instance in a properly sorted array.
187 188 189 |
# File 'lib/rtp-connect/field.rb', line 187 def children return [@extended_field, @control_points].flatten.compact end |
#dcm_collimator_x1 ⇒ Float
Converts the collimator_x1 attribute to proper DICOM format.
195 196 197 |
# File 'lib/rtp-connect/field.rb', line 195 def dcm_collimator_x1 dcm_collimator1(:x) end |
#dcm_collimator_x2 ⇒ Float
Converts the collimator_x2 attribute to proper DICOM format.
203 204 205 |
# File 'lib/rtp-connect/field.rb', line 203 def dcm_collimator_x2 value = @collimator_x2.to_f * 10 end |
#dcm_collimator_y1 ⇒ Float
Converts the collimator_y1 attribute to proper DICOM format.
211 212 213 |
# File 'lib/rtp-connect/field.rb', line 211 def dcm_collimator_y1 dcm_collimator1(:y) end |
#dcm_collimator_y2 ⇒ Float
Converts the collimator_y2 attribute to proper DICOM format.
219 220 221 |
# File 'lib/rtp-connect/field.rb', line 219 def dcm_collimator_y2 value = @collimator_y2.to_f * 10 end |
#delete(record) ⇒ Object
Removes the reference of the given instance from this instance.
227 228 229 230 231 232 233 234 235 236 |
# File 'lib/rtp-connect/field.rb', line 227 def delete(record) case record when ControlPoint delete_child(:control_points, record) when ExtendedField delete_extended_field else logger.warn("Unknown class (record) given to Field#delete: #{record.class}") end end |
#delete_control_points ⇒ Object
Removes all control point references from this instance.
240 241 242 |
# File 'lib/rtp-connect/field.rb', line 240 def delete_control_points delete_children(:control_points) end |
#delete_extended_field ⇒ Object
Removes the extended field reference from this instance.
246 247 248 |
# File 'lib/rtp-connect/field.rb', line 246 def delete_extended_field delete_child(:extended_field) end |
#hash ⇒ Fixnum
Two objects with the same attributes will have the same hash code.
Computes a hash code for this object.
256 257 258 |
# File 'lib/rtp-connect/field.rb', line 256 def hash state.hash end |
#to_field ⇒ Field
Returns self.
264 265 266 |
# File 'lib/rtp-connect/field.rb', line 264 def to_field self end |