code: def test_correct_results(self, gamma, invert_image, retain_stats):
      adjuster = AdjustContrast(
          gamma=gamma,
          invert_image=invert_image,
          retain_stats=retain_stats,
      )
      for p in TEST_NDARRAYS:
          im = p(self.imt)
          result = adjuster(im)
          self.assertTrue(type(im), type(result))
          if False:  # gamma == 1.0:
              expected = self.imt
          else:
              if invert_image:
                  self.imt = -self.imt
  
              if retain_stats:
                  mn = self.imt.mean()
                  sd = self.imt.std()
  
              epsilon = 1e-7
              img_min = self.imt.min()
              img_range = self.imt.max() - img_min
  
              expected = (
                  np.power(
                      (
                          (self.imt - img_min)
                          / float(img_range + epsilon)
                      ),
                      gamma,
                  )
                  * img_range
                  + img_min
              )
  
              if retain_stats:
                  # zero mean and normalize
                  expected = expected - expected.mean()
                  expected = expected / (expected.std() + 1e-8)
                  # restore old mean and standard deviation
                  expected = sd * expected + mn
  
              if invert_image:
                  expected = -expected
  
          assert_allclose(
              result, expected, atol=1e-05, type_test="tensor"
          )
  
file_path: MONAI/tests/test_adjust_contrast.py
imports: from __future__ import annotations
  import unittest
  import numpy
  from parameterized import parameterized
  from monai.transforms import AdjustContrast
  from tests.utils import TEST_NDARRAYS, NumpyImageTestCase2D, assert_allclose
label_desc: Use image node_id 1 for calling the TestAdjustContrast obj's underlying member method code with example usage: obj.test_correct_results(gamma, invert_image, retain_stats) without return types