code: def test_median_otsu_flow():
      with TemporaryDirectory() as out_dir:
          data_path, _, _ = get_fnames("small_25")
          volume = load_nifti_data(data_path)
          save_masked = True
          median_radius = 3
          numpass = 3
          autocrop = False
          vol_idx = [0]
          dilate = 0
  
          mo_flow = MedianOtsuFlow()
          mo_flow.run(
              data_path,
              out_dir=out_dir,
              save_masked=save_masked,
              median_radius=median_radius,
              numpass=numpass,
              autocrop=autocrop,
              vol_idx=vol_idx,
              dilate=dilate,
          )
  
          mask_name = mo_flow.last_generated_outputs["out_mask"]
          masked_name = mo_flow.last_generated_outputs["out_masked"]
  
          masked, mask = median_otsu(
              volume,
              vol_idx=vol_idx,
              median_radius=median_radius,
              numpass=numpass,
              autocrop=autocrop,
              dilate=dilate,
          )
  
          result_mask_data = load_nifti_data(pjoin(out_dir, mask_name))
          npt.assert_array_equal(
              result_mask_data.astype(np.uint8), mask
          )
  
          result_masked = nib.load(pjoin(out_dir, masked_name))
          result_masked_data = np.asanyarray(result_masked.dataobj)
  
          npt.assert_array_equal(np.round(result_masked_data), masked)
  
file_path: dipy/dipy/workflows/tests/test_segment.py
imports: from os.path import join
  from tempfile import TemporaryDirectory
  import numpy.testing
  import numpy
  import nibabel
  from dipy.align.streamlinear import BundleMinDistanceMetric
  from dipy.data import get_fnames
  from dipy.segment.mask import median_otsu
  from dipy.tracking.streamline import Streamlines
  from dipy.io.stateful_tractogram import Space, StatefulTractogram
  from dipy.io.streamline import load_tractogram, save_tractogram
  from dipy.io.image import load_nifti_data, save_nifti
  from dipy.tracking.streamline import set_number_of_points
  from dipy.workflows.segment import MedianOtsuFlow
  from dipy.workflows.segment import RecoBundlesFlow, LabelsBundlesFlow
label_desc: Use image node_id 1 for calling a global function with example usage: test_median_otsu_flow() without return types