Class: RTP::DoseTracking
- Defined in:
- lib/rtp-connect/dose_tracking.rb
Overview
Relations:
-
Parent: Plan
-
Children: none
The DoseTracking class.
Instance Attribute Summary collapse
-
#actual_dose ⇒ Object
Returns the value of attribute actual_dose.
-
#actual_fractions ⇒ Object
Returns the value of attribute actual_fractions.
-
#dose_actions ⇒ Object
readonly
The DoseAction records (if any) that belongs to this DoseTracking.
-
#field_ids ⇒ Object
Note: This attribute contains an array of all field_id values (1..10).
-
#parent ⇒ Object
readonly
The Record which this instance belongs to.
-
#region_coeffs ⇒ Object
Note: This attribute contains an array of all reg_coeff values (1..10).
-
#region_name ⇒ Object
Returns the value of attribute region_name.
-
#region_prior_dose ⇒ Object
Returns the value of attribute region_prior_dose.
Attributes inherited from Record
Class Method Summary collapse
-
.load(string, parent) ⇒ DoseTracking
Creates a new DoseTracking by parsing a RTPConnect string line.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
Checks for equality.
-
#children ⇒ Array
As of now, gives an empty array.
-
#hash ⇒ Fixnum
Computes a hash code for this object.
-
#initialize(parent) ⇒ DoseTracking
constructor
Creates a new DoseTracking.
-
#to_dose_tracking ⇒ DoseTracking
Returns self.
-
#to_s ⇒ String
(also: #to_str)
Encodes the DoseTracking object + any hiearchy of child objects, to a properly formatted RTPConnect ascii string.
-
#values ⇒ Array<String>
(also: #state)
Collects the values (attributes) of this instance.
Methods inherited from Record
#encode, #get_parent, #load, #to_record
Constructor Details
#initialize(parent) ⇒ DoseTracking
Creates a new DoseTracking.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/rtp-connect/dose_tracking.rb', line 40 def initialize(parent) super('DOSE_DEF', 24, 26) # Child records: @dose_actions = Array.new # Parent relation (may get more than one type of record here): @parent = get_parent(parent.to_record, Plan) @parent.add_dose_tracking(self) @field_ids = Array.new(10) @region_coeffs = Array.new(10) @attributes = [ # Required: :keyword, :region_name, :region_prior_dose, :field_ids, :region_coeffs, # Optional: :actual_dose, :actual_fractions ] end |
Instance Attribute Details
#actual_dose ⇒ Object
Returns the value of attribute actual_dose.
21 22 23 |
# File 'lib/rtp-connect/dose_tracking.rb', line 21 def actual_dose @actual_dose end |
#actual_fractions ⇒ Object
Returns the value of attribute actual_fractions.
22 23 24 |
# File 'lib/rtp-connect/dose_tracking.rb', line 22 def actual_fractions @actual_fractions end |
#dose_actions ⇒ Object (readonly)
The DoseAction records (if any) that belongs to this DoseTracking.
14 15 16 |
# File 'lib/rtp-connect/dose_tracking.rb', line 14 def dose_actions @dose_actions end |
#field_ids ⇒ Object
Note: This attribute contains an array of all field_id values (1..10).
18 19 20 |
# File 'lib/rtp-connect/dose_tracking.rb', line 18 def field_ids @field_ids end |
#parent ⇒ Object (readonly)
The Record which this instance belongs to.
12 13 14 |
# File 'lib/rtp-connect/dose_tracking.rb', line 12 def parent @parent end |
#region_coeffs ⇒ Object
Note: This attribute contains an array of all reg_coeff values (1..10).
20 21 22 |
# File 'lib/rtp-connect/dose_tracking.rb', line 20 def region_coeffs @region_coeffs end |
#region_name ⇒ Object
Returns the value of attribute region_name.
15 16 17 |
# File 'lib/rtp-connect/dose_tracking.rb', line 15 def region_name @region_name end |
#region_prior_dose ⇒ Object
Returns the value of attribute region_prior_dose.
16 17 18 |
# File 'lib/rtp-connect/dose_tracking.rb', line 16 def region_prior_dose @region_prior_dose end |
Class Method Details
.load(string, parent) ⇒ DoseTracking
Creates a new DoseTracking by parsing a RTPConnect string line.
31 32 33 34 |
# File 'lib/rtp-connect/dose_tracking.rb', line 31 def self.load(string, parent) d = self.new(parent) d.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.
70 71 72 73 74 |
# File 'lib/rtp-connect/dose_tracking.rb', line 70 def ==(other) if other.respond_to?(:to_dose_tracking) other.send(:state) == state end end |
#children ⇒ Array
As of now, gives an empty array. However, by definition, this record may have dose action (point) records as children, but this is not implemented yet.
83 84 85 86 |
# File 'lib/rtp-connect/dose_tracking.rb', line 83 def children #return @dose_actions return Array.new end |
#hash ⇒ Fixnum
Two objects with the same attributes will have the same hash code.
Computes a hash code for this object.
94 95 96 |
# File 'lib/rtp-connect/dose_tracking.rb', line 94 def hash state.hash end |
#to_dose_tracking ⇒ DoseTracking
Returns self.
119 120 121 |
# File 'lib/rtp-connect/dose_tracking.rb', line 119 def to_dose_tracking self end |
#to_s ⇒ String Also known as: to_str
Encodes the DoseTracking object + any hiearchy of child objects, to a properly formatted RTPConnect ascii string.
128 129 130 131 132 133 134 135 136 |
# File 'lib/rtp-connect/dose_tracking.rb', line 128 def to_s str = encode if children children.each do |child| str += child.to_s end end return str end |
#values ⇒ Array<String> Also known as: state
The CRC is not considered part of the actual values and is excluded.
Collects the values (attributes) of this instance.
103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/rtp-connect/dose_tracking.rb', line 103 def values [ @keyword, @region_name, @region_prior_dose, # Need to join every other two elements from these two arrays together: *@field_ids.zip(@region_coeffs).flatten, @actual_dose, @actual_fractions ] end |