Method: RTKIT::Study.load

Defined in:
lib/rtkit/study.rb

.load(dcm, patient) ⇒ Object

Creates a new Study instance by loading study information from the specified DICOM object. The Study’s UID string value is used to uniquely identify a study.

Parameters

  • dcm – An instance of a DICOM object (DICOM::DObject).

  • patient – The Patient instance that this Study belongs to.

Raises:

  • (ArgumentError)


37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rtkit/study.rb', line 37

def self.load(dcm, patient)
  raise ArgumentError, "Invalid argument 'dcm'. Expected DObject, got #{dcm.class}." unless dcm.is_a?(DICOM::DObject)
  raise ArgumentError, "Invalid argument 'patient'. Expected Patient, got #{patient.class}." unless patient.is_a?(Patient)
  uid = dcm.value(STUDY_UID)
  date = dcm.value(STUDY_DATE)
  time = dcm.value(STUDY_TIME)
  description = dcm.value(STUDY_DESCR)
  id = dcm.value(STUDY_ID)
  study = self.new(uid, patient, :date => date, :time => time, :description => description, :id => id)
  study.add(dcm)
  return study
end