code: def test_overlap(tmpdir):
      from nipype.algorithms.metrics import Overlap
  
      def check_close(val1, val2):
          import numpy.testing as npt
  
          return npt.assert_almost_equal(val1, val2, decimal=3)
  
      in1 = example_data("segmentation0.nii.gz")
      in2 = example_data("segmentation1.nii.gz")
  
      tmpdir.chdir()
      overlap = Overlap()
      overlap.inputs.volume1 = in1
      overlap.inputs.volume2 = in1
      res = overlap.run()
      check_close(res.outputs.jaccard, 1.0)
  
      overlap = Overlap()
      overlap.inputs.volume1 = in1
      overlap.inputs.volume2 = in2
      res = overlap.run()
      check_close(res.outputs.jaccard, 0.99705)
  
      overlap = Overlap()
      overlap.inputs.volume1 = in1
      overlap.inputs.volume2 = in2
      overlap.inputs.vol_units = "mm"
      res = overlap.run()
      check_close(res.outputs.jaccard, 0.99705)
      check_close(
          res.outputs.roi_voldiff,
          np.array([0.0063086, -0.0025506, 0.0]),
      )
  
imports: import os
  from nipype.testing import example_data
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: test_overlap(tmpdir) and returns: npt