-
Notifications
You must be signed in to change notification settings - Fork 327
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
feat(Segmentation): Add contour representation for segmentations #384
Conversation
✅ Deploy Preview for cornerstone-3d-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
packages/core/src/RenderingEngine/vtkClasses/vtkStreamingOpenGLVolumeMapper.js
Outdated
Show resolved
Hide resolved
packages/core/src/RenderingEngine/vtkClasses/vtkStreamingOpenGLVolumeMapper.js
Outdated
Show resolved
Hide resolved
@@ -536,7 +553,7 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport { | |||
renderer | |||
); | |||
|
|||
vtkCamera.setIsPerformingCoordinateTransformation(false); | |||
vtkCamera.setIsPerformingCoordinateTransformation?.(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I must be missing something, but I am trying to understand how setIsPerformingCoordinateTransformation
is ever null such that the ?.
is needed. Plesase help me here - what am I missing? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a custom method we add to our custom camera, so it might be possible that the other camera (vtkCamera) is used and hence we don't have it
@@ -483,6 +500,107 @@ function vtkStreamingOpenGLVolumeMapper(publicAPI, model) { | |||
// mat3.transpose(keyMats.normalMatrix, keyMats.normalMatrix); | |||
} | |||
} | |||
|
|||
let lightNum = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you extract this into a separate function, that you document what the behaviour is? I THINK I almost understand what is going on here, but it feels like separating this into a function with it's own function comment block would actually make it understandable and sufficiently documented that one could fix things later. Otherwise it is close to read only code after committed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is vtk.js source code we copied here (helps to keep it this way for future diffs). When we upgrade to vtk.js 26.x and one bug that I worked on is fixed, we can completely remove this setCameraShaderParameters
packages/tools/src/tools/displayTools/Contour/contourDisplay.ts
Outdated
Show resolved
Hide resolved
return this.getPointsInAContour(contourIndex).length; | ||
} | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you still want to keep these commented line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I guess it shows what is the overal plan
packages/tools/src/tools/displayTools/Contour/removeContourFromElement.ts
Show resolved
Hide resolved
packages/tools/src/tools/displayTools/Contour/contourDisplay.ts
Outdated
Show resolved
Hide resolved
packages/tools/src/tools/displayTools/Contour/contourDisplay.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @sedghi. The changes overall look good. I like how contours parallel the label map
segments. I have a bunch of comments, but nothing earth shattering. Looking forward to seeing a running example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the one comment to add a comment on the contour set, it looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment change should be done. Consider the others.
0fb6b02
to
1f84a83
Compare
* @returns A boolean value. | ||
*/ | ||
export function isImageActor(actorEntry: Types.ActorEntry): boolean { | ||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider removing the outer parentheses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is the prettier, so we can discuss it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok np...
@@ -185,6 +185,10 @@ | |||
"doubleClickWithStackAnnotationTools": { | |||
"name": "Double Click With Stack Annotation Tools", | |||
"description": "Demonstrates double click detection before/during/after using various annotation tools on a stack viewport." | |||
}, | |||
"contourSegmentationRepresentation": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to move this next to the label map example?
packages/tools/examples/contourSegmentationRepresentation/index.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining feedback is optional. Good stuff!
1f84a83
to
d9cd7a8
Compare
Hey not sure if this is appropriate forum for this, but just wanted to say that I really appreciate the level of documentation for this PR as it made it quite straightforward understand the design choice. Awesome work on this! |
How did the contourSets data come from ? |
Continuing on the plan to add multiple representations for a segmentation, this PR adds the contour representation (read about representations here)
This PR add new geometryLoader which is supposed to deal with loading geometries and cache them. As the first geometry, this PR introduces contourSets and contours.
Since usually a set of contours represents an entity, a contourSet exists
Adding a contour representation is similar to adding a labelmap
Demo
https://deploy-preview-384--cornerstone-3d-docs.netlify.app/live-examples/contoursegmentationrepresentation
PS: Kudos to @rodrigobasilio2022 for polydata experimentation with contours