docstr: Test for Diameter Opening (2 thresholds, all types)
docstr_tok: ["Test","for","Diameter","Opening","(","2","thresholds",",","all","types",")"]
code: def test_diameter_closing(self):
      "Test for Diameter Opening (2 thresholds, all types)"
      img = np.array(
          [
              [97, 95, 93, 92, 91, 90, 90, 90, 91, 92, 93, 95],
              [95, 93, 91, 89, 88, 88, 88, 88, 88, 89, 91, 93],
              [93, 63, 63, 63, 63, 86, 86, 86, 87, 43, 43, 91],
              [92, 89, 88, 86, 85, 85, 84, 85, 85, 43, 43, 89],
              [91, 88, 87, 85, 84, 84, 83, 84, 84, 85, 87, 88],
              [90, 88, 86, 85, 84, 83, 83, 83, 84, 85, 86, 88],
              [90, 88, 86, 84, 83, 83, 82, 83, 83, 84, 86, 88],
              [90, 88, 86, 85, 84, 83, 83, 83, 84, 85, 86, 88],
              [91, 88, 87, 85, 84, 84, 83, 84, 84, 85, 87, 88],
              [92, 89, 23, 23, 85, 85, 84, 85, 85, 3, 3, 89],
              [93, 91, 23, 23, 87, 86, 86, 86, 87, 88, 3, 91],
              [95, 93, 91, 89, 88, 88, 88, 88, 88, 89, 91, 93],
          ],
          dtype=np.uint8,
      )
  
      ex2 = np.array(
          [
              [97, 95, 93, 92, 91, 90, 90, 90, 91, 92, 93, 95],
              [95, 93, 91, 89, 88, 88, 88, 88, 88, 89, 91, 93],
              [93, 63, 63, 63, 63, 86, 86, 86, 87, 43, 43, 91],
              [92, 89, 88, 86, 85, 85, 84, 85, 85, 43, 43, 89],
              [91, 88, 87, 85, 84, 84, 83, 84, 84, 85, 87, 88],
              [90, 88, 86, 85, 84, 83, 83, 83, 84, 85, 86, 88],
              [90, 88, 86, 84, 83, 83, 83, 83, 83, 84, 86, 88],
              [90, 88, 86, 85, 84, 83, 83, 83, 84, 85, 86, 88],
              [91, 88, 87, 85, 84, 84, 83, 84, 84, 85, 87, 88],
              [92, 89, 23, 23, 85, 85, 84, 85, 85, 3, 3, 89],
              [93, 91, 23, 23, 87, 86, 86, 86, 87, 88, 3, 91],
              [95, 93, 91, 89, 88, 88, 88, 88, 88, 89, 91, 93],
          ],
          dtype=np.uint8,
      )
  
      ex4 = np.array(
          [
              [97, 95, 93, 92, 91, 90, 90, 90, 91, 92, 93, 95],
              [95, 93, 91, 89, 88, 88, 88, 88, 88, 89, 91, 93],
              [93, 63, 63, 63, 63, 86, 86, 86, 87, 84, 84, 91],
              [92, 89, 88, 86, 85, 85, 84, 85, 85, 84, 84, 89],
              [91, 88, 87, 85, 84, 84, 83, 84, 84, 85, 87, 88],
              [90, 88, 86, 85, 84, 83, 83, 83, 84, 85, 86, 88],
              [90, 88, 86, 84, 83, 83, 83, 83, 83, 84, 86, 88],
              [90, 88, 86, 85, 84, 83, 83, 83, 84, 85, 86, 88],
              [91, 88, 87, 85, 84, 84, 83, 84, 84, 85, 87, 88],
              [92, 89, 84, 84, 85, 85, 84, 85, 85, 84, 84, 89],
              [93, 91, 84, 84, 87, 86, 86, 86, 87, 88, 84, 91],
              [95, 93, 91, 89, 88, 88, 88, 88, 88, 89, 91, 93],
          ],
          dtype=np.uint8,
      )
  
      # _full_type_test makes a test with many image types.
      _full_type_test(img, 2, ex2, diameter_closing, connectivity=2)
      _full_type_test(img, 4, ex4, diameter_closing, connectivity=2)
  
      P, S = max_tree(invert(img), connectivity=2)
      _full_type_test(
          img, 4, ex4, diameter_opening, parent=P, tree_traverser=S
      )
  
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 4 for calling the TestMaxtree obj's underlying member method code with example usage: obj.test_diameter_closing() without return types