code: def test_useCupy_can_be_set_after_init():
      prev_setting = pg.getConfigOption("useCupy")
      try:
          pg.setConfigOption("useCupy", False)
          w = pg.GraphicsLayoutWidget()
          w.show()
          view = pg.ViewBox()
          w.setCentralWidget(view)
          w.resize(200, 200)
          img = cupy.random.randint(0, 255, size=(32, 32)).astype(
              cupy.uint8
          )
          ii = pg.ImageItem()
          view.addItem(ii)
          pg.setConfigOption("useCupy", True)
          ii.setImage(img)
          w.hide()
      finally:
          pg.setConfigOption("useCupy", prev_setting)
  
file_path: pyqtgraph/tests/graphicsItems/test_ImageItem.py
imports: import time
  import numpy
  import pytest
  import pyqtgraph
  from pyqtgraph.Qt import QtCore, QtGui, QtTest
  from tests.image_testing import TransposedImageItem, assertImageApproved
label_desc: Use image node_id 1 for calling a global function with example usage: test_useCupy_can_be_set_after_init() without return types