code: def __check_raw_image_equals_pilimage(self, glimage, pilimage):
      # size equal
      self.assertEqual((glimage.width, glimage.height), pilimage.size)
      # decode image
      glimage_decoded = image_analysis._decode(glimage)
      self.assertEqual(
          glimage_decoded._format_enum, image._format["RAW"]
      )
      # Getting data
      if glimage.channels == 1:
          pil_data = bytearray([z for z in pilimage.getdata()])
      else:
          pil_data = bytearray(
              [z for l in pilimage.getdata() for z in l]
          )
  
      # Size data equal
      self.assertEqual(glimage_decoded._image_data_size, len(pil_data))
      self.assertEqual(len(glimage_decoded._image_data), len(pil_data))
      pixel_diff = [
          abs(x - y)
          for (x, y) in zip(glimage_decoded._image_data, pil_data)
      ]
  
      self.assertLess(sum(pixel_diff) / float(len(pil_data)), 2)
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import array
  import unittest
  from PIL import Image
  import os
  from ..data_structures import image
  from ..None import SArray
  from ..toolkits.image_analysis import image_analysis
  from ..toolkits._main import ToolkitError
  from .._deps import numpy, HAS_NUMPY
label_desc: Use image node_id 1 for calling the ImageClassTest obj's underlying member method code with example usage: obj.__check_raw_image_equals_pilimage(glimage, pilimage) without return types