def add(element, options={})
      unless element.is_a?(Item)
        unless self.is_a?(Sequence)
          # Does the element's binary value need to be reencoded?
          reencode = true if element.is_a?(Element) && element.endian != stream.str_endian
          # If we are replacing an existing Element, we need to make sure that this Element's parent value is erased before proceeding.
          self[element.tag].parent = nil if exists?(element.tag)
          # Add the element, and set its parent attribute:
          @tags[element.tag] = element
          element.parent = self unless options[:no_follow]
          # As the element has been moved in place, perform re-encode if indicated:
          element.value = element.value if reencode
        else
          raise "A Sequence is only allowed to have Item elements added to it. Use add_item() instead if the intention is to add an Item."
        end
      else
        raise ArgumentError, "An Item is not allowed as a parameter to the add() method. Use add_item() instead."
      end
    end
def add(element, options={})
      unless element.is_a?(Item)
        unless self.is_a?(Sequence)
          # Does the element's binary value need to be reencoded?
          reencode = true if element.is_a?(Element) && element.endian != stream.str_endian
          # If we are replacing an existing Element, we need to make sure that this Element's parent value is erased before proceeding.
          self[element.tag].parent = nil if exists?(element.tag)
          # Add the element, and set its parent attribute:
          @tags[element.tag] = element
          element.parent = self unless options[:no_follow]
          # As the element has been moved in place, perform re-encode if indicated:
          element.value = element.value if reencode
        else
          raise "A Sequence is only allowed to have Item elements added to it. Use add_item() instead if the intention is to add an Item."
        end
      else
        raise ArgumentError, "An Item is not allowed as a parameter to the add() method. Use add_item() instead."
      end
    end
Adds an Element or Sequence instance to self (where self can be either a DObject or an Item).

 @note Items can not be added with this method (use add_item instead).

 @param [Element, Sequence] element a child element/sequence
 @param [Hash] options the options used for adding the element/sequence
 option options [Boolean] :no_follow when true, the method does not update the parent attribute of the child that is added
 @example Set a new patient's name to the DICOM object
   dcm.add(Element.new("0010,0010", "John_Doe"))
 @example Add a previously defined element roi_name to the first item of a sequence
   dcm["3006,0020"][0].add(roi_name)