Method: RTKIT::DoseVolume#image

Defined in:
lib/rtkit/dose_volume.rb

#image(*args) ⇒ Object

Returns the Image instance mathcing the specified SOP Instance UID (if an argument is used). If a specified UID doesn’t match, nil is returned. If no argument is passed, the first Image instance associated with the Volume is returned.

Parameters

  • uid_or_pos – String/Float. The value of the SOP Instance UID element or the image position.

Raises:

  • (ArgumentError)


210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/rtkit/dose_volume.rb', line 210

def image(*args)
  raise ArgumentError, "Expected one or none arguments, got #{args.length}." unless [0, 1].include?(args.length)
  if args.length == 1
    if args.first.is_a?(Float)
      # Presumably an image position:
      return @image_positions[args.first]
    else
      # Presumably a uid string:
      return @associated_images[args.first && args.first.to_s]
    end
  else
    # No argument used, therefore we return the first Image instance:
    return @images.first
  end
end