Possible timeout in parseAsArrayBuffer

Is there a timeout in parseAsArrayBuffer from ITKImageReader? Because when I try to get data from a slow server it gives error in Promise, but if I get the same file from a local server it works well, no problems, both using a fetch command.


What error are you getting? My first thought is that there is some CORS issue with fetching from the slow server, whereas you don’t have those issues with the local server.

It gives this error…

The slow server is in fact a Orthanc server, and I pull nifti images from it. If I download the nifti file and use a local file server it works, but direct from Orthanc gives this problem.

The code I use

async function get(url)
const response = await fetch(url, { mode: ‘no-cors’});
return response.arrayBuffer();

let idSerie = ‘203887c1-80b36d9f-7fc1be71-75bc3420-0aab6659’;
if (userParams.serieid)
idSerie = userParams.serieid;

let filename = idSerie + ‘.nii.gz’;
let url = ‘’ + idSerie + ‘/nifti?compress’;
url = ‘’ + filename;

const reader = vtkITKImageReader.newInstance();

get(url).then((arrayBuffer) => {
reader.parseAsArrayBuffer(arrayBuffer).then(() => {
// wire up the reader to the mapper
// — Reset camera and render the scene —

global.renderWindow = renderWindow;
global.renderer = renderer;
global.actor = actor;
global.mapper = mapper;

Fetching with no-cors will return an opaque Response object, meaning you won’t get any data. You will need to properly configure CORS in order to fetch data.

It worked!!! Thanks !!!
In case anyone suffering the same problem I made a little example how to create a docker nginx to add CORS to Orthanc. Only need to edit properly conf.d/app.conf file. If you interest, you can ask me. I dont have permission to upload it right now…


1 Like