Method: RTKIT::Plan.load
- Defined in:
- lib/rtkit/plan.rb
.load(dcm, study) ⇒ Object
Creates a new Plan instance by loading the relevant information from the specified DICOM object. The SOP Instance UID string value is used to uniquely identify a Plan instance.
Parameters
-
dcm– An instance of a DICOM object (DICOM::DObject) with modality ‘RTPLAN’. -
study– The Study instance that this RTPlan belongs to.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rtkit/plan.rb', line 36 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 'RTPLAN', got #{dcm.value(MODALITY)}." unless dcm.value(MODALITY) == 'RTPLAN' # 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 StructureSet: struct = self.structure_set(dcm, study) # Create the Plan instance: plan = self.new(sop_uid, struct, :class_uid => class_uid, :date => date, :time => time, :description => description, :series_uid => series_uid) plan.add(dcm) return plan end |