We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
`skimage.filters.gaussian` doesn't use `output` parameter at all
## Description
`skimage.filters.gaussian` doesn't use the value of `output` parameter. It returns only the image of float64 dtype, even if explicitly specify the output dtype. 

## Way to reproduce
Simply run the code snippet:
```python
from skimage.filters import gaussian
import numpy as np

image = np.arange(25, dtype=np.uint8).reshape((5,5))

# output is not specified
filtered_0 = gaussian(image, sigma=0.25)
print(filtered_0.dtype)
# return: float64

# output is specified
filtered_output = gaussian(image, output = np.uint8, sigma=0.25)
print(filtered_output.dtype)
# return: float64
```
This function is a wrapper around `scipy.ndi.gaussian_filter`. But the scikit-image `gaussian` doesn't pass the `output` to `scipy.ndi.gaussian_filter`.


`skimage.filters.gaussian` doesn't use `output` parameter at all
## Description
`skimage.filters.gaussian` doesn't use the value of `output` parameter. It returns only the image of float64 dtype, even if explicitly specify the output dtype. 

## Way to reproduce
Simply run the code snippet:
```python
from skimage.filters import gaussian
import numpy as np

image = np.arange(25, dtype=np.uint8).reshape((5,5))

# output is not specified
filtered_0 = gaussian(image, sigma=0.25)
print(filtered_0.dtype)
# return: float64

# output is specified
filtered_output = gaussian(image, output = np.uint8, sigma=0.25)
print(filtered_output.dtype)
# return: float64
```
This function is a wrapper around `scipy.ndi.gaussian_filter`. But the scikit-image `gaussian` doesn't pass the `output` to `scipy.ndi.gaussian_filter`.



