docstr: Test the feature: image intensity.
docstr_tok: ["Test","the","feature",":","image","intensity","."]
code: def test_intensities(self):
      """Test the feature: image intensity."""
  
      # Test 2D image with various settings
      i = numpy.asarray([[-1.0, 1, 2], [0.0, 2, 4], [1.0, 3, 5]])
      m = [
          [True, False, False],
          [False, True, False],
          [True, True, False],
      ]
      e = [-1.0, 1, 2, 0, 2, 4, 1, 3, 5]
      em = [-1.0, 2.0, 1.0, 3.0]
  
      r = intensities(i)  # normalize = False, mask = slice(None)
      numpy.testing.assert_allclose(
          r,
          e,
          err_msg="intensities: 2D, single-spectrum, unmasked and not normalized",
      )
  
      r = intensities(i, mask=m)  # normalize = False
      numpy.testing.assert_allclose(
          r,
          em,
          err_msg="intensities: 2D, single-spectrum, masked and not normalized",
      )
  
      r = intensities([i, i])  # normalize = False, mask = slice(None)
      numpy.testing.assert_allclose(
          r,
          join(e, e),
          err_msg="intensities: 2D, multi-spectrum, unmasked and not normalized",
      )
  
      # Test 3D image
      i = numpy.asarray([i, i + 0.5])
      e = append(e, numpy.asarray(e) + 0.5)
  
      r = intensities(i)  # normalize = False, mask = slice(None)
      numpy.testing.assert_allclose(
          r,
          e,
          err_msg="intensities: 3D, single-spectrum, unmasked and not normalized",
      )
  
      # Test 4D image
      i = numpy.asarray([i, i + 0.5])
      e = append(e, numpy.asarray(e) + 0.5)
  
      r = intensities(i)  # normalize = False, mask = slice(None)
      numpy.testing.assert_allclose(
          r,
          e,
          err_msg="intensities: 4D, single-spectrum, unmasked and not normalized",
      )
  
file_path: medpy/tests/features_/intensity.py
imports: import unittest
  import math
  import numpy
  from medpy.features.intensity import intensities, centerdistance, centerdistance_xdminus1, indices, local_mean_gauss, local_histogram
  from medpy.features.utilities import join, append
  from medpy.core.exceptions import ArgumentError
label_desc: Use image node_id 6 for calling the TestIntensityFeatures obj's underlying member method code with example usage: obj.test_intensities() without return types