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

Planar freehand roi tool #89

Merged
merged 33 commits into from
May 3, 2022
Merged

Planar freehand roi tool #89

merged 33 commits into from
May 3, 2022

Conversation

JamesAPetts
Copy link
Member

@JamesAPetts JamesAPetts commented Apr 29, 2022

WIP Planar Freehand ROI Tool.

  • Still need to fix some issues so the api docs will build.
  • One crossover issue left/interaction issues to fix.

More features to come in a different PR.

Live example: https://626f9a9da152cf7e6d378757--cs3d-docs.netlify.app/live-examples/planarfreehandroitool

Deploy preview: https://626f9a9da152cf7e6d378757--cs3d-docs.netlify.app/

@JamesAPetts JamesAPetts requested a review from sedghi April 29, 2022 17:07
*/
export default function drawPolyline(
svgDrawingHelper: any,
toolName: string,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm reviewing toolName as argument in my PR (ArrowAnnotate), so if yours goes first, it is fine, otherwise, we should remove this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make this change once your PR is merged.

topRight: Types.Point3;
bottomLeft: Types.Point3;
bottomRight: Types.Point3;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does PolyLine support textBox? I didn't see it in the demo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't yet as that isn't in scope for my client's piece of work at this moment. I believe. However its here because it inherits from Annotation, and it would be more painful to make it not inherit and be different from everything else for now. I'll add a comment, I think it will come in a future PR at some point.

* Returns `true` if the point `p` can project onto point (`p1`, `p2`), and if
* this projected point is less than `proximity` units away.
*/
const pointCanProjectOnLine = (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function name does not match its output, I expected a boolean output, but it is number | false

const p1 = previousPoint;
const p2 = viewport.worldToCanvas(points[i]);

const distance = pointCanProjectOnLine(canvasCoords, p1, p2, proximity);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

distance = pointCanProjectOnLine( seems weird, since it is used later as a boolean check maybe do canProject or just if (pointCanProject...)

const pStart = viewport.worldToCanvas(points[0]);
const pEnd = viewport.worldToCanvas(points[points.length - 1]);

const distance = pointCanProjectOnLine(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@sedghi
Copy link
Member

sedghi commented May 2, 2022

Looks like an awesome tool. Had couple of comments, please see them.

More general comment:

  • Color green on mouse hover gives an impression of edit mode, and that is correct. But for a newly drawn contour that is not the case, even if the mouse is so far it is still green (since it is in the selected mode). How about we set the contour as yellow (unselected) when it is finished drawing?
2022-05-02.12-18-12.mp4

@JamesAPetts
Copy link
Member Author

JamesAPetts commented May 3, 2022

Hmmmm. For your last comment/video, I think this is more of an issue of our default color selection for Cornerstone3D. All Cornerstone3D annotations currently go to selected state after being drawn, which I think makes sense?

We are using the same color for selected and highlighted, when they mean semantically different things, for all annotations. You can only grab and interact in the highlighted state, not the selected state 🤔 .

Maybe our default on CS3D should have a different color/shared for selected, we don't demonstrate this well at all.

@JamesAPetts
Copy link
Member Author

Worked on some comment, still need to resolve more.

@JamesAPetts JamesAPetts requested a review from sedghi May 3, 2022 16:03
Copy link
Member

@sedghi sedghi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sedghi sedghi merged commit 0067339 into main May 3, 2022
@swederik swederik deleted the planarFreehandROITool branch June 15, 2022 07:17
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.

3 participants