Skip to content

Create bounding-box ROI from label images #132

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

Closed
jluethi opened this issue Oct 11, 2022 · 4 comments
Closed

Create bounding-box ROI from label images #132

jluethi opened this issue Oct 11, 2022 · 4 comments
Labels
Priority Important, but not the highest priority Tables AnnData and ROI/feature tables

Comments

@jluethi
Copy link
Collaborator

jluethi commented Oct 11, 2022

New task: Take a label image and create new ROIs based on the bounding boxes of objects. Useful e.g. for organoids after organoid segmentation in 2D.

See #45 for issues we'll need to handle regarding overlap

@jluethi jluethi added this to the ROIs arbitrary objects milestone Oct 11, 2022
@jluethi jluethi added the Priority Important, but not the highest priority label Oct 13, 2022
@tcompa
Copy link
Collaborator

tcompa commented Nov 7, 2022

Preliminary plan, with @mfranzon:

  1. Consider example input like this one.
  2. Write a function that takes a label array (2D/3D array of integers) and extract all (2D/3D) bounding boxes.
  3. Use this function in another function that simply writes new bounding-box ROIs to a AnnData table in the zarr array. This first version does not perform any check on overlaps.
  4. Include this function at the end of cellpose_segmentation (first) and napari_workflow_wrapper (later one, once it's polished).
  5. Add a check for overlapping bounding-box ROIs. By now we should just raise a warning - see Establish ROIs for organoids #45 for more about this.

@jluethi
Copy link
Collaborator Author

jluethi commented Nov 7, 2022

I like this plan. Step 4 should be optional, because I'm not sure if we want to have ROI tables for all segmentation outputs and we certainly may have napari workflows where we don't need the ROI tables.
Because ROI tables are light-weight, we can default this to True, create ROI tables by default. Will be interesting to explore whether ROI tables are also useful for single cells (many more than organoids) and whether the whole architecture scales well for having 1000s of ROIs. If not, we can turn if off by default.

Regarding 1) and ignoring overlap for the moment: Good start. But if we want to test processing by ROI afterwards, we'll have to look at an example where there is no overlap. We may have one from Max from the Zebrafish that I'm currently testing, will report back if it's suitable. But we anyway need to ROIs calculated & parsed first :)

@tcompa
Copy link
Collaborator

tcompa commented Nov 8, 2022

Write a function that takes a label array (2D/3D array of integers) and extract all (2D/3D) bounding boxes.

By now we don't need to support 2D arrays, since both cellpose_segmentation and napari_workflow_wrapper return their 2D label output as 3D arrays (in cellpose_segmentation this is always true, in napari_workflow_wrapper this takes place at a certain point during the output handling).

If it is needed for some use case, we can always include an explicit handling of 2D arrays later.

tcompa added a commit that referenced this issue Nov 9, 2022
ref #132, add preliminary implementation of bounding box
@tcompa
Copy link
Collaborator

tcompa commented Nov 9, 2022

Closed by #192.

Re: overlapping bounding boxes, at the moment we simply raise a ValueError. The future steps are part of:

@tcompa tcompa closed this as completed Nov 9, 2022
Repository owner moved this from TODO to Done in Fractal Project Management Nov 9, 2022
@tcompa tcompa added the Tables AnnData and ROI/feature tables label Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority Important, but not the highest priority Tables AnnData and ROI/feature tables
Projects
None yet
Development

No branches or pull requests

2 participants