code: def convert_pixels_to_buffer(pixels, pixel_type):
      """Convert the pixels in the image into a buffer of the right pixel type
  
      pixels - a 2d monochrome or color image
  
      pixel_type - one of the OME pixel types
  
      returns a 1-d byte array
      """
      if pixel_type == omexml.PT_UINT8:
          as_dtype = np.uint8
      elif pixel_type == omexml.PT_UINT16:
          as_dtype = "<u2"
      elif pixel_type == omexml.PT_FLOAT:
          as_dtype = "<f4"
      else:
          raise NotImplementedError(
              "Unsupported pixel type: %d" % pixel_type
          )
  
      return np.frombuffer(
          np.ascontiguousarray(pixels, as_dtype).data, np.uint8
      )
  
imports: import os
  import scyjava
  import numpy
  import logging
  from .None import omexml
  from ..utilities.java import jimport
label_desc: Use image node_id 2 for calling a global function with example usage: convert_pixels_to_buffer(pixels, pixel_type) and returns: np