code: def test_header_scaling(self):
      # For images that implement scaling, test effect of scaling
      #
      # This tests the affect of creating an image with a header containing
      # the scaling, then writing the image and reading again.  So the
      # scaling can be affected by the processing of the header when creating
      # the image, or by interpretation of the scaling when creating the
      # array.
      #
      # Analyze does not implement any scaling, but this test class is the
      # base class for all Analyze-derived classes, such as NIfTI
      img_class = self.image_class
      hdr_class = img_class.header_class
      if not hdr_class.has_data_slope:
          return
      arr = np.arange(24, dtype=np.int16).reshape((2, 3, 4))
      invalid_slopes = (0, np.nan, np.inf, -np.inf)
      for slope in (1,) + invalid_slopes:
          self.assert_null_scaling(arr, slope, None)
      if not hdr_class.has_data_intercept:
          return
      invalid_inters = (np.nan, np.inf, -np.inf)
      invalid_pairs = tuple(
          itertools.product(invalid_slopes, invalid_inters)
      )
      bad_slopes_good_inter = tuple(
          itertools.product(invalid_slopes, (0, 1))
      )
      good_slope_bad_inters = tuple(
          itertools.product((1, 2), invalid_inters)
      )
      for slope, inter in (
          invalid_pairs + bad_slopes_good_inter + good_slope_bad_inters
      ):
          self.assert_null_scaling(arr, slope, inter)
  
imports: import itertools
  import unittest
  from io import BytesIO
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from ..optpkg import optional_package
  from ..casting import sctypes_aliases, shared_range, type_info
  from ..spatialimages import HeaderDataError
  from ..spm99analyze import HeaderTypeError, Spm99AnalyzeHeader, Spm99AnalyzeImage
  from ..testing import assert_allclose_safely, bytesio_filemap, bytesio_round_trip, suppress_warnings
  from ..volumeutils import _dt_min_max, apply_read_scaling
  from .None import test_analyze
label_desc: Use image node_id 6 for calling the ImageScalingMixin obj's underlying member method code with example usage: obj.test_header_scaling() without return types