code: def _test_clamping(I, thI=0.0, clI=256, mask=None):
      R = HistogramRegistration(
          I, I, from_bins=clI, from_mask=mask, to_mask=mask
      )
      R.subsample(spacing=[1, 1, 1])
      Ic = R._from_data
      Ic2 = R._to_data[1:-1, 1:-1, 1:-1]
      assert_array_equal(Ic, Ic2)
      dyn = Ic.max() + 1
      assert dyn == R._joint_hist.shape[0]
      assert dyn == R._joint_hist.shape[1]
      return Ic, Ic2
  
imports: import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from ....core.image.image_spaces import make_xyz_image
  from ....testing import assert_almost_equal
  from .._registration import _joint_histogram
  from ..affine import Affine, Rigid
  from ..histogram_registration import HistogramRegistration
label_desc: Use image node_id 5 for calling a global function with example usage: _test_clamping(I, thI, clI, mask) and returns: Ic,  Ic2