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)
        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)
        when 'CR'
          s = CRSeries.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
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)
        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)
        when 'CR'
          s = CRSeries.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
Creates a new Study instance. The Study Instance UID string is used to
 uniquely identify a study.

 @param [String] study_uid the Study Instance UID string
 @param [Patient] patient the Patient instance which this Study is associated with
 @param [Hash] options the options to use for creating the study
 @option options [String] :date the study date (DICOM tag '0008,0020')
 @option options [String] :description the study description (DICOM tag '0008,1030')
 @option options [String] :id the study ID (DICOM tag '0020,0010')
 @option options [String] :time the study time (DICOM tag '0008,0030')

 Registers a DICOM object to the study, and processes it to either create
 (and reference) a new series instance linked to this study, or
 registering it with an existing series.

 @param [DICOM::DObject] dcm a DICOM object