Method: RTKIT::Study#add
- Defined in:
- lib/rtkit/study.rb
#add(dcm) ⇒ Object
Adds a DICOM object to the study, by adding it to an existing Series, or creating a new Series.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/rtkit/study.rb', line 93 def add(dcm) raise ArgumentError, "Invalid argument 'dcm'. Expected DObject, got #{dcm.class}." unless dcm.is_a?(DICOM::DObject) existing_series = @associated_series[dcm.value(SERIES_UID)] if existing_series existing_series.add(dcm) else # New series (series subclass depends on modality): case dcm.value(MODALITY) when *IMAGE_SERIES # Create the ImageSeries: s = ImageSeries.load(dcm, self) @image_series << s when 'RTSTRUCT' s = StructureSet.load(dcm, self) when 'RTPLAN' s = Plan.load(dcm, self) when 'RTDOSE' s = RTDose.load(dcm, self) when 'RTIMAGE' s = RTImage.load(dcm, self) else raise ArgumentError, "Unexpected (unsupported) modality (#{dcm.value(MODALITY)})in Study#add()" end # Add the newly created series to this study: add_series(s) end end |