Method: RTKIT::StructureSet#create_roi

Defined in:
lib/rtkit/structure_set.rb

#create_roi(frame, options = {}) ⇒ Object

Creates a ROI belonging to this StructureSet. Returns the created ROI.

Notes

  • The ROI is created without Slices, and these must be added after the ROI creation.

Parameters

  • frame – The Frame instance which the ROI will belong to.

  • options – A hash of parameters.

Options

  • :algorithm – String. The ROI Generation Algorithm. Defaults to ‘Automatic’.

  • :name – String. The ROI Name. Defaults to ‘RTKIT-VOLUME’.

  • :number – Integer. The ROI Number. Defaults to the first available ROI Number in the StructureSet.

  • :interpreter – String. The ROI Interpreter. Defaults to ‘RTKIT’.

  • :type – String. The ROI Interpreted Type. Defaults to ‘CONTROL’.

Raises:

  • (ArgumentError)


168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/rtkit/structure_set.rb', line 168

def create_roi(frame, options={})
  raise ArgumentError, "Expected Frame, got #{frame.class}." unless frame.is_a?(Frame)
  # Set values:

  algorithm = options[:algorithm] || 'Automatic'
  name = options[:name] || 'RTKIT-VOLUME'
  interpreter = options[:interpreter] || 'RTKIT'
  type = options[:type] || 'CONTROL'
  if options[:number]
    raise ArgumentError, "Expected Integer, got #{options[:number].class} for the option :number." unless options[:number].is_a?(Integer)
    raise ArgumentError, "The specified ROI Number (#{options[:roi_number]}) is already used by one of the existing ROIs (#{roi_numbers})." if roi_numbers.include?(options[:number])
    number = options[:number]
  else
    number = (roi_numbers.max ? roi_numbers.max + 1 : 1)
  end
  # Create ROI:

  roi = ROI.new(name, number, frame, self, :algorithm => algorithm, :name => name, :number => number, :interpreter => interpreter, :type => type)
  return roi
end