code: def read_header(stream, codec):
      
      ARGTYPES = [STREAM_TYPE_P, CODEC_TYPE,
                  ctypes.POINTER(ctypes.POINTER(ImageType))]
      OPENJP2.opj_read_header.argtypes = ARGTYPES
      OPENJP2.opj_read_header.restype = check_error
  
      imagep = ctypes.POINTER(ImageType)()
      OPENJP2.opj_read_header(stream, codec, ctypes.byref(imagep))
      return imagep
docs: Decodes an image header.
  
      Wraps the openjp2 library function opj_read_header.
  
      Parameters
      ----------
      stream: STREAM_TYPE_P
          The JPEG2000 stream.
      codec:  codec_t
          The JPEG2000 codec to read.
  
      Returns
      -------
      imagep : reference to ImageType instance
          The image structure initialized with image characteristics.
  
      Raises
      ------
      RuntimeError
          If the OpenJPEG library routine opj_read_header fails.