--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `skimage/filters/_gaussian.py`
Content:
```
1 from collections.abc import Iterable
2 import numpy as np
3 from scipy import ndimage as ndi
4 
5 from ..util import img_as_float
6 from .._shared.utils import warn, convert_to_float
7 
8 
9 __all__ = ['gaussian']
10 
11 
12 def gaussian(image, sigma=1, output=None, mode='nearest', cval=0,
13              multichannel=None, preserve_range=False, truncate=4.0):
14     """Multi-dimensional Gaussian filter.
15 
16     Parameters
17     ----------
18     image : array-like
19         Input image (grayscale or color) to filter.
20     sigma : scalar or sequence of scalars, optional
21         Standard deviation for Gaussian kernel. The standard
22         deviations of the Gaussian filter are given for each axis as a
23         sequence, or as a single number, in which case it is equal for
24         all axes.
25     output : array, optional
26         The ``output`` parameter passes an array in which to store the
27         filter output.
28     mode : {'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optional
29         The ``mode`` parameter determines how the array borders are
30         handled, where ``cval`` is the value when mode is equal to
31         'constant'. Default is 'nearest'.
32     cval : scalar, optional
33         Value to fill past edges of input if ``mode`` is 'constant'. Default
34         is 0.0
35     multichannel : bool, optional (default: None)
36         Whether the last axis of the image is to be interpreted as multiple
37         channels. If True, each channel is filtered separately (channels are
38         not mixed together). Only 3 channels are supported. If ``None``,
39         the function will attempt to guess this, and raise a warning if
40         ambiguous, when the array has shape (M, N, 3).
41     preserve_range : bool, optional
42         Whether to keep the original range of values. Otherwise, the input
43         image is converted according to the conventions of ``img_as_float``.
44         Also see
45         https://scikit-image.org/docs/dev/user_guide/data_types.html
46     truncate : float, optional
47         Truncate the filter at this many standard deviations.
48 
49     Returns
50     -------
51     filtered_image : ndarray
52         the filtered array
53 
54     Notes
55     -----
56     This function is a wrapper around :func:`scipy.ndi.gaussian_filter`.
57 
58     Integer arrays are converted to float.
59 
60     The multi-dimensional filter is implemented as a sequence of
61     one-dimensional convolution filters. The intermediate arrays are
62     stored in the same data type as the output. Therefore, for output
63     types with a limited precision, the results may be imprecise
64     because intermediate results may be stored with insufficient
65     precision.
66 
67     Examples
68     --------
69 
70     >>> a = np.zeros((3, 3))
71     >>> a[1, 1] = 1
72     >>> a
73     array([[0., 0., 0.],
74            [0., 1., 0.],
75            [0., 0., 0.]])
76     >>> gaussian(a, sigma=0.4)  # mild smoothing
77     array([[0.00163116, 0.03712502, 0.00163116],
78            [0.03712502, 0.84496158, 0.03712502],
79            [0.00163116, 0.03712502, 0.00163116]])
80     >>> gaussian(a, sigma=1)  # more smoothing
81     array([[0.05855018, 0.09653293, 0.05855018],
82            [0.09653293, 0.15915589, 0.09653293],
83            [0.05855018, 0.09653293, 0.05855018]])
84     >>> # Several modes are possible for handling boundaries
85     >>> gaussian(a, sigma=1, mode='reflect')
86     array([[0.08767308, 0.12075024, 0.08767308],
87            [0.12075024, 0.16630671, 0.12075024],
88            [0.08767308, 0.12075024, 0.08767308]])
89     >>> # For RGB images, each is filtered separately
90     >>> from skimage.data import astronaut
91     >>> image = astronaut()
92     >>> filtered_img = gaussian(image, sigma=1, multichannel=True)
93 
94     """
95 
96     spatial_dims = None
97     try:
98         spatial_dims = _guess_spatial_dimensions(image)
99     except ValueError:
100         spatial_dims = image.ndim
101     if spatial_dims is None and multichannel is None:
102         msg = ("Images with dimensions (M, N, 3) are interpreted as 2D+RGB "
103                "by default. Use `multichannel=False` to interpret as "
104                "3D image with last dimension of length 3.")
105         warn(RuntimeWarning(msg))
106         multichannel = True
107     if np.any(np.asarray(sigma) < 0.0):
108         raise ValueError("Sigma values less than zero are not valid")
109     if multichannel:
110         # do not filter across channels
111         if not isinstance(sigma, Iterable):
112             sigma = [sigma] * (image.ndim - 1)
113         if len(sigma) != image.ndim:
114             sigma = np.concatenate((np.asarray(sigma), [0]))
115     image = convert_to_float(image, preserve_range)
116     return ndi.gaussian_filter(image, sigma, mode=mode, cval=cval,
117                                truncate=truncate)
118 
119 
120 def _guess_spatial_dimensions(image):
121     """Make an educated guess about whether an image has a channels dimension.
122 
123     Parameters
124     ----------
125     image : ndarray
126         The input image.
127 
128     Returns
129     -------
130     spatial_dims : int or None
131         The number of spatial dimensions of ``image``. If ambiguous, the value
132         is ``None``.
133 
134     Raises
135     ------
136     ValueError
137         If the image array has less than two or more than four dimensions.
138     """
139     if image.ndim == 2:
140         return 2
141     if image.ndim == 3 and image.shape[-1] != 3:
142         return 3
143     if image.ndim == 3 and image.shape[-1] == 3:
144         return None
145     if image.ndim == 4 and image.shape[-1] == 3:
146         return 3
147     else:
148         raise ValueError("Expected 2D, 3D, or 4D array, got %iD." % image.ndim)
149
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/skimage/filters/_gaussian.py b/skimage/filters/_gaussian.py
--- a/skimage/filters/_gaussian.py
+++ b/skimage/filters/_gaussian.py
@@ -57,6 +57,10 @@
 
     Integer arrays are converted to float.
 
+    The ``output`` should be floating point data type since gaussian converts
+    to float provided ``image``. If ``output`` is not provided, another array
+    will be allocated and returned as the result.
+
     The multi-dimensional filter is implemented as a sequence of
     one-dimensional convolution filters. The intermediate arrays are
     stored in the same data type as the output. Therefore, for output
@@ -113,8 +117,13 @@
         if len(sigma) != image.ndim:
             sigma = np.concatenate((np.asarray(sigma), [0]))
     image = convert_to_float(image, preserve_range)
-    return ndi.gaussian_filter(image, sigma, mode=mode, cval=cval,
-                               truncate=truncate)
+    if output is None:
+        output = np.empty_like(image)
+    elif not np.issubdtype(output.dtype, np.floating):
+        raise ValueError("Provided output data type is not float")
+    ndi.gaussian_filter(image, sigma, output=output, mode=mode, cval=cval,
+                        truncate=truncate)
+    return output
 
 
 def _guess_spatial_dimensions(image):

{"golden_diff": "diff --git a/skimage/filters/_gaussian.py b/skimage/filters/_gaussian.py\n--- a/skimage/filters/_gaussian.py\n+++ b/skimage/filters/_gaussian.py\n@@ -57,6 +57,10 @@\n \n     Integer arrays are converted to float.\n \n+    The ``output`` should be floating point data type since gaussian converts\n+    to float provided ``image``. If ``output`` is not provided, another array\n+    will be allocated and returned as the result.\n+\n     The multi-dimensional filter is implemented as a sequence of\n     one-dimensional convolution filters. The intermediate arrays are\n     stored in the same data type as the output. Therefore, for output\n@@ -113,8 +117,13 @@\n         if len(sigma) != image.ndim:\n             sigma = np.concatenate((np.asarray(sigma), [0]))\n     image = convert_to_float(image, preserve_range)\n-    return ndi.gaussian_filter(image, sigma, mode=mode, cval=cval,\n-                               truncate=truncate)\n+    if output is None:\n+        output = np.empty_like(image)\n+    elif not np.issubdtype(output.dtype, np.floating):\n+        raise ValueError(\"Provided output data type is not float\")\n+    ndi.gaussian_filter(image, sigma, output=output, mode=mode, cval=cval,\n+                        truncate=truncate)\n+    return output\n \n \n def _guess_spatial_dimensions(image):\n", "issue": "`skimage.filters.gaussian` doesn't use `output` parameter at all\n## Description\r\n`skimage.filters.gaussian` doesn't use the value of `output` parameter. It returns only the image of float64 dtype, even if explicitly specify the output dtype. \r\n\r\n## Way to reproduce\r\nSimply run the code snippet:\r\n```python\r\nfrom skimage.filters import gaussian\r\nimport numpy as np\r\n\r\nimage = np.arange(25, dtype=np.uint8).reshape((5,5))\r\n\r\n# output is not specified\r\nfiltered_0 = gaussian(image, sigma=0.25)\r\nprint(filtered_0.dtype)\r\n# return: float64\r\n\r\n# output is specified\r\nfiltered_output = gaussian(image, output = np.uint8, sigma=0.25)\r\nprint(filtered_output.dtype)\r\n# return: float64\r\n```\r\nThis function is a wrapper around `scipy.ndi.gaussian_filter`. But the scikit-image `gaussian` doesn't pass the `output` to `scipy.ndi.gaussian_filter`.\r\n\r\n\n`skimage.filters.gaussian` doesn't use `output` parameter at all\n## Description\r\n`skimage.filters.gaussian` doesn't use the value of `output` parameter. It returns only the image of float64 dtype, even if explicitly specify the output dtype. \r\n\r\n## Way to reproduce\r\nSimply run the code snippet:\r\n```python\r\nfrom skimage.filters import gaussian\r\nimport numpy as np\r\n\r\nimage = np.arange(25, dtype=np.uint8).reshape((5,5))\r\n\r\n# output is not specified\r\nfiltered_0 = gaussian(image, sigma=0.25)\r\nprint(filtered_0.dtype)\r\n# return: float64\r\n\r\n# output is specified\r\nfiltered_output = gaussian(image, output = np.uint8, sigma=0.25)\r\nprint(filtered_output.dtype)\r\n# return: float64\r\n```\r\nThis function is a wrapper around `scipy.ndi.gaussian_filter`. But the scikit-image `gaussian` doesn't pass the `output` to `scipy.ndi.gaussian_filter`.\r\n\r\n\n", "before_files": [{"content": "from collections.abc import Iterable\nimport numpy as np\nfrom scipy import ndimage as ndi\n\nfrom ..util import img_as_float\nfrom .._shared.utils import warn, convert_to_float\n\n\n__all__ = ['gaussian']\n\n\ndef gaussian(image, sigma=1, output=None, mode='nearest', cval=0,\n             multichannel=None, preserve_range=False, truncate=4.0):\n    \"\"\"Multi-dimensional Gaussian filter.\n\n    Parameters\n    ----------\n    image : array-like\n        Input image (grayscale or color) to filter.\n    sigma : scalar or sequence of scalars, optional\n        Standard deviation for Gaussian kernel. The standard\n        deviations of the Gaussian filter are given for each axis as a\n        sequence, or as a single number, in which case it is equal for\n        all axes.\n    output : array, optional\n        The ``output`` parameter passes an array in which to store the\n        filter output.\n    mode : {'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optional\n        The ``mode`` parameter determines how the array borders are\n        handled, where ``cval`` is the value when mode is equal to\n        'constant'. Default is 'nearest'.\n    cval : scalar, optional\n        Value to fill past edges of input if ``mode`` is 'constant'. Default\n        is 0.0\n    multichannel : bool, optional (default: None)\n        Whether the last axis of the image is to be interpreted as multiple\n        channels. If True, each channel is filtered separately (channels are\n        not mixed together). Only 3 channels are supported. If ``None``,\n        the function will attempt to guess this, and raise a warning if\n        ambiguous, when the array has shape (M, N, 3).\n    preserve_range : bool, optional\n        Whether to keep the original range of values. Otherwise, the input\n        image is converted according to the conventions of ``img_as_float``.\n        Also see\n        https://scikit-image.org/docs/dev/user_guide/data_types.html\n    truncate : float, optional\n        Truncate the filter at this many standard deviations.\n\n    Returns\n    -------\n    filtered_image : ndarray\n        the filtered array\n\n    Notes\n    -----\n    This function is a wrapper around :func:`scipy.ndi.gaussian_filter`.\n\n    Integer arrays are converted to float.\n\n    The multi-dimensional filter is implemented as a sequence of\n    one-dimensional convolution filters. The intermediate arrays are\n    stored in the same data type as the output. Therefore, for output\n    types with a limited precision, the results may be imprecise\n    because intermediate results may be stored with insufficient\n    precision.\n\n    Examples\n    --------\n\n    >>> a = np.zeros((3, 3))\n    >>> a[1, 1] = 1\n    >>> a\n    array([[0., 0., 0.],\n           [0., 1., 0.],\n           [0., 0., 0.]])\n    >>> gaussian(a, sigma=0.4)  # mild smoothing\n    array([[0.00163116, 0.03712502, 0.00163116],\n           [0.03712502, 0.84496158, 0.03712502],\n           [0.00163116, 0.03712502, 0.00163116]])\n    >>> gaussian(a, sigma=1)  # more smoothing\n    array([[0.05855018, 0.09653293, 0.05855018],\n           [0.09653293, 0.15915589, 0.09653293],\n           [0.05855018, 0.09653293, 0.05855018]])\n    >>> # Several modes are possible for handling boundaries\n    >>> gaussian(a, sigma=1, mode='reflect')\n    array([[0.08767308, 0.12075024, 0.08767308],\n           [0.12075024, 0.16630671, 0.12075024],\n           [0.08767308, 0.12075024, 0.08767308]])\n    >>> # For RGB images, each is filtered separately\n    >>> from skimage.data import astronaut\n    >>> image = astronaut()\n    >>> filtered_img = gaussian(image, sigma=1, multichannel=True)\n\n    \"\"\"\n\n    spatial_dims = None\n    try:\n        spatial_dims = _guess_spatial_dimensions(image)\n    except ValueError:\n        spatial_dims = image.ndim\n    if spatial_dims is None and multichannel is None:\n        msg = (\"Images with dimensions (M, N, 3) are interpreted as 2D+RGB \"\n               \"by default. Use `multichannel=False` to interpret as \"\n               \"3D image with last dimension of length 3.\")\n        warn(RuntimeWarning(msg))\n        multichannel = True\n    if np.any(np.asarray(sigma) < 0.0):\n        raise ValueError(\"Sigma values less than zero are not valid\")\n    if multichannel:\n        # do not filter across channels\n        if not isinstance(sigma, Iterable):\n            sigma = [sigma] * (image.ndim - 1)\n        if len(sigma) != image.ndim:\n            sigma = np.concatenate((np.asarray(sigma), [0]))\n    image = convert_to_float(image, preserve_range)\n    return ndi.gaussian_filter(image, sigma, mode=mode, cval=cval,\n                               truncate=truncate)\n\n\ndef _guess_spatial_dimensions(image):\n    \"\"\"Make an educated guess about whether an image has a channels dimension.\n\n    Parameters\n    ----------\n    image : ndarray\n        The input image.\n\n    Returns\n    -------\n    spatial_dims : int or None\n        The number of spatial dimensions of ``image``. If ambiguous, the value\n        is ``None``.\n\n    Raises\n    ------\n    ValueError\n        If the image array has less than two or more than four dimensions.\n    \"\"\"\n    if image.ndim == 2:\n        return 2\n    if image.ndim == 3 and image.shape[-1] != 3:\n        return 3\n    if image.ndim == 3 and image.shape[-1] == 3:\n        return None\n    if image.ndim == 4 and image.shape[-1] == 3:\n        return 3\n    else:\n        raise ValueError(\"Expected 2D, 3D, or 4D array, got %iD.\" % image.ndim)\n", "path": "skimage/filters/_gaussian.py"}], "after_files": [{"content": "from collections.abc import Iterable\nimport numpy as np\nfrom scipy import ndimage as ndi\n\nfrom ..util import img_as_float\nfrom .._shared.utils import warn, convert_to_float\n\n\n__all__ = ['gaussian']\n\n\ndef gaussian(image, sigma=1, output=None, mode='nearest', cval=0,\n             multichannel=None, preserve_range=False, truncate=4.0):\n    \"\"\"Multi-dimensional Gaussian filter.\n\n    Parameters\n    ----------\n    image : array-like\n        Input image (grayscale or color) to filter.\n    sigma : scalar or sequence of scalars, optional\n        Standard deviation for Gaussian kernel. The standard\n        deviations of the Gaussian filter are given for each axis as a\n        sequence, or as a single number, in which case it is equal for\n        all axes.\n    output : array, optional\n        The ``output`` parameter passes an array in which to store the\n        filter output.\n    mode : {'reflect', 'constant', 'nearest', 'mirror', 'wrap'}, optional\n        The ``mode`` parameter determines how the array borders are\n        handled, where ``cval`` is the value when mode is equal to\n        'constant'. Default is 'nearest'.\n    cval : scalar, optional\n        Value to fill past edges of input if ``mode`` is 'constant'. Default\n        is 0.0\n    multichannel : bool, optional (default: None)\n        Whether the last axis of the image is to be interpreted as multiple\n        channels. If True, each channel is filtered separately (channels are\n        not mixed together). Only 3 channels are supported. If ``None``,\n        the function will attempt to guess this, and raise a warning if\n        ambiguous, when the array has shape (M, N, 3).\n    preserve_range : bool, optional\n        Whether to keep the original range of values. Otherwise, the input\n        image is converted according to the conventions of ``img_as_float``.\n        Also see\n        https://scikit-image.org/docs/dev/user_guide/data_types.html\n    truncate : float, optional\n        Truncate the filter at this many standard deviations.\n\n    Returns\n    -------\n    filtered_image : ndarray\n        the filtered array\n\n    Notes\n    -----\n    This function is a wrapper around :func:`scipy.ndi.gaussian_filter`.\n\n    Integer arrays are converted to float.\n\n    The ``output`` should be floating point data type since gaussian converts\n    to float provided ``image``. If ``output`` is not provided, another array\n    will be allocated and returned as the result.\n\n    The multi-dimensional filter is implemented as a sequence of\n    one-dimensional convolution filters. The intermediate arrays are\n    stored in the same data type as the output. Therefore, for output\n    types with a limited precision, the results may be imprecise\n    because intermediate results may be stored with insufficient\n    precision.\n\n    Examples\n    --------\n\n    >>> a = np.zeros((3, 3))\n    >>> a[1, 1] = 1\n    >>> a\n    array([[0., 0., 0.],\n           [0., 1., 0.],\n           [0., 0., 0.]])\n    >>> gaussian(a, sigma=0.4)  # mild smoothing\n    array([[0.00163116, 0.03712502, 0.00163116],\n           [0.03712502, 0.84496158, 0.03712502],\n           [0.00163116, 0.03712502, 0.00163116]])\n    >>> gaussian(a, sigma=1)  # more smoothing\n    array([[0.05855018, 0.09653293, 0.05855018],\n           [0.09653293, 0.15915589, 0.09653293],\n           [0.05855018, 0.09653293, 0.05855018]])\n    >>> # Several modes are possible for handling boundaries\n    >>> gaussian(a, sigma=1, mode='reflect')\n    array([[0.08767308, 0.12075024, 0.08767308],\n           [0.12075024, 0.16630671, 0.12075024],\n           [0.08767308, 0.12075024, 0.08767308]])\n    >>> # For RGB images, each is filtered separately\n    >>> from skimage.data import astronaut\n    >>> image = astronaut()\n    >>> filtered_img = gaussian(image, sigma=1, multichannel=True)\n\n    \"\"\"\n\n    spatial_dims = None\n    try:\n        spatial_dims = _guess_spatial_dimensions(image)\n    except ValueError:\n        spatial_dims = image.ndim\n    if spatial_dims is None and multichannel is None:\n        msg = (\"Images with dimensions (M, N, 3) are interpreted as 2D+RGB \"\n               \"by default. Use `multichannel=False` to interpret as \"\n               \"3D image with last dimension of length 3.\")\n        warn(RuntimeWarning(msg))\n        multichannel = True\n    if np.any(np.asarray(sigma) < 0.0):\n        raise ValueError(\"Sigma values less than zero are not valid\")\n    if multichannel:\n        # do not filter across channels\n        if not isinstance(sigma, Iterable):\n            sigma = [sigma] * (image.ndim - 1)\n        if len(sigma) != image.ndim:\n            sigma = np.concatenate((np.asarray(sigma), [0]))\n    image = convert_to_float(image, preserve_range)\n    if output is None:\n        output = np.empty_like(image)\n    elif not np.issubdtype(output.dtype, np.floating):\n        raise ValueError(\"Provided output data type is not float\")\n    ndi.gaussian_filter(image, sigma, output=output, mode=mode, cval=cval,\n                        truncate=truncate)\n    return output\n\n\ndef _guess_spatial_dimensions(image):\n    \"\"\"Make an educated guess about whether an image has a channels dimension.\n\n    Parameters\n    ----------\n    image : ndarray\n        The input image.\n\n    Returns\n    -------\n    spatial_dims : int or None\n        The number of spatial dimensions of ``image``. If ambiguous, the value\n        is ``None``.\n\n    Raises\n    ------\n    ValueError\n        If the image array has less than two or more than four dimensions.\n    \"\"\"\n    if image.ndim == 2:\n        return 2\n    if image.ndim == 3 and image.shape[-1] != 3:\n        return 3\n    if image.ndim == 3 and image.shape[-1] == 3:\n        return None\n    if image.ndim == 4 and image.shape[-1] == 3:\n        return 3\n    else:\n        raise ValueError(\"Expected 2D, 3D, or 4D array, got %iD.\" % image.ndim)\n", "path": "skimage/filters/_gaussian.py"}]}