docstr: tests the detection of maxima in 3D.
docstr_tok: ["tests","the","detection","of","maxima","in","3D","."]
code: def test_3d(self):
      """tests the detection of maxima in 3D."""
      img = np.zeros((8, 8, 8), dtype=np.uint8)
      local_maxima = np.zeros((8, 8, 8), dtype=np.uint64)
  
      # first maximum: only one pixel
      img[1, 1:3, 1:3] = 100
      img[2, 2, 2] = 200
      img[3, 1:3, 1:3] = 100
      local_maxima[2, 2, 2] = 1
  
      # second maximum: three pixels in z-direction
      img[5:8, 1, 1] = 200
      local_maxima[5:8, 1, 1] = 1
  
      # third: two maxima in 0 and 3.
      img[0, 5:8, 5:8] = 200
      img[1, 6, 6] = 100
      img[2, 5:7, 5:7] = 200
      img[0:3, 5:8, 5:8] += 50
      local_maxima[0, 5:8, 5:8] = 1
      local_maxima[2, 5:7, 5:7] = 1
  
      # four : one maximum in the corner of the square
      img[6:8, 6:8, 6:8] = 200
      img[7, 7, 7] = 255
      local_maxima[7, 7, 7] = 1
  
      out = max_tree_local_maxima(img)
      out_bin = out > 0
      assert_array_equal(local_maxima, out_bin)
      assert np.max(out) == 5
  
file_path: scikit-image/skimage/morphology/tests/test_max_tree.py
imports: import numpy
  from skimage.morphology import max_tree, area_closing, area_opening
  from skimage.morphology import max_tree_local_maxima, diameter_opening
  from skimage.morphology import diameter_closing
  from skimage.util import invert
  from skimage._shared.testing import assert_array_equal, TestCase
label_desc: Use image node_id 8 for calling the TestMaxtree obj's underlying member method code with example usage: obj.test_3d() without return types