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

How to handle points in batchsamize #30

Open
carlosuc3m opened this issue Dec 1, 2024 · 2 comments
Open

How to handle points in batchsamize #30

carlosuc3m opened this issue Dec 1, 2024 · 2 comments

Comments

@carlosuc3m
Copy link
Contributor

I need to understand how point rois work on imagej.

Can i add the point rois to the ROI manager?

Right now the "batch" prompts can come at the same time from the point and rect prompts that are drawn on the image, the prompts that have been added to the roi manager (if the roi manager has rois of the image of interest) and if it exists, from a mask image.

My problem is that i do not understand if point prompts can be added to the roi manager, in that case, should we treat a single multipoint ROI as a single object instance?

This differs a little bit with the behaviour of multipoints that are not added to the roi manager, in this case each point in the mulitpoint roi is treated as a single object.

In my opinion, we shuold follow the approach that users use the most

@xulman
Copy link
Contributor

xulman commented Dec 2, 2024

First of all, I'm not sure if it is a wise idea to use ROI manager to hold both the input ROIs upon which acts the batchsamize that, in turn, will produce output ROIs into the very same ROI manager...

I know we can differentiate the ROIs e.g. in their names but still... a big mess

And I don't feel comfortable with the idea that input ROIs after they are processed shall be removed from the ROI manager (not to mess up later with the obtained output ROIs)

@xulman
Copy link
Contributor

xulman commented Dec 2, 2024

If the purpose of the input ROIs is to act as "building blocks" for prompts for SAM, I would probably rather instead of ROIs in ROI manager use a mask image:

  • The mask image is persistent, one reads it to build prompts but don't modify it (as there's no need to modify it)
  • The mask image permits to hold pixels of different values, which we can use as follows:
    • All pixels of one color are meant to be part of one prompt
    • Single pixel means point, connected component (aka many touching pixels) builds rectangular prompt

Examples of mask content and how it maps to prompts:

  • single point prompt = one pixel of a unique label in the mask image
  • multiple points prompt = several solo pixels (solo = being surrounded by pixels of different values) all of them of the same label
  • single rectangular prompt = one connected component of size > 1, take AABB (axes-aligned bounding-box)
  • error = several connected components of sizes > 1 for the same label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants