def value=(new_value)
      if VALUE_CONVERSION[@vr] == :to_s
        # Unless this is actually the Character Set data element,
        # get the character set (note that it may not be available):
        character_set = (@tag != '0008,0005' && top_parent.is_a?(DObject)) ? top_parent.value('0008,0005') : nil
        # Convert to [DObject encoding] from [input string encoding]:
        # In most cases the DObject encoding is IS0-8859-1 (ISO_IR 100), but if
        # it is not specified in the DICOM object, or if the specified string
        # is not recognized, ASCII-8BIT is assumed.
        @value = new_value.to_s.encode(ENCODING_NAME[character_set], new_value.to_s.encoding.name)
        @bin = encode(@value)
      else
        # We may have an array (of numbers) which needs to be passed directly to
        # the encode method instead of being forced into a numerical:
        if new_value.is_a?(Array)
          @value = new_value
          @bin = encode(@value)
        else
          @value = new_value.send(VALUE_CONVERSION[@vr])
          @bin = encode(@value)
        end
      end
      @length = @bin.length
    end
def value=(new_value)
      if VALUE_CONVERSION[@vr] == :to_s
        # Unless this is actually the Character Set data element,
        # get the character set (note that it may not be available):
        character_set = (@tag != '0008,0005' && top_parent.is_a?(DObject)) ? top_parent.value('0008,0005') : nil
        # Convert to [DObject encoding] from [input string encoding]:
        # In most cases the DObject encoding is IS0-8859-1 (ISO_IR 100), but if
        # it is not specified in the DICOM object, or if the specified string
        # is not recognized, ASCII-8BIT is assumed.
        @value = new_value.to_s.encode(ENCODING_NAME[character_set], new_value.to_s.encoding.name)
        @bin = encode(@value)
      else
        # We may have an array (of numbers) which needs to be passed directly to
        # the encode method instead of being forced into a numerical:
        if new_value.is_a?(Array)
          @value = new_value
          @bin = encode(@value)
        else
          @value = new_value.send(VALUE_CONVERSION[@vr])
          @bin = encode(@value)
        end
      end
      @length = @bin.length
    end
Sets the value of the Element instance.

 In addition to updating the value attribute, the specified value is encoded to binary
 and used to update the Element's bin and length attributes too.

 @note The specified value must be of a type that is compatible with the Element's value representation (vr).
 @param [String, Integer, Float, Array] new_value a formatted value that is assigned to the element