def _smooth(image, sigma, mode, cval):
 smoothed = np.empty(image.shape, dtype=np.double)
 if (image.ndim == 3):
  for dim in range(image.shape[2]):
   ndi.gaussian_filter(image[..., dim], sigma, output=smoothed[..., dim], mode=mode, cval=cval)
 else:
  ndi.gaussian_filter(image, sigma, output=smoothed, mode=mode, cval=cval)
 return smoothed

def _smooth ( image , sigma , mode , cval ) : smoothed = np . empty ( image . shape , dtype = np . double ) if ( image . ndim == 3 ) : for dim in range ( image . shape [ 2 ] ) : ndi . gaussian_filter ( image [ ... , dim ] , sigma , output = smoothed [ ... , dim ] , mode = mode , cval = cval ) else : ndi . gaussian_filter ( image , sigma , output = smoothed , mode = mode , cval = cval ) return smoothed
return image with each channel smoothed by the gaussian filter .