question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Segmentation UI for VTKjs.

See original GitHub issue

Per IDC discussion yesterday:

We need the following 4 features for the segmentation panel whilst MPR 2D is open:

  • Show/hide segment.
  • Switch segmentation rendering options.
  • Jump to segment.
  • Switch segmentation.

Most of these operations require retreiving the API for the viewport, which can be grabbed from here:

https://github.com/OHIF/Viewers/blob/master/extensions/vtk/src/commandsModule.js#L103

Show/Hide segment

api.setSegmentAlpha can be used to set the segment alpha to 255 or 0. This is multiplied by the global alpha, so you can use this to show/hide segments. (In the future we may need a show/hide + individual segment opacity, but this will work for now).

Switch segmentation rendering options.

  • Most of these are passed down as props here.
  • Perhaps they should instead by API endpoints in the react-vtkjs-viewport, might have to have a look at how best to implement this.

Jump to segment:

We already have logic for finding the middle slice of the segment.

  • Look through this slice and find the mean voxel position of that slice for the segment.
  • Convert this voxel position to the world coordinates of the volume you can do this from the vtkImageData by getting its getIndexToWorld matrix.
  • Add 0.5, 0.5, 0.5 to the index, before converting to world coordinates, so that we may jump to the middle of the voxel.
  • On one API set the world position of the crosshairs, they are synced so this will update all 3 and jump the images to this location.
const api = apis[0];
api.svgWidgets.crosshairsWidget.moveCrosshairs =(worldPos, apis, 0)

Switch segmentation:

For this you’ll need to create+cache another labelmap volume in the process that ussually happens in extensions/vtk/src/OHIFVTKViewport.js when props are initially passed in, and then update the props. The react-vtkjs-viewport should already support the switching of volumes once this labelmap is changed, but this hasn’t had much testing/usage, so this may require some changes to the original library.

As this has not yet been discussed, we will leave out rendering of multiple segmentations in vtkjs for now, as this is a tricky and memory intensive issue that I don’t think is important for the MVP. CC: @fedorov

Could @fedorov / @pieper verify this is as discussed/good to work on?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
piepercommented, Apr 29, 2020

@pieper / @fedorov Unfilled segment with outline is currently priority or this should be left until later?

I’d say not a high priority compared to ironing out UI quirks.

1reaction
piepercommented, Apr 30, 2020

Let’s also keep in mind the option of having one offscreen render context and then blitting the results into the onscreen viewports. Probably simpler logic.

Read more comments on GitHub >

github_iconTop Results From Across the Web

LineSource | vtk.js - Kitware, Inc.
vtkLineSource creates a line segment from point1 to point2; The resolution can be specified, which determines the number of points along the line....
Read more >
Modules - cornerstone-tools
Segmentation. The segmentation module deals with centralisation of 3D labelmap data for each stack of cornerstone images. The data is centralized for two ......
Read more >
extensions/dicom-segmentation/README.md · master - GitLab
This extension adds support to view and navigate the segments available in the DICOM SEG, allowing control over visibility of a given ...
Read more >
2018-November.txt - Kitware
The button shows up in the UI and is able to be pressed whit the left mouse button, ... But I get the...
Read more >
How do I combine a slice image into a volume image after a ...
... (For Segmentation) in the Slice Image. Are there any examples or methods related to this? I found https://react-vtkjs-viewport.netlife.…
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found