code: def _image_filter(self, filter=None, size=2):
          
          from numpy import isscalar
          from scipy.ndimage.filters import median_filter, uniform_filter
  
          FILTERS = {
              'median': median_filter,
              'uniform': uniform_filter
          }
  
          func = FILTERS[filter]
  
          mode = self.mode
          value_shape = self.value_shape
          ndims = len(value_shape)
  
          if ndims == 3 and isscalar(size) == 1:
              size = [size, size, size]
  
          if ndims == 3 and size[2] == 0:
              def filter_(im):
                  if mode == 'spark':
                      im.setflags(write=True)
                  else:
                      im = im.copy()
                  for z in arange(0, value_shape[2]):
                      im[:, :, z] = func(im[:, :, z], size[0:2])
                  return im
          else:
              filter_ = lambda x: func(x, size)
  
          return self.map(lambda v: filter_(v), value_shape=self.value_shape)
docs: Generic function for maping a filtering operation over images.
  
          Parameters
          ----------
          filter : string
              Which filter to use.
  
          size : int or tuple
              Size parameter for filter.