export type GetApiInstancesIdImageUint16Args = {quality?: number | undefined, returnUnsupportedImage?: boolean | undefined, Accept?: string | undefined, id: string}; export type GetApiInstancesIdImageUint16Options = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Decode an image (uint16) * * GET /instances/{id}/image-uint16 */ export const getApiInstancesIdImageUint16 = async (args: GetApiInstancesIdImageUint16Args, options?: GetApiInstancesIdImageUint16Options) => { const {baseUrl = "https://orthanc.uclouvain.be/demo", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "image/jpeg") if (args.quality != null) query.append("quality", String(args.quality)) if (args.returnUnsupportedImage != null) query.append("returnUnsupportedImage", String(args.returnUnsupportedImage)) if (args.Accept != null) headers.set("Accept", String(args.Accept)) const url = `${baseUrl.replace(/\/+$/, '')}/instances/${encodeURIComponent(String(args.id))}/image-uint16${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };