Method: RTKIT::StructureSet#initialize

Defined in:
lib/rtkit/structure_set.rb

#initialize(sop_uid, image_series, options = {}) ⇒ StructureSet

Creates a new StructureSet instance.

Parameters

  • sop_uid – The SOP Instance UID string.

  • image_series – An Image Series that this StructureSet belongs to.

  • options – A hash of parameters.

Options

  • :date – String. The Series Date (DICOM tag ‘0008,0021’).

  • :time – String. The Series Time (DICOM tag ‘0008,0031’).

  • :description – String. The Series Description (DICOM tag ‘0008,103E’).

  • :series_uid – String. The Series Instance UID (DICOM tag ‘0020,000E’).

Raises:

  • (ArgumentError)


94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/rtkit/structure_set.rb', line 94

def initialize(sop_uid, image_series, options={})
  raise ArgumentError, "Invalid argument 'sop_uid'. Expected String, got #{sop_uid.class}." unless sop_uid.is_a?(String)
  raise ArgumentError, "Invalid argument 'image_series'. Expected ImageSeries, got #{image_series.class}." unless image_series.is_a?(ImageSeries)
  # Pass attributes to Series initialization:
  options[:class_uid] = '1.2.840.10008.5.1.4.1.1.481.3' # RT Structure Set Storage
  # Get a randomized Series UID unless it has been defined in the options hash:
  series_uid = options[:series_uid] || RTKIT.series_uid
  super(series_uid, 'RTSTRUCT', image_series.study, options)
  @sop_uid = sop_uid
  # Default attributes:
  @image_series = Array.new
  @rois = Array.new
  @plans = Array.new
  @associated_plans = Hash.new
  # Register ourselves with the ImageSeries:
  image_series.add_struct(self)
  @image_series << image_series
end