Method: RTKIT::DoseDistribution#d

Defined in:
lib/rtkit/dose_distribution.rb

#d(percent) ⇒ Object

Calculates the dose that at least the specified percentage of the volume receives. Returns a dose (Float) in units of Gy.

Parameters

  • percent – Integer/Float. The percent of the volume which receives a dose higher than the returned dose.

Examples

# Calculate the near minimum dose (e.g. up to 2 % of the volume receives a dose less than this):
near_min = ptv_distribution.d(98)
# Calculate the near maximum dose (e.g. at most 2 % of the volume receives a dose higher than this):
near_max = ptv_distribution.d(2)

Raises:

  • (RangeError)


83
84
85
86
87
# File 'lib/rtkit/dose_distribution.rb', line 83

def d(percent)
  raise RangeError, "Argument 'percent' must be in the range [0-100]." if percent.to_f < 0 or percent.to_f > 100
  d_index = ((@doses.length - 1) * (1 - percent.to_f * 0.01)).round
  return @doses[d_index]
end