def parse_extended_header
      extended = []
      extension = @stream.decode(4, "BY")

      # "After the end of the 348 byte header (e.g., after the magic field),
      # the next 4 bytes are an byte array field named extension. By default,
      # all 4 bytes of this array should be set to zero. In a .nii file, these 4
      # bytes will always be present, since the earliest start point for the
      # image data is byte #352. In a separate .hdr file, these bytes may or may
      # not be present (i.e., a .hdr file may only be 348 bytes long). If not
      # present, then a NIfTI-1.1 compliant program should use the default value
      # of extension={0,0,0,0}. The first byte (extension[0]) is the only value
      # of this array that is specified at present. The other 3 bytes are
      # reserved for future use."
      if extension[0] != 0
        while @stream.index < @hdr['vox_offset']
          esize, ecode = *@stream.decode(8, "UL")
          data = @stream.decode(esize - 8, "STR")
          extended << {:esize => esize, :ecode => ecode, :data => data}
        end
        # stream.decode(header['vox_offset'] - stream.index, "STR")
        # stream.skip header['vox_offset'] - stream.index
      end
      return extended
    end
def parse_extended_header
      extended = []
      extension = @stream.decode(4, "BY")

      # "After the end of the 348 byte header (e.g., after the magic field),
      # the next 4 bytes are an byte array field named extension. By default,
      # all 4 bytes of this array should be set to zero. In a .nii file, these 4
      # bytes will always be present, since the earliest start point for the
      # image data is byte #352. In a separate .hdr file, these bytes may or may
      # not be present (i.e., a .hdr file may only be 348 bytes long). If not
      # present, then a NIfTI-1.1 compliant program should use the default value
      # of extension={0,0,0,0}. The first byte (extension[0]) is the only value
      # of this array that is specified at present. The other 3 bytes are
      # reserved for future use."
      if extension[0] != 0
        while @stream.index < @hdr['vox_offset']
          esize, ecode = *@stream.decode(8, "UL")
          data = @stream.decode(esize - 8, "STR")
          extended << {:esize => esize, :ecode => ecode, :data => data}
        end
        # stream.decode(header['vox_offset'] - stream.index, "STR")
        # stream.skip header['vox_offset'] - stream.index
      end
      return extended
    end
Read any extended header information.
 The file stream will be left at imaging data itself, taking vox_offset into account for NIFTI Header Extended Attributes.
 Pass in the voxel offset so the extended header knows when to stop reading.