def insert_missing_meta
      {
        '0002,0001' => [0,1], # File Meta Information Version
        '0002,0002' => value('0008,0016'), # Media Storage SOP Class UID
        '0002,0003' => value('0008,0018'), # Media Storage SOP Instance UID
        '0002,0010' => transfer_syntax, # Transfer Syntax UID
        '0002,0016' => DICOM.source_app_title, # Source Application Entity Title
      }.each_pair do |tag, value|
        add_element(tag, value) unless exists?(tag)
      end
      if !exists?("0002,0012") && !exists?("0002,0013")
        # Implementation Class UID:
        add_element("0002,0012", UID_ROOT)
        # Implementation Version Name:
        add_element("0002,0013", NAME)
      end
      # Delete the old group length first (if it exists) to avoid a miscount
      # in the coming group length determination.
      delete("0002,0000")
      add_element("0002,0000", meta_group_length)
    end
def insert_missing_meta
      {
        '0002,0001' => [0,1], # File Meta Information Version
        '0002,0002' => value('0008,0016'), # Media Storage SOP Class UID
        '0002,0003' => value('0008,0018'), # Media Storage SOP Instance UID
        '0002,0010' => transfer_syntax, # Transfer Syntax UID
        '0002,0016' => DICOM.source_app_title, # Source Application Entity Title
      }.each_pair do |tag, value|
        add_element(tag, value) unless exists?(tag)
      end
      if !exists?("0002,0012") && !exists?("0002,0013")
        # Implementation Class UID:
        add_element("0002,0012", UID_ROOT)
        # Implementation Version Name:
        add_element("0002,0013", NAME)
      end
      # Delete the old group length first (if it exists) to avoid a miscount
      # in the coming group length determination.
      delete("0002,0000")
      add_element("0002,0000", meta_group_length)
    end
Adds any missing meta group (0002,xxxx) data elements to the DICOM object,
 to ensure that a valid DICOM object is encoded.