code: def test_image_clims_and_gamma(
      input_dtype,
      texture_format,
      num_channels,
      clim_on_init,
      data_on_init,
  ):
      """Test image visual with clims and gamma on shader."""
      size = (80, 80)
      if texture_format == "__dtype__":
          texture_format = input_dtype
      shape = size + (num_channels,) if num_channels > 0 else size
      np.random.seed(0)
      data = _make_test_data(shape, input_dtype)
      orig_clim, new_clim = _get_orig_and_new_clims(input_dtype)
      # 16-bit integers and above seem to have precision loss when scaled on the CPU
      is_16int_cpu_scaled = (
          np.dtype(input_dtype).itemsize >= 2
          and np.issubdtype(input_dtype, np.integer)
          and texture_format is None
      )
      clim_atol = 2 if is_16int_cpu_scaled else 1
      gamma_atol = 3 if is_16int_cpu_scaled else 2
  
      kwargs = {}
      if clim_on_init:
          kwargs["clim"] = orig_clim
      if data_on_init:
          kwargs["data"] = data
      # default is RGBA, anything except auto requires reformat
      set_data_fails = (
          num_channels != 4
          and texture_format is not None
          and texture_format != "auto"
      )
  
      with TestingCanvas(size=size[::-1], bgcolor="w") as c:
          image = Image(
              cmap="grays",
              texture_format=texture_format,
              parent=c.scene,
              **kwargs,
          )
          if not data_on_init:
              _set_image_data(image, data, set_data_fails)
              if set_data_fails:
                  return
          rendered = c.render()
          _dtype = rendered.dtype
          shape_ratio = rendered.shape[0] // data.shape[0]
          rendered1 = downsample(
              rendered, shape_ratio, axis=(0, 1)
          ).astype(_dtype)
          compare_render(data, rendered1)
  
          # adjust color limits
          image.clim = new_clim
          rendered2 = downsample(
              c.render(), shape_ratio, axis=(0, 1)
          ).astype(_dtype)
          scaled_data = (
              np.clip(data, new_clim[0], new_clim[1]) - new_clim[0]
          ) / (new_clim[1] - new_clim[0])
          compare_render(
              scaled_data, rendered2, rendered1, atol=clim_atol
          )
  
          # adjust gamma
          image.gamma = 2
          rendered3 = downsample(
              c.render(), shape_ratio, axis=(0, 1)
          ).astype(_dtype)
          compare_render(
              scaled_data**2, rendered3, rendered2, atol=gamma_atol
          )
  
file_path: vispy/vispy/visuals/tests/test_image.py
imports: from unittest import mock
  from vispy.scene import Image, PanZoomCamera
  from vispy.testing import requires_application, TestingCanvas, run_tests_if_main, IS_CI
  from vispy.testing.image_tester import assert_image_approved, downsample
  import numpy
  import pytest
  from vispy.testing.rendered_array_tester import compare_render, max_for_dtype
label_desc: Use image node_id 6 for calling a global function with example usage: test_image_clims_and_gamma(input_dtype, texture_format, num_channels, clim_on_init, data_on_init) without return types