Method: RTKIT::DoseVolume.load
- Defined in:
- lib/rtkit/dose_volume.rb
.load(dcm, series) ⇒ Object
Creates a new Volume instance by loading image information from the specified DICOM object. The volume object’s SOP Instance UID string value is used to uniquely identify a volume.
Parameters
-
dcm– An instance of a DICOM object (DObject). -
series– The Series instance that this Volume belongs to.
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rtkit/dose_volume.rb', line 34 def self.load(dcm, series) raise ArgumentError, "Invalid argument 'dcm'. Expected DObject, got #{dcm.class}." unless dcm.is_a?(DICOM::DObject) raise ArgumentError, "Invalid argument 'series'. Expected Series, got #{series.class}." unless series.is_a?(Series) raise ArgumentError, "Invalid argument 'dcm'. Expected an image related modality, got #{dcm.value(MODALITY)}." unless IMAGE_MODALITIES.include?(dcm.value(MODALITY)) sop_uid = dcm.value(SOP_UID) # Check if a Frame with the given UID already exists, and if not, create one: frame = series.study.patient.dataset.frame(dcm.value(FRAME_OF_REF)) || frame = series.study.patient.create_frame(dcm.value(FRAME_OF_REF), dcm.value(POS_REF_INDICATOR)) # Create the RTDose instance: volume = self.new(sop_uid, frame, series) volume.add(dcm) return volume end |