export type GetApiMapLabelledMapNiiGzArgs = {parcellation_id: string, space_id: string, region_id?: string | undefined}; export type GetApiMapLabelledMapNiiGzOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Get Parcellation Labelled Map * * GET /map/labelled_map.nii.gz */ export const getApiMapLabelledMapNiiGz = async (args: GetApiMapLabelledMapNiiGzArgs, options: GetApiMapLabelledMapNiiGzOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.parcellation_id != null) query.append("parcellation_id", String(args.parcellation_id)) if (args.space_id != null) query.append("space_id", String(args.space_id)) if (args.region_id != null) query.append("region_id", String(args.region_id)) const url = `${baseUrl.replace(/\/+$/, '')}/map/labelled_map.nii.gz${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 undefined };