code: def read_mrtrix_header(in_file):
      fileobj = open(in_file, "rb")
      header = {}
      iflogger.info("Reading header data...")
      for line in fileobj:
          line = line.decode()
          if line == "END\n":
              iflogger.info("Reached the end of the header!")
              break
          elif ": " in line:
              line = line.replace("\n", "")
              line = line.replace("'", "")
              key = line.split(": ")[0]
              value = line.split(": ")[1]
              header[key] = value
              iflogger.info(
                  '...adding "%s" to header for key "%s"', value, key
              )
      fileobj.close()
      header["count"] = int(header["count"].replace("\n", ""))
      header["offset"] = int(header["file"].replace(".", ""))
      return header
  
imports: import os.path
  import nibabel
  import numpy
  from nibabel.volumeutils import native_code
  from nibabel.orientations import aff2axcodes
  from ...None import logging
  from ...utils.filemanip import split_filename
  from ..base import TraitedSpec, File, isdefined
  from ..dipy.base import DipyBaseInterface, HAVE_DIPY
label_desc: Use image node_id 5 for calling a global function with example usage: read_mrtrix_header(in_file) and returns: header