code: def _test_segmentation(S, nchannels=1):
      assert S.nchannels == nchannels
      nef = S.normalized_external_field()
      assert_array_almost_equal(nef.sum(-1), np.ones(nef.shape[0]))
      S.run(niters=5)
      label = S.map()
      assert label.ndim == 3
      assert label.dtype == "uint8"
      assert isinstance(S.free_energy(), float)
  
imports: from numbers import Number
  import numpy
  from numpy.testing import assert_almost_equal, assert_array_almost_equal
  from ....io.files import load
  from ....testing import anatfile
  from ..brain_segmentation import BrainT1Segmentation
  from ..segmentation import Segmentation
label_desc: Use image node_id 10 for calling a global function with example usage: _test_segmentation(S, nchannels) without return types