-
Notifications
You must be signed in to change notification settings - Fork 20
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
image_segmenter: Enable saving of verts or path coordinates for a image_segmenter object #263
Comments
One complication is how to deal with difference between erasing and drawing paths. Would probalby have to return something like
how's that sound? |
Yes thats probably an issue. But in the end the interesting output are just the coordinates of the final roi that one has drawn. The motivation here is that I can display that later onto the image I have drawn it on or any other image with the same dimensions for that matter. |
So you basically want the outline of a mask? Can you take the mask you drawn and take it's outline using some skimage functions? |
Yes thats also a solution. I just thought if its an easy fix to include the path coordinates as a property that would be cleaner. |
I guess my thought is that that is really two different red lines. Also how did you generate the red line, programaticcaly from verts? If there is an easy way to combine the paths into one shape that I'm not aware of I'd be stoked to include that |
I thought about this a bit more and while there is a based on your image i think what you want is contours which should be easy to create directly from the mask: borrowing from this example I did this fig, ax = plt.subplots()
contours = measure.find_contours(segmenter.mask)
ax.imshow(segmenter.mask)
for contour in contours:
ax.plot(contour[:, 1], contour[:, 0], linewidth=2, color='r')
which gives this: |
I generated them like this (in a Jupyter-lab notebook):
Call that in a new cell to draw the ROI:
Save the verts as a list in a new cell:
Set erase to True in a new cell:
Go back to cell that calls bar and execute that:
Draw a erasing ROI on it and then save that into a new parameter in yet another cell:
Plot the mask and the boundaries:
|
Thanks for pointing this out, that makes the most sense to me actually. Will try to implement it like this. |
I wrote a function that accomplishes extracting the contours from the mask, where would you place such a function within the package? Into generic.py under the segmenter? |
Problem:
Paths of the ROIs are not returned by image_segmenter
Explanantion:
After segmenting an image, the .verts attributes are not saved. It would be good to access them later, not just the mask.
Proposed Solution
Add the verts and the paths of the drawn ROI as a property to an image_segmenter object. Similar to mask.
The text was updated successfully, but these errors were encountered: