code: def test_nlmeans_4d_3dsigma_and_threads():
      # Input is 4D data and 3D sigma
      data = np.ones((50, 50, 50, 5))
      sigma = np.ones(data.shape[:3])
      mask = np.zeros(data.shape[:3])
  
      # mask[25-10:25+10] = 1
      mask[:] = 1
  
      print("cpu count %d" % (cpu_count(),))
  
      print("1")
      t = time()
      new_data = nlmeans(data, sigma, mask, num_threads=1)
      duration_1core = time() - t
      print(duration_1core)
  
      print("All")
      t = time()
      new_data2 = nlmeans(data, sigma, mask, num_threads=None)
      duration_all_core = time() - t
      print(duration_all_core)
  
      print("2")
      t = time()
      new_data3 = nlmeans(data, sigma, mask, num_threads=2)
      duration_2core = time() - t
      print(duration_2core)
  
      assert_array_almost_equal(new_data, new_data2)
      assert_array_almost_equal(new_data2, new_data3)
  
      if cpu_count() > 2:
          assert_equal(duration_all_core < duration_2core, True)
          assert_equal(duration_2core < duration_1core, True)
  
      if cpu_count() == 2:
          assert_greater(duration_1core, duration_2core)
  
file_path: dipy/dipy/denoise/tests/test_nlmeans.py
imports: from time import time
  import numpy
  from numpy.testing import assert_, assert_equal, assert_array_almost_equal, assert_raises
  import pytest
  from dipy.denoise.nlmeans import nlmeans
  from dipy.denoise.denspeed import add_padding_reflection, remove_padding
  from dipy.utils.omp import cpu_count, have_openmp
  from dipy.testing import assert_greater
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 8 for calling a global function with example usage: test_nlmeans_4d_3dsigma_and_threads() without return types