code: def test_model_out_img(in_tmp_path):
      # Model output image
      cmap = load_image(anatfile).coordmap
      shape = (2, 3, 4)
      fname = "myfile.nii"
      moi = ModelOutputImage(fname, cmap, shape)
      for i in range(shape[0]):
          moi[i] = i
      for i in range(shape[0]):
          assert_array_equal(moi[i], i)
      moi.save()
      pytest.raises(ValueError, moi.__setitem__, 0, 1)
      pytest.raises(ValueError, moi.__getitem__, 0)
      new_img = load_image(fname)
      for i in range(shape[0]):
          assert_array_equal(new_img[i].get_fdata(), i)
      del new_img
  
file_path: nipy/nipy/modalities/fmri/fmristat/tests/test_model.py
imports: import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from nipy.algorithms.statistics.formula.formulae import Formula, Term, make_recarray
  from nipy.algorithms.statistics.models.regression import OLSModel, ar_bias_correct
  from nipy.core.image.image import rollimg
  from nipy.io.api import load_image
  from nipy.testing import anatfile, funcfile
  from ...api import FmriImageList
  from ..None import model
  from ..model import ModelOutputImage, estimateAR
label_desc: Use image node_id 1 for calling a global function with example usage: test_model_out_img(in_tmp_path) without return types