Method: RTKIT::Study#initialize

Defined in:
lib/rtkit/study.rb

#initialize(study_uid, patient, options = {}) ⇒ Study

Creates a new Study instance. The Study Instance UID string is used to uniquely identify a Study.

Parameters

  • study_uid – The Study Instance UID string.

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

  • options – A hash of parameters.

Options

  • :date – String. The Study Date (DICOM tag ‘0008,0020’).

  • :time – String. The Study Time (DICOM tag ‘0008,0030’).

  • :description – String. The Study Description (DICOM tag ‘0008,1030’).

  • :id – String. The Study ID (DICOM tag ‘0020,0010’).

Raises:

  • (ArgumentError)


65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/rtkit/study.rb', line 65

def initialize(study_uid, patient, options={})
  raise ArgumentError, "Invalid argument 'study_uid'. Expected String, got #{study_uid.class}." unless study_uid.is_a?(String)
  raise ArgumentError, "Invalid argument 'patient'. Expected Patient, got #{patient.class}." unless patient.is_a?(Patient)
  raise ArgumentError, "Invalid option ':date'. Expected String, got #{options[:date].class}." if options[:date] && !options[:date].is_a?(String)
  raise ArgumentError, "Invalid option ':time'. Expected String, got #{options[:time].class}." if options[:time] && !options[:time].is_a?(String)
  raise ArgumentError, "Invalid option ':description'. Expected String, got #{options[:description].class}." if options[:description] && !options[:description].is_a?(String)
  raise ArgumentError, "Invalid option ':id'. Expected String, got #{options[:id].class}." if options[:id] && !options[:id].is_a?(String)
  # Key attributes:
  @study_uid = study_uid
  @patient = patient
  # Default attributes:
  @image_series = Array.new
  @series = Array.new
  # A hash with the associated Series' UID as key and the instance of the Series that belongs to this Study as value:
  @associated_series = Hash.new
  @associated_iseries = Hash.new
  # Optional attributes:
  @date = options[:date]
  @time = options[:time]
  @description = options[:description]
  @id = options[:id]
  # Register ourselves with the patient:
  @patient.add_study(self)
end