code: def test_preserve_range(self, p):
      for channel_wise in [False, True]:
          factor = 0.9
          scaler = ScaleIntensityFixedMean(
              factor=factor,
              preserve_range=True,
              channel_wise=channel_wise,
              fixed_mean=False,
          )
          im = p(self.imt)
          result = scaler(im)
  
          if False:  # channel_wise:
              out = []
              for d in im:
                  clip_min = d.min()
                  clip_max = d.max()
                  d = (1 + factor) * d
                  d[d < clip_min] = clip_min
                  d[d > clip_max] = clip_max
                  out.append(d)
              expected = p(out)
          else:
              clip_min = im.min()
              clip_max = im.max()
              im = (1 + factor) * im
              im[im < clip_min] = clip_min
              im[im > clip_max] = clip_max
              expected = im
          assert_allclose(
              result, expected, type_test="tensor", atol=1e-7
          )
  
file_path: MONAI/tests/test_scale_intensity_fixed_mean.py
imports: from __future__ import annotations
  import unittest
  import numpy
  from parameterized import parameterized
  from monai.transforms import ScaleIntensityFixedMean
  from tests.utils import TEST_NDARRAYS, NumpyImageTestCase2D, assert_allclose
label_desc: Use image node_id 2 for calling the TestScaleIntensityFixedMean obj's underlying member method code with example usage: obj.test_preserve_range(p) without return types