code: def test_classify():
      imgseg = TissueClassifierHMRF()
  
      nclasses = 4
      beta = 0.1
      tolerance = 0.0001
      max_iter = 10
  
      image = create_image()
  
      npt.assert_(image.max() == 1.0)
      npt.assert_(image.min() == 0.0)
  
      # First we test without setting iterations and tolerance
      seg_init, seg_final, PVE = imgseg.classify(image, nclasses, beta)
  
      npt.assert_(seg_final.max() == nclasses)
      npt.assert_(seg_final.min() == 0.0)
  
      # Second we test it with just changing the tolerance
      seg_init, seg_final, PVE = imgseg.classify(
          image, nclasses, beta, tolerance
      )
  
      npt.assert_(seg_final.max() == nclasses)
      npt.assert_(seg_final.min() == 0.0)
  
      # Third we test it with just the iterations
      seg_init, seg_final, PVE = imgseg.classify(
          image, nclasses, beta, max_iter
      )
  
      npt.assert_(seg_final.max() == nclasses)
      npt.assert_(seg_final.min() == 0.0)
  
      # Next we test saving the history of accumulated energies from ICM
      imgseg = TissueClassifierHMRF(save_history=True)
  
      seg_init, seg_final, PVE = imgseg.classify(
          200 * image, nclasses, beta, tolerance
      )
  
      npt.assert_(seg_final.max() == nclasses)
      npt.assert_(seg_final.min() == 0.0)
  
      npt.assert_(imgseg.energies_sum[0] > imgseg.energies_sum[-1])
  
file_path: dipy/dipy/segment/tests/test_mrf.py
imports: import numpy
  import numpy.testing
  from dipy.data import get_fnames
  from dipy.sims.voxel import add_noise
  from dipy.segment.mrf import ConstantObservationModel, IteratedConditionalModes
  from dipy.segment.tissue import TissueClassifierHMRF
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 9 for calling a global function with example usage: test_classify() without return types