def get_field_kwargs(field: str) -> dict[str, Any]:
    """Get the keyword arguments for a visualization function.

    This function retrieves the default keyword arguments for a given visualization
    function by inspecting its signature.

    Args:
        field (str): The name of the visualization field (e.g., ``'mask'``,
            ``'anomaly_map'``).

    Returns:
        dict[str, Any]: A dictionary containing the default keyword arguments for
            the visualization function. Each key is a parameter name and the value
            is its default value.

    Raises:
        ValueError: If the specified ``field`` does not have a corresponding
            visualization function in the current module.

    Examples:
        Get keyword arguments for visualizing a mask:

        >>> # Get keyword arguments for visualizing a mask
        >>> mask_kwargs = get_field_kwargs('mask')
        >>> print(mask_kwargs)  # doctest: +SKIP
        {
            'mode': 'binary',
            'color': (255, 0, 0),
            'alpha': 0.5,
            'background_color': (0, 0, 0, 0)
        }

        Get keyword arguments for visualizing an anomaly map:

        >>> # Get keyword arguments for visualizing an anomaly map
        >>> anomaly_map_kwargs = get_field_kwargs('anomaly_map')
        >>> print(anomaly_map_kwargs)  # doctest: +SKIP
        {
            'colormap': True,
            'normalize': False
        }

        Attempt to get keyword arguments for an invalid field:

        >>> get_field_kwargs('invalid_field')  # doctest: +IGNORE_EXCEPTION_DETAIL
        Traceback (most recent call last):
            ...
        ValueError: 'invalid_field' is not a valid function in the current module.

    Note:
        - The function looks for a visualization function named
          ``visualize_{field}`` in the current module
        - Only parameters with default values are included in the returned dict
        - Variable keyword arguments (``**kwargs``) are noted in the dict with a
          descriptive string
        - Both keyword-only and positional-or-keyword parameters are included
    """
    # Get the current module
    current_module = sys.modules[__name__]

    # Try to get the function from the current module
    func_name = f"visualize_{field}"
    func = getattr(current_module, func_name, None)

    if func is None or not callable(func):
        msg = f"'{field}' is not a valid function in the current module."
        raise ValueError(msg)

    # Get the signature of the function
    signature = inspect.signature(func)

    # Initialize a dictionary to store keyword argument information
    kwargs = {}

    # Iterate through the parameters
    for name, param in signature.parameters.items():
        # Check if the parameter is a keyword argument
        if param.kind in {inspect.Parameter.KEYWORD_ONLY, inspect.Parameter.POSITIONAL_OR_KEYWORD}:
            if param.default != inspect.Parameter.empty:
                kwargs[name] = param.default
        elif param.kind == inspect.Parameter.VAR_KEYWORD:
            kwargs[name] = "Variable keyword arguments (**kwargs)"

    return kwargs
Get the keyword arguments for a visualization function.

    This function retrieves the default keyword arguments for a given visualization
    function by inspecting its signature.

    Args:
        field (str): The name of the visualization field (e.g., ``'mask'``,
            ``'anomaly_map'``).

    Returns:
        dict[str, Any]: A dictionary containing the default keyword arguments for
            the visualization function. Each key is a parameter name and the value
            is its default value.

    Raises:
        ValueError: If the specified ``field`` does not have a corresponding
            visualization function in the current module.

    Examples:
        Get keyword arguments for visualizing a mask:

        >>> # Get keyword arguments for visualizing a mask
        >>> mask_kwargs = get_field_kwargs('mask')
        >>> print(mask_kwargs)  # doctest: +SKIP
        {
            'mode': 'binary',
            'color': (255, 0, 0),
            'alpha': 0.5,
            'background_color': (0, 0, 0, 0)
        }

        Get keyword arguments for visualizing an anomaly map:

        >>> # Get keyword arguments for visualizing an anomaly map
        >>> anomaly_map_kwargs = get_field_kwargs('anomaly_map')
        >>> print(anomaly_map_kwargs)  # doctest: +SKIP
        {
            'colormap': True,
            'normalize': False
        }

        Attempt to get keyword arguments for an invalid field:

        >>> get_field_kwargs('invalid_field')  # doctest: +IGNORE_EXCEPTION_DETAIL
        Traceback (most recent call last):
            ...
        ValueError: 'invalid_field' is not a valid function in the current module.

    Note:
        - The function looks for a visualization function named
          ``visualize_{field}`` in the current module
        - Only parameters with default values are included in the returned dict
        - Variable keyword arguments (``**kwargs``) are noted in the dict with a
          descriptive string
        - Both keyword-only and positional-or-keyword parameters are included
    
src/anomalib/visualization/image/functional.py