code: def write_nifti(
      data,
      filename,
      affine=None,
      original_affine=None,
      output_dtype=np.float32,
  ):
      writer = NibabelWriter(output_dtype=output_dtype)
      writer.set_data_array(data, channel_dim=None, spatial_ndim=None)
      writer.set_metadata(
          {"affine": affine, "original_affine": original_affine}
      )
      writer.write(filename)
  
imports: import logging
  import tempfile
  from typing import Any, Dict, Iterable, List, Optional, Tuple
  import itk
  import nrrd
  import numpy
  import torch
  from monai.data import MetaTensor
  from monai.data.image_writer import NibabelWriter
  from monailabel.utils.others.detection import create_slicer_detection_json
  from monailabel.utils.others.generic import file_ext
  from monailabel.utils.others.pathology import create_asap_annotations_xml, create_dsa_annotations_json
label_desc: Use image node_id 1 for calling a global function with example usage: write_nifti(data, filename, affine, original_affine, output_dtype) without return types