Maximum projection of an image using Dask

I was trying to compute the maximum projection of 7 z-stacks. I am using Dask to read the images and do the maximum project but when I try to retrieve the NumPy array. I am getting SystemError. I am not sure where I made an error. I have attached a screenshot of my code and the error.

sorry, For a very naive question. I am very new to Dask and python.

Hi @BTB612 ,


I’d recommend that you avoid calling .compute() until the very end.

max_proj_dask = da.max(aux4_dask).compute()

The following is not necessary:

aux4_numpy = aux4_dask.compute()

Unfortunately, I cannot see the full statement in the loop of your first notebook cell. But it is often not necessary to call imread() in that way. imread(filename) can read all files specified by its input argument string filename in one call, since filename can be a globstring like ‘myfile.*.png’