code: def binary_to_image(
      reference_image, label, dtype=np.uint8, file_ext=".nii.gz"
  ):
      start = time.time()
  
      image_np, meta_dict = LoadImage(image_only=False)(reference_image)
      label_np = np.fromfile(label, dtype=dtype)
  
      logger.info(f"Image: {image_np.shape}")
      logger.info(f"Label: {label_np.shape}")
  
      label_np = label_np.reshape(image_np.shape, order="F")
      logger.info(f"Label (reshape): {label_np.shape}")
  
      output_file = tempfile.NamedTemporaryFile(suffix=file_ext).name
      affine = meta_dict.get("affine")
      write_itk(
          label_np,
          output_file,
          affine=affine,
          dtype=None,
          compress=True,
      )
  
      logger.info(
          f"binary_to_image latency : {time.time() - start} (sec)"
      )
      return output_file
  
imports: import json
  import logging
  import os
  import pathlib
  import tempfile
  import time
  import numpy
  import pydicom
  import pydicom_seg
  import SimpleITK
  from monai.transforms import LoadImage
  from pydicom.filereader import dcmread
  from monailabel.datastore.utils.colors import GENERIC_ANATOMY_COLORS
  from monailabel.transform.writer import write_itk
  from monailabel.utils.others.generic import run_command
label_desc: Use image node_id 2 for calling a global function with example usage: binary_to_image(reference_image, label, dtype, file_ext) and returns: output_file