code: def test_stacked_slicer(slicer, img, tmp_path):
      """Tests for saving to file with stacked slicers."""
      cut_coords = (
          3 if slicer in [XSlicer, YSlicer, ZSlicer] else (3, 3)
      )
      slicer = slicer.init_with_figure(img=img, cut_coords=cut_coords)
      slicer.add_overlay(img, cmap=plt.cm.gray)
      # Forcing a layout here, to test the locator code
      slicer.savefig(tmp_path / "out.png")
      slicer.close()
  
imports: import matplotlib
  import matplotlib.pyplot
  import numpy
  import pytest
  from nibabel import Nifti1Image
  from nilearn.datasets import load_mni152_template
  from nilearn.plotting.displays import BaseAxes, LProjector, LRProjector, LYRProjector, LYRZProjector, LZRProjector, LZRYProjector, MosaicSlicer, OrthoProjector, OrthoSlicer, RProjector, TiledSlicer, XProjector, XSlicer, XZProjector, XZSlicer, YProjector, YSlicer, YXProjector, YXSlicer, YZProjector, YZSlicer, ZProjector, ZSlicer
label_desc: Use image node_id 8 for calling a global function with example usage: test_stacked_slicer(slicer, img, tmp_path) without return types