code: def test_gibbs_flow():
      def generate_slice():
          Nori = 32
          image = np.zeros((6 * Nori, 6 * Nori))
          image[Nori : 2 * Nori, Nori : 2 * Nori] = 1
          image[Nori : 2 * Nori, 4 * Nori : 5 * Nori] = 1
          image[2 * Nori : 3 * Nori, Nori : 3 * Nori] = 1
          image[3 * Nori : 4 * Nori, 2 * Nori : 3 * Nori] = 2
          image[3 * Nori : 4 * Nori, 4 * Nori : 5 * Nori] = 1
          image[4 * Nori : 5 * Nori, 3 * Nori : 5 * Nori] = 3
  
          # Corrupt image with gibbs ringing
          c = np.fft.fft2(image)
          c = np.fft.fftshift(c)
          c_crop = c[48:144, 48:144]
          image_gibbs = abs(np.fft.ifft2(c_crop) / 4)
          return image_gibbs
  
      with TemporaryDirectory() as out_dir:
          image4d = np.zeros((96, 96, 2, 2))
          image4d[:, :, 0, 0] = generate_slice()
          image4d[:, :, 1, 0] = generate_slice()
          image4d[:, :, 0, 1] = generate_slice()
          image4d[:, :, 1, 1] = generate_slice()
          data_path = os.path.join(out_dir, "random_noise.nii.gz")
          save_nifti(data_path, image4d, np.eye(4))
  
          gibbs_flow = GibbsRingingFlow()
          gibbs_flow.run(data_path, out_dir=out_dir)
          assert_true(
              os.path.isfile(
                  gibbs_flow.last_generated_outputs["out_unring"]
              )
          )
  
file_path: dipy/dipy/workflows/tests/test_denoise.py
imports: import os
  from tempfile import TemporaryDirectory
  import pytest
  import numpy
  import numpy.testing
  from dipy.utils.optpkg import optional_package
  from dipy.data import get_fnames
  from dipy.io.image import save_nifti, load_nifti, load_nifti_data
  from dipy.testing import assert_true, assert_false, assert_greater, assert_less
  from dipy.testing.decorators import set_random_number_generator
  from dipy.workflows.denoise import NLMeansFlow, LPCAFlow, MPPCAFlow, GibbsRingingFlow, Patch2SelfFlow
label_desc: Use image node_id 5 for calling a global function with example usage: test_gibbs_flow() and returns: image_gibbs