code: def test_mask():
      vol = np.zeros((30, 30, 30))
      vol[15, 15, 15] = 1
      struct = generate_binary_structure(3, 1)
      voln = binary_dilation(
          vol, structure=struct, iterations=4
      ).astype("f4")
      initial = np.sum(voln > 0)
      mask = voln.copy()
      thresh = otsu(mask)
      mask = mask > thresh
      initial_otsu = np.sum(mask > 0)
      assert_equal(initial_otsu, initial)
  
      mins, maxs = bounding_box(mask)
      voln_crop = crop(mask, mins, maxs)
      initial_crop = np.sum(voln_crop > 0)
      assert_equal(initial_crop, initial)
  
      applymask(voln, mask)
      final = np.sum(voln > 0)
      assert_equal(final, initial)
  
      # Test multi_median.
      img = np.arange(25).reshape(5, 5)
      img_copy = img.copy()
      medianradius = 2
      median_test = multi_median(img, medianradius, 3)
      assert_equal(img, img_copy)
  
      medarr = np.ones_like(img.shape) * ((medianradius * 2) + 1)
      median_control = median_filter(img, medarr)
      median_control = median_filter(median_control, medarr)
      median_control = median_filter(median_control, medarr)
      assert_equal(median_test, median_control)
  
file_path: dipy/dipy/segment/tests/test_mask.py
imports: import warnings
  import numpy
  from scipy.ndimage import generate_binary_structure, binary_dilation
  from scipy.ndimage import median_filter
  from dipy.segment.mask import otsu, bounding_box, crop, applymask, multi_median, median_otsu
  from numpy.testing import assert_equal, assert_almost_equal, assert_raises
  from dipy.data import get_fnames
  from dipy.io.image import load_nifti_data
label_desc: Use image node_id 1 for calling a global function with example usage: test_mask() without return types