code: def count_nonzero_voxels(img):
      """
      Count number of non-zero voxels
  
      Parameters
      ----------
      img : ``SpatialImage``
          All voxels of the mask should be of value 1, background should have value 0.
  
      Returns
      -------
      count : int
          Number of non-zero voxels
  
      """
      return np.count_nonzero(img.dataobj)
  
imports: import numpy
  from nibabel.imageclasses import spatial_axes_first
label_desc: Use image node_id 1 for calling a global function with example usage: count_nonzero_voxels(img) and returns: np