georgeoshardo / SyMBac

Accurate segmentation of bacterial microscope images using deep learning synthetically generated image data.
https://doi.org/10.1186/s12915-022-01453-6
GNU General Public License v2.0
19 stars 9 forks source link

Resizing Masks #48

Open kmpape opened 3 months ago

kmpape commented 3 months ago

I observed that after resizing, some masks that were not touching before do touch. I think that this happens on the following line:

https://github.com/georgeoshardo/SyMBac/blob/9513c2cb4dced2f9ae64591627185b9baae79e5f/SyMBac/renderer.py#L403

Is that correct? There are functions to resize and prevent touching, e.g., function resize_mask from delta.imgops.

georgeoshardo commented 3 months ago

Yes it's possible that masks could touch after a resize, especially depending on how the connectivity is defined, and because I assume you're using binary masks because of DeLTA?. If you want to avoid it with a quick fix, I recommend generating data with labelled masks (which are allowed to touch) and then iterating through each mask and doing morphological erosion on them one by one, then convert to binary, and re-label, with an assertion that there are the same number of masks as before.

On Thu, 8 Aug 2024, 15:27 kmpape, @.***> wrote:

I observed that after resizing, some masks that were not touching before do touch. I think that this happens on the following line:

https://github.com/georgeoshardo/SyMBac/blob/9513c2cb4dced2f9ae64591627185b9baae79e5f/SyMBac/renderer.py#L403

Is that correct? There are functions to resize and prevent touching, e.g., function resize_mask from delta.imgops.

— Reply to this email directly, view it on GitHub https://github.com/georgeoshardo/SyMBac/issues/48, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACFKIX2QDLYXAYTHULFPVYDZQN535AVCNFSM6AAAAABMGTUMMOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ2TKOJVGM4DGNA . You are receiving this because you are subscribed to this thread.Message ID: @.***>