Closed dingxm closed 8 months ago
Hi dingxm,
It appears that your image is simply too large. I would suggest using the mosaics
utility of steinbock which allows for processing of large image files. Please see the related documentation here.
If you are working on Linux you could also run the GPU version of steinbock (see here under Linux
for installation instructions). I would also recommend to use the docker run -e STEINBOCK_MASK_DTYPE=uint32 ...
option to write out 32-bit masks instead of the default 16-bit masks. Otherwise your cell IDs are truncated at 65535.
Hi dingxm,
It appears that your image is simply too large. I would suggest using the
mosaics
utility of steinbock which allows for processing of large image files. Please see the related documentation here.
Thanks very much for your suggestion. I will try the mosaics utility.
Hi I have successfully completed the segmentation using mosaics as Milad4849 suggested and I got a big mask file. And -e STEINBOCK_MASK_DTYPE=uint32 was also included as nilseling suggested. I have met another two problem.
Hi dingxm, Ok it seems like the stitching of the mosaics is not working in your case. This should not be the case in the latest version of steinbock. Could you please confirm that you are using the latest version of steinbock (0.16.1)?
Yes it is steinbock (0.16.1) The code below is what I used. base_dir=$(cd -- "$(dirname "${BASH_SOURCE[0]}")" && pwd -P) steinbock="docker run -v ${base_dir}:/data -v /tmp/.X11-unix:/tmp/.X11-unix -v /home/dingxm/.Xauthority:/home/steinbock/.Xauthority:ro -e DISPLAY -e STEINBOCK_MASK_DTYPE=uint32 ghcr.io/bodenmillergroup/steinbock:0.16.1" cd "${base_dir}" $steinbock utils mosaics tile external/*.tiff --size 4096 -o img $steinbock segment deepcell --minmax $steinbock utils mosaics stitch masks -o masks_full
Any suggestion?
Hi dingxm, I encountered the same problem. I noticed that the number of objects quantified for the post-stitching mask is the same as the maximum number of objects for Individual images after splitting. Could you please share how to solve this problem?
Hi yuGithuuub, For the AKOYA data, I start to use the deepcell directly for the segmentation. It works well. Steinbock is not optimized for the large tiff.
I have a big tiff file from AKOYA data which is 28008 X 48384 px. I tried to use the steinbock for the analysis and deepcell was used for the segmentation. I got the error below,
/opt/venv/lib/python3.8/site-packages/deepcell_toolbox/deep_watershed.py:108: UserWarning: h_maxima peak finding algorithm was selected, but the provided image is larger than 5k x 5k pixels.This will lead to slow prediction performance. warnings.warn('h_maxima peak finding algorithm was selected, ' /opt/venv/lib/python3.8/site-packages/deepcell_toolbox/deep_watershed.py:179: FutureWarning:
selem
is a deprecated argument name forh_maxima
. It will be removed in version 1.0. Please usefootprint
instead. markers = h_maxima(image=maxima, Error segmenting objects in img/NBL_N0351.tiff Traceback (most recent call last): File "/app/steinbock/steinbock/segmentation/deepcell.py", line 112, in try_segment_objects mask = predict(img, predict_kwargs) File "/app/steinbock/steinbock/segmentation/deepcell.py", line 54, in predict mask = app.predict( File "/opt/venv/lib/python3.8/site-packages/deepcell/applications/mesmer.py", line 306, in predict return self._predict_segmentation(image, File "/opt/venv/lib/python3.8/site-packages/deepcell/applications/application.py", line 448, in _predict_segmentation label_image = self._postprocess(output_images, postprocess_kwargs) File "/opt/venv/lib/python3.8/site-packages/deepcell/applications/application.py", line 215, in _postprocess image = self.postprocessing_fn(image, kwargs) File "/opt/venv/lib/python3.8/site-packages/deepcell/applications/mesmer.py", line 139, in mesmer_postprocess label_images = deep_watershed(model_output['whole-cell'], File "/opt/venv/lib/python3.8/site-packages/deepcell_toolbox/deep_watershed.py", line 179, in deep_watershed markers = h_maxima(image=maxima, File "/opt/venv/lib/python3.8/site-packages/skimage/_shared/utils.py", line 282, in fixed_func return func(*args, *kwargs) File "/opt/venv/lib/python3.8/site-packages/skimage/morphology/extrema.py", line 172, in h_maxima rec_img = grayreconstruct.reconstruction(shifted_img, image, File "/opt/venv/lib/python3.8/site-packages/skimage/_shared/utils.py", line 282, in fixed_func return func(args, kwargs) File "/opt/venv/lib/python3.8/site-packages/skimage/morphology/grayreconstruct.py", line 203, in reconstruction value_rank, value_map = rank_order(images) File "/opt/venv/lib/python3.8/site-packages/skimage/filters/_rank_order.py", line 56, in rank_order original_values[1:] = flat_image[1:][is_different] ValueError: could not broadcast input array from shape (5274821986,) into shape (979854690,)Any suggestion?