ianhi / ipysegment

manual image segmentation widget for jupyter
BSD 3-Clause "New" or "Revised" License
14 stars 1 forks source link

Output data #11

Open PatricioUQ opened 2 years ago

PatricioUQ commented 2 years ago

Hi,

I am trying to use this in a notebook running on VS code. It seems to be working, however, not sure how to get out (or to see) what I have segmented. I am relatively new at python.

Cheers,

PPM

ianhi commented 2 years ago

Hi @PatricioUQ

It's not really clear from the example: https://github.com/ianhi/ipysegment/blob/master/examples/introduction.ipynb

but you need to first call w.gimme() to sync the data back to python. Unfortunately due to limitations in ipython (hopefully fixed in the nearish future) there is no way to block until the data is synced back. After that you can access the data as w.data

that said - now that I look back at this I think it was irresponsible to publish this as is. I need to either remove it from pypi or else put some effort in updating it to be more functional. As it stands it's not really fully functional and completely undocumented. I haven't pushed on developing it much because now I always use the napari labels layer to annotate image masks. It is by far the best python based mask drawer that I have found. On top of that I generally add a set of keybindings that I think make it excellent for drawing masks. You can see those here: https://github.com/Hekstra-Lab/napari-labeller/blob/main/src/napari_labeller/_keybinds.py

ianhi commented 2 years ago

What's your use case?

I need to either remove it from pypi or else put some effort in updating it to be more functional

Updating this is definitely something I want to do - it's just unfortuntaely one of those things that has always been on the backburner. I'd also happily accept PRs.

I think I currently want to move to inherit from ipycanvas, then we could make use of this: https://ipycanvas.readthedocs.io/en/latest/retrieve_images.html#get-image-data-as-a-numpy-array

and even loftier goals are to make much better drawing based on http://fabricjs.com/ which would make it much easier to focus on integrating in jupyter, rather than re-implementing a drawing app from scratch

PatricioUQ commented 2 years ago

Hi ianhi,

Thank you for your fast reply.

To be honest, your tool is exactly what I need: the simplest possible tool to manually segment/crop images (np arrays). I think I will give it a go and see if I can make it work in my project as it is (without you needing to update anything). If this doesn't work, I will try napari as suggested.

Cheers,

ianhi commented 2 years ago

ack! I completely forgot to mention my other tool that also accomplishes this simple task. It is: https://mpl-interactions.readthedocs.io/en/stable/examples/image-segmentation.html

Pros:

  1. it's matplotlib based so it will also work outside of notebooks (works in notebooks with ipympl)
  2. data lives in python first so no syncing issues
  3. You can throw arbitrary matplotlib stuff onto the plot to guide you if you want

Cons:

  1. Worse performance than this (that bad performance actually inspired creating this)
ianhi commented 2 years ago

I think I will give it a go and see if I can make it work in my project as it is (without you needing to update anything).

@PatricioUQ have at it! Though to be clear I'm happy to update things, just hasn't been a priority. If you run into any issues or ways you could see to improve it please feel free to open issues, if I don't know about an issue then I can't fix it ;)

PatricioUQ commented 2 years ago

Thanks, I will keep you posted