code: def __voxel_4conectedness(shape):
      """
      Returns the number of edges for the supplied image shape assuming 4-connectedness.
  
      The name of the function has historical reasons. Essentially it returns the number
      of edges assuming 4-connectedness only for 2D. For 3D it assumes 6-connectedness,
      etc.
  
      @param shape the shape of the image
      @type shape sequence
      @return the number of edges
      @rtype int
      """
      shape = list(shape)
      while 1 in shape:
          shape.remove(
              1
          )  # empty resp. 1-sized dimensions have to be removed (equal to scipy.squeeze on the array)
      return int(
          round(
              sum([(dim - 1) / float(dim) for dim in shape])
              * scipy.prod(shape)
          )
      )
  
file_path: medpy/medpy/graphcut/generate.py
imports: import inspect
  import scipy
  from ..core import Logger
  from .graph import GCGraph
  from medpy.graphcut.energy_label import __check_label_image
label_desc: Use image node_id 7 for calling a global function with example usage: __voxel_4conectedness(shape) and returns: int