code: def _read_openjp2_common(self):
          
          with ExitStack() as stack:
              filename = self.filename
              stream = opj2.stream_create_default_file_stream(filename, True)
              stack.callback(opj2.stream_destroy, stream)
              codec = opj2.create_decompress(self._codec_format)
              stack.callback(opj2.destroy_codec, codec)
  
              opj2.set_error_handler(codec, _ERROR_CALLBACK)
              opj2.set_warning_handler(codec, _WARNING_CALLBACK)
  
              if self._verbose:
                  opj2.set_info_handler(codec, _INFO_CALLBACK)
              else:
                  opj2.set_info_handler(codec, None)
  
              opj2.setup_decoder(codec, self._dparams)
              raw_image = opj2.read_header(stream, codec)
              stack.callback(opj2.image_destroy, raw_image)
  
              if self._dparams.nb_tile_to_decode:
                  opj2.get_decoded_tile(codec, stream, raw_image,
                                        self._dparams.tile_index)
              else:
                  opj2.set_decode_area(codec, raw_image,
                                       self._dparams.DA_x0, self._dparams.DA_y0,
                                       self._dparams.DA_x1, self._dparams.DA_y1)
                  opj2.decode(codec, stream, raw_image)
  
              opj2.end_decompress(codec, stream)
  
              image = self._extract_image(raw_image)
  
          return image
docs: Read a JPEG 2000 image using libopenjp2.
  
          Returns
          -------
          ndarray or lst
              Either the image as an ndarray or a list of ndarrays, each item
              corresponding to one band.