-
Notifications
You must be signed in to change notification settings - Fork 2
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
Rotating shape changes width and height of shape, why? #13
Comments
As stated in the README:
Unfortunately, the README is a bit inaccurate here. In fact, napari-roi always computes the rectangular bounding box (encoded as X/Y/width/height) for your shapes. Only in the case of rectangles aligned with the napari coordinate system, the bounding box is equal to the rectangle. By rotating your rectangle, the rectangle is not aligned with the napari coordinate system anymore, which means that napari-roi instead encodes the ROI as rectangular bounding box of your "diamond" (rotated rectangle). As for the weird arrays with black stripes that you mention, could you perhaps provide an example (screenshot) of that? |
movie_1.mp4With this video I am trying to explain the issue/question. |
Thanks for the video, that's really helpful! Unfortunately, this goes beyond the scope of napari-roi. The napari-roi plugin merely saves coordinates of shapes (more accurately: coordinates of rectangular boundings boxes of these shapes) into a table. The napari-crop plugin you are referring to, which does the actual cropping in your case, seems to be maintained by @haesleinhuepf et al. and is independent of napari-roi. Based on your video, I doubt that either napari-roi or napari-crop will be able to satisfy your use case. Cropping rectangles that are not aligned with the coordinate system of the original image requires a geometric transformation model (rotation, in your case), which implies a need for image resampling. Basically, you will first need to rotate (and resample) the image, and then crop it. Alternatively, depending on your downstream analysis, you could also keep working on the "bounding box-based crops" and just "mask out" (i.e., set to zero) the pixels outside of your regions. However, neither strategy is supported by napari-roi. I suggest to raise your general question in the image.sc forum, where you will hopefully get more helpful replies. |
Hello,
I am currently using the narapi-roi plugin to extract patches from images.
When I place the shapes, set width and height in the gui (typing in the numbers) and then rotate the shape (square or rectangle), it changes the width and height.
This I find confusing, a rotation should not affect the width and height of an object.
When I extract these rotated shapes, it produced weird arrays with black stripes at the site.
My intention is to only extract everything inside the blue outline of the shape.
Why would rotating the shape (I rotate by using the gui, handle-point on the shape) change the shapes width and height.
Is there a possibility to change this. I am somewhat depending on this, since I wish to properly orient and arrange my shapes within the image, this often requires rotating the shape.
Thank you very much for this helpful and convenient plugin.
Let me know if you need more information describing the issue I am having.
Thanks and best regards
Dennis
The text was updated successfully, but these errors were encountered: