code: def fourier_ellipsoid(input, size, n=-1, axis=-1, output=None):
      """Multidimensional ellipsoid Fourier filter.
  
      The array is multiplied with the fourier transform of a ellipsoid of
      given sizes.
  
      Args:
          input (cupy.ndarray): The input array.
          size (float or sequence of float):  The size of the box used for
              filtering. If a float, `size` is the same for all axes. If a
              sequence, `size` has to contain one value for each axis.
          n (int, optional):  If `n` is negative (default), then the input is
              assumed to be the result of a complex fft. If `n` is larger than or
              equal to zero, the input is assumed to be the result of a real fft,
              and `n` gives the length of the array before transformation along
              the real transform direction.
          axis (int, optional): The axis of the real transform (only used when
              ``n > -1``).
          output (cupy.ndarray, optional):
              If given, the result of shifting the input is placed in this array.
  
      Returns:
          output (cupy.ndarray): The filtered output.
      """
      ndim = input.ndim
      if ndim == 1:
          return fourier_uniform(input, size, n, axis, output)
  
      if ndim > 3:
          # Note: SciPy currently does not do any filtering on >=4d inputs, but
          #       does not warn about this!
          raise NotImplementedError(
              "Only 1d, 2d and 3d inputs are supported"
          )
      output = _get_output_fourier(output, input)
      axis = internal._normalize_axis_index(axis, ndim)
      sizes = _util._fix_sequence_arg(size, ndim, "size")
  
      _core.elementwise_copy(input, output)
  
      # compute the distance from the origin for all samples in Fourier space
      distance = 0
      for ax, (size, ax_size) in enumerate(zip(sizes, output.shape)):
          # compute the frequency grid in Hz
          if ax == axis and n > 0:
              arr = cupy.arange(ax_size, dtype=output.real.dtype)
              arr *= numpy.pi * size / n
          else:
              arr = cupy.fft.fftfreq(ax_size)
              arr *= numpy.pi * size
          arr = arr.astype(output.real.dtype, copy=False)
          arr *= arr
          arr = _reshape_nd(arr, ndim=ndim, axis=ax)
          distance = distance + arr
      cupy.sqrt(distance, out=distance)
  
      if ndim == 2:
          special.j1(distance, out=output)
          output *= 2
          output /= distance
      elif ndim == 3:
          cupy.sin(distance, out=output)
          output -= distance * cupy.cos(distance)
          output *= 3
          output /= distance**3
      output[
          (0,) * ndim
      ] = 1.0  # avoid NaN in corner at frequency=0 location
      output *= input
  
      return output
  
file_path: cupy/cupyx/scipy/ndimage/_fourier.py
imports: import numpy
  import cupy
  from cupy import _core
  from cupy._core import internal
  from cupyx.scipy.ndimage import _util
  from cupyx.scipy import special
label_desc: Use image node_id 6 for calling a global function with example usage: fourier_ellipsoid(input, size, n, axis, output) and returns: output, fourier_uniform