Method: RTKIT::StructureSet.load
- Defined in:
- lib/rtkit/structure_set.rb
.load(dcm, study) ⇒ Object
Creates a new StructureSet instance by loading the relevant information from the specified DICOM object. The SOP Instance UID string value is used to uniquely identify a StructureSet instance.
Parameters
-
dcm– An instance of a DICOM object (DICOM::DObject) with modality ‘RTSTRUCT’. -
study– The Study instance that this StructureSet belongs to.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rtkit/structure_set.rb', line 30 def self.load(dcm, study) raise ArgumentError, "Invalid argument 'dcm'. Expected DObject, got #{dcm.class}." unless dcm.is_a?(DICOM::DObject) raise ArgumentError, "Invalid argument 'study'. Expected Study, got #{study.class}." unless study.is_a?(Study) raise ArgumentError, "Invalid argument 'dcm'. Expected DObject with modality 'RTSTUCT', got #{dcm.value(MODALITY)}." unless dcm.value(MODALITY) == 'RTSTRUCT' # Required attributes: sop_uid = dcm.value(SOP_UID) # Optional attributes: class_uid = dcm.value(SOP_CLASS) date = dcm.value(SERIES_DATE) time = dcm.value(SERIES_TIME) description = dcm.value(SERIES_DESCR) series_uid = dcm.value(SERIES_UID) # Get the corresponding image series: image_series = self.image_series(dcm, study) # Create the StructureSet instance: ss = self.new(sop_uid, image_series, :class_uid => class_uid, :date => date, :time => time, :description => description, :series_uid => series_uid) ss.add(dcm) return ss end |