Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmenting failure with diagonal pixels #481

Open
nickmesa opened this issue Mar 3, 2025 · 6 comments
Open

Segmenting failure with diagonal pixels #481

nickmesa opened this issue Mar 3, 2025 · 6 comments
Labels
question Queries about using tobac or how the code works

Comments

@nickmesa
Copy link

nickmesa commented Mar 3, 2025

It seems as though tobac struggles to fully identify and segment a feature if there are diagonal pixels adjacent to the "main" part of the feature. This leaves data unaccounted for, as it is not attached to this "main" feature, nor is it identified as a standalone feature itself. Are there any workarounds to this? Thanks!

@nickmesa nickmesa added the question Queries about using tobac or how the code works label Mar 3, 2025
@freemansw1
Copy link
Member

Can you provide a figure/example of what you mean here? Is your data on a regular square grid, or is the grid diagonal?

@freemansw1
Copy link
Member

Okay, this is what I get for trying to do this in the middle of the night. I think a figure would still help here, but I now understand the issue. The short answer is that no, we don't yet support that.

It would not be that challenging to add (and in fact we should probably add it to feature detection, too). We could allow a user-set parameter in segmentation that feeds into connectivity in skimage.segmentation.watershed.

I would be supportive of a pull request that added a capability like that, although I don't have bandwidth to add it myself at the moment. @nickmesa, I'd be happy to help you add it in via a pull request, though.

@w-k-jones
Copy link
Member

If I remember correctly, the labelling during feature detection does include diagonal connectivity (by default it uses connectivity 2 vs 1 for segmentation). This is another case of discrepancies between thresholding in feature detection which we should address. I agree with making connecitivity a customisable parameter, but I think the default should be connectivity=1 (i.e. no diagonal connections)

@freemansw1
Copy link
Member

If I remember correctly, the labelling during feature detection does include diagonal connectivity (by default it uses connectivity 2 vs 1 for segmentation). This is another case of discrepancies between thresholding in feature detection which we should address. I agree with making connecitivity a customisable parameter, but I think the default should be connectivity=1 (i.e. no diagonal connections)

Yes, that seems to be right (although the documentation is confusing). I am always hesitant to change defaults on science things without warning users. We will need to give ample warning, etc. Maybe the easiest thing to do is to expose this parameter (in segmentation and feature detection) to the user, keep the defaults the same for now, and start warning people to specify a parameter.

This could be a good tobathon topic, too, and something good to release post v1.6.0.

@nickmesa
Copy link
Author

nickmesa commented Mar 4, 2025

Image

Thanks for the feedback on this. I've attached an example here with gridded GLM group counts; you'll notice the largest feature on the bottom right "cuts off" part of what could subjectively be considered a continuation of that feature. I'd be happy to try working with the connectivity argument in skimage.segmentation.watershed to eventually support a pull request. Thanks again!

@freemansw1
Copy link
Member

Sounds great, @nickmesa. Two quick pitches for you. First, I'm happy to help with this; we can set up a zoom meeting or something. Second, we have a tobac hackathon (tobathon) next Friday morning; send me (or any of the core devs) an email and we can send you the link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Queries about using tobac or how the code works
Projects
None yet
Development

No branches or pull requests

3 participants