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

Better conversion from napari Shapes to Rois #84

Merged
merged 2 commits into from
Oct 7, 2024

Conversation

multimeric
Copy link
Collaborator

Closes #63.

@multimeric
Copy link
Collaborator Author

Some manual verification would be great here, because although it doesn't throw an error anymore, I want to be sure that it's producing the correct output.

@pr4deepr
Copy link
Collaborator

pr4deepr commented Sep 30, 2024

The error doesn't happen but the coordinates are incorrect.
They are in scaled micron space and not in pixels anymore..

It needs to be transformed in x and y by dividing by dx or dy

For example, if I look at an ROI and view the coordinates in napari, I get:

[array([[206.17889806, 132.66785635],
[206.17889806, 163.98616998],
[240.97702431, 163.98616998],
[240.97702431, 132.66785635]])]

~ cropped image shape is about (150, 35, 31)

but, this is scaled in microns. The actual coordinate should be divided by deskew.dy so the coordinates are in pixels, which will match the actual location in the array. The bbox ROI values should actually be:

array([[1421.92343489, 914.95073342],
[1421.92343489, 1130.93910328],
[1661.91051251, 1130.93910328],
[1661.91051251, 914.95073342]])

~ Actual cropped image shape: (150,216,240)

If I run the cropping, I get a really small image as it uses the bounding box coordinates in microns to perform the cropping.

@multimeric
Copy link
Collaborator Author

Thanks, should be fixed now.

@pr4deepr
Copy link
Collaborator

pr4deepr commented Oct 2, 2024

Cropping works fine in the plugin.
However, now, if I select an ROI in the plugin:

image

and run the cropping, its always the first ROI in the list that gets processed. In the earlier
First ROI in the list is highlighted by a red box below and the processed ROI is the green image on the top

image

@multimeric
Copy link
Collaborator Author

I don't follow. Is the selected shape supposed to impact cropping?

@multimeric
Copy link
Collaborator Author

TODO:

  • Modify the ROI selector to list all shapes from all layers, rather than just listing shape layers
  • Synchronise the shape selection with the ROI box
  • Warn user in the preview box if multiple ROIs are selected

@multimeric
Copy link
Collaborator Author

Splitting the shape selection issue into a separate PR.

@multimeric multimeric mentioned this pull request Oct 7, 2024
3 tasks
@pr4deepr pr4deepr merged commit e20ec1b into BioimageAnalysisCoreWEHI:master Oct 7, 2024
5 checks passed
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

Successfully merging this pull request may close these issues.

Small ROI Bug
2 participants