code: def set_decode_area(codec, image, start_x=0, start_y=0, end_x=0, end_y=0):
      
      OPENJP2.opj_set_decode_area.argtypes = [CODEC_TYPE,
                                              ctypes.POINTER(ImageType),
                                              ctypes.c_int32,
                                              ctypes.c_int32,
                                              ctypes.c_int32,
                                              ctypes.c_int32]
      OPENJP2.opj_set_decode_area.restype = check_error
  
      OPENJP2.opj_set_decode_area(codec, image,
                                  ctypes.c_int32(start_x),
                                  ctypes.c_int32(start_y),
                                  ctypes.c_int32(end_x),
                                  ctypes.c_int32(end_y))
docs: Wraps openjp2 library function opj_set_decode area.
  
      Sets the given area to be decoded.  This function should be called right
      after read_header and before any tile header reading.
  
      Parameters
      ----------
      codec : CODEC_TYPE
          Codec initialized by create_decompress function.
      image : ImageType pointer
          The decoded image previously set by read_header.
      start_x, start_y : optional, int
          The left and upper position of the rectangle to decode.
      end_x, end_y : optional, int
          The right and lower position of the rectangle to decode.
  
      Raises
      ------
      RuntimeError
          If the OpenJPEG library routine opj_set_decode_area fails.