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

Issue when we mix Rotate with BrushTool, EllipseRoiTool and RectangleRoiTool. #579

Closed
JamesAPetts opened this issue Sep 20, 2018 · 5 comments
Assignees

Comments

@JamesAPetts
Copy link
Member

JamesAPetts commented Sep 20, 2018

Steps to reproduce:

  • Open global example
  • Paint with the brush, draw a circlular ROI and an rectangluar ROI.
  • Select Rotate tool and rotate the image something like 45 degrees. All three tools are distorted.
  • Select Brush and try to use the tool. It will paint in the wrong place.
  • New Rectangles and ellipses can be drawn 'correctly' with the tilted angle, but when you rotate the image back, you don't get back what you intended to mark up.

For strict 90 degree rotations, the rectangle and circle stay intact. This is because the geometry is based off two control points, which reference a certain pixel, and are safe to rotation. Tools like angle, length, freehand and probe that only draw straight lines between control points are safe to rotation.

The brush renders incorrectly even with 90 degree rotations (try drawing around an object in the demo), and you cannot draw in the correct place. It seems to do some strange image flip, if you compare a rotate of a circular brush to an overlayed circular roi tool.

Thanks @galelis

@JamesAPetts JamesAPetts changed the title Issue when we mix Rotate with Brush tool Issue when we mix Rotate with BrushTool, EllipseRoiTool and RectangleRoiTool. Sep 20, 2018
@JamesAPetts
Copy link
Member Author

JamesAPetts commented Sep 20, 2018

Ok after some further deliberation with @swederik, I've come to the conclusion that the issues with the brush and the rois is identical, the only difference being that the brush segmentation isn't rotationally symmetric.

Let me demonstrate, I've drawn 4 'segmentations' that fill up the canvas, as well as a rect and circle:
screen shot 2018-09-20 at 11 10 54

Then rotating ~30 degrees clockwise, the image gets skewed:
screen shot 2018-09-20 at 11 11 38
It dissapears at exactly 45 degrees, at around 60 degrees the control points have flipped sides, and the image is rendered within those control points to the canvas:
screen shot 2018-09-20 at 11 12 00
At 90 degrees the circle and rectangle look as expected after a rotation, because they are rotationally symmetric. The brush tool isn't flipped as its control nodes are rotated, then the image is rendered within these nodes, so it looks the same as it did unrotated.
screen shot 2018-09-20 at 11 12 11

What is really needed is a rotation of the entire canvas. I'm going to play with transform of the tools in image rendered, but I feel this is a more fundamental issue. Tagging @chafey , as @swederik said you were the author of the rotation stuff in cornerstone core, do you have any insight into how we could fix this issue globally?

Thanks,
J

@JamesAPetts
Copy link
Member Author

Just confirming I'm now working on this.

@JamesAPetts
Copy link
Member Author

This is fixed for the brush layer for arbitrary rotations + h/v flips in #755.

The issues with the elliptical and rectangular ROI tools remain for now.

@dannyrb dannyrb removed this from the 3.x milestone Feb 5, 2019
daniel2101 pushed a commit to daniel2101/cornerstoneTools that referenced this issue Apr 25, 2019
@daniel2101 daniel2101 mentioned this issue Apr 25, 2019
3 tasks
JamesAPetts pushed a commit to daniel2101/cornerstoneTools that referenced this issue Apr 30, 2019
…t on free rotate.

The rectanglur and elliptical ROI tools now correctly rotate with the image.

cornerstonejs#579
@JamesAPetts
Copy link
Member Author

Thanks @daniel2101 for fixing the rectangles and ellipses in #916 ! :)

@prateekghosh
Copy link

Hey can you please help me out of removing the brush tool data from the canvas I didn't find solution for that.

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

No branches or pull requests

3 participants