kreshuklab / plant-seg

A tool for cell instance aware segmentation in densely packed 3D volumetric images
https://kreshuklab.github.io/plant-seg/
MIT License
94 stars 31 forks source link

AssertionError: Not enough patch overlap for stride #75

Closed e-tomato closed 2 years ago

e-tomato commented 3 years ago

Dear lorenzocerrone,

Thank you for providing this great image analysis tool for plant researchers.

I am planning to use PlantSeg to auto-segment my confocal images from inflorescence meristems. First, I succeeded to install the software via conda in WSL2 (windows 10); Then I tested the example files "sample_ovule.h5" from https://github.com/hci-unihd/plant-seg/tree/master/tests/resources. It works well when I set each steps as "True" from the file "test_config.yaml".

Next, I tried to test the inflorescence meristem images from your OSF project: MutX_DR5v2_6_4_M1.tif, https://mfr.de-1.osf.io/render?url=https://osf.io/edx2f/?direct%26mode=render%26action=download%26mode=render. In cnn_prediction section, I set the model_name: "confocal_PNAS_3d", patch size: patch: [2, 128, 128] and stride: 'Balanced', then it always give me this error message: "AssertionError: Not enough patch overlap for stride: [1, 96, 96] and halo: (4, 8, 8)",

I also tried to change different models, patch size and stride, but it always shows this error message. Did I misunderstand some points from the instruction? How can I solve this problem? Thanks very much in advance if you could help.

Best regards, Guojian

lorenzocerrone commented 3 years ago

Hi Guojian,

Sorry for the late answer but I was away last week.

Thanks for signaling this issue.

The problem is not in how you configured your setup but in the plantseg preprocessing. The image you mentioned is multichannel but plantseg does not work properly on single channel tiff images. So to run the pipeline on it, first you should split the tiff file in single channels images (you can use imagej open the tiff, image>color>split channels, export as tiff the cell wall channel).

Once you have you your single channel tiff file, you should be able to run plantseg on it without issues, but you might get the same error if the patch size in z is too small (should be equal/larger than 16).

I will fix this behavior in the next release of plantseg (either by a better error handling or by adding a channel selection option).

Best,

Lorenzo

e-tomato commented 3 years ago

Dear Lorenzo,

Thanks very much for your answers. I tried again with your suggestions, now it works well!

Best, Guojian