def load_image_series_reference(dcm)
      frame_uid = nil
      img_series_uid = nil
      dcm[REF_FRAME_OF_REF_SQ].each_item do |frame_item|
        if frame_item.exists?(RT_REF_STUDY_SQ)
          frame_item[RT_REF_STUDY_SQ].each_item do |study_item|
            if study_item.exists?(RT_REF_SERIES_SQ)
              study_item[RT_REF_SERIES_SQ].each_item do |series_item|
                img_series_uid = series_item.value(SERIES_UID)
                break if img_series_uid
              end
            end
            break if img_series_uid
          end
        end
        break if img_series_uid
      end
      return frame_uid, img_series_uid
    end
def load_image_series_reference(dcm)
      frame_uid = nil
      img_series_uid = nil
      dcm[REF_FRAME_OF_REF_SQ].each_item do |frame_item|
        if frame_item.exists?(RT_REF_STUDY_SQ)
          frame_item[RT_REF_STUDY_SQ].each_item do |study_item|
            if study_item.exists?(RT_REF_SERIES_SQ)
              study_item[RT_REF_SERIES_SQ].each_item do |series_item|
                img_series_uid = series_item.value(SERIES_UID)
                break if img_series_uid
              end
            end
            break if img_series_uid
          end
        end
        break if img_series_uid
      end
      return frame_uid, img_series_uid
    end
=begin
    # Registers this Structure Set instance with the ImageSeries that it references.
    #
    def connect_to_image_series
      # Find out which Image Series is referenced:
      @dcm[REF_FRAME_OF_REF_SQ].each do |frame_item|
        ref_frame_of_ref = frame_item.value(FRAME_OF_REF)
        # Continue if the Referenced Frame of Ref matches one of the Frames registered to our DataSet.
        matched_frame = @study.patient.dataset.frame(ref_frame_of_ref)
        if matched_frame
          frame_item[RT_REF_STUDY_SQ].each do |study_item|
            # Skip testing against the Study UID.
            #ref_study_uid = study_item.value(REF_SOP_UID)
            study_item[RT_REF_SERIES_SQ].each do |series_item|
              ref_series_uid = series_item.value(SERIES_UID)
              matched_series = matched_frame.series(ref_series_uid)
              if matched_series
                # The referenced series exists in our dataset. Proceed with setting up the references:
                matched_series.add_struct(self)
                @image_series << matched_series
              end
            end
          end
        end
      end
    end
=end
 Loads the (first occuring set of) UID references for frame of reference
 as well as the image series from the Referenced Frame of Reference
 Sequence.

 @param [DICOM::DObject] dcm a structure set DICOM object
 @return [Array<String, NilClass>] the frame uid and image series uid string pair (if found, otherwise nil)