def switch_syntax_on_read
      # Get the transfer syntax string, unless it has already been provided by keyword:
      @transfer_syntax = (self["0002,0010"] ? self["0002,0010"].value : IMPLICIT_LITTLE_ENDIAN) unless @transfer_syntax
      # Query the library with our particular transfer syntax string:
      ts = LIBRARY.uid(@transfer_syntax)
      logger.warn("Invalid/unknown transfer syntax: #{@transfer_syntax} Will try parsing the string, but errors may occur.") unless ts && ts.transfer_syntax?
      @rest_explicit = ts ? ts.explicit? : true
      @rest_endian = ts ? ts.big_endian? : false
      # Make sure we only run this method once:
      @switched = true
      # Update endian, explicitness and unpack variables:
      @switched_endian = true if @rest_endian != @str_endian
      @str_endian = @rest_endian
      @stream.endian = @rest_endian
      @explicit = @rest_explicit
    end
def switch_syntax_on_read
      # Get the transfer syntax string, unless it has already been provided by keyword:
      @transfer_syntax = (self["0002,0010"] ? self["0002,0010"].value : IMPLICIT_LITTLE_ENDIAN) unless @transfer_syntax
      # Query the library with our particular transfer syntax string:
      ts = LIBRARY.uid(@transfer_syntax)
      logger.warn("Invalid/unknown transfer syntax: #{@transfer_syntax} Will try parsing the string, but errors may occur.") unless ts && ts.transfer_syntax?
      @rest_explicit = ts ? ts.explicit? : true
      @rest_endian = ts ? ts.big_endian? : false
      # Make sure we only run this method once:
      @switched = true
      # Update endian, explicitness and unpack variables:
      @switched_endian = true if @rest_endian != @str_endian
      @str_endian = @rest_endian
      @stream.endian = @rest_endian
      @explicit = @rest_explicit
    end
Changes encoding variables as the parsing proceeds past the initial meta
 group part (0002,xxxx) of the DICOM string.