code: def map_from_ppm(ppm, mask=None):
      x = np.zeros(ppm.shape[0:-1], dtype="uint8")
      if mask is None:
          mask = ppm == 0
      x[mask] = ppm[mask].argmax(-1) + 1
      return x
  
file_path: nipy/nipy/algorithms/segmentation/segmentation.py
imports: import numpy
  from ._segmentation import _interaction_energy, _ve_step
label_desc: Use image node_id 3 for calling a global function with example usage: map_from_ppm(ppm, mask) and returns: x