Show/hide segment surface in 3D view

I created a segment, and I confirmed its master representation is Binary labelmap.

I then created surface by pushing the button “Create surface” in Segment Editor. I noticed that having a 3D surface rendered while performing editing in-slice leads to a noticeable slow-down of editor interactions, so I was looking for an option to disable surface rendering in 3D view, but I could not find this option.

I can un-click “Create surface” button (as aside, it is somewhat non-intuitive to me that “create” button acts as a checkbox) - the surface is gone from 3D view, but apparently it is also deleted and if I click “Create surface” it is being re-generated, since there is a noticeable delay.

The “eye” button in the segments list disables both segment overlay in slice and its rendering in 3d view. If mouse over the “eye” I see some mention of advanced visibility options, but long press does not trigger any such options (or maybe I need to press in some specific location of the button? there is no hint in its appearance about the advanced capability).

image

As a suggestion:

  • I think “Create surface” should not be checkable, or if it stays checkable, its title should change to something else other than “Create surface” after surface has been created (“Delete surface”?)
  • I think it would be helpful to be able to control visibility of the segment surface in 3d view without having to delete the surface.
  • Tooltip for the eye icon in the segments list appears to be inconsistent with the actual behavior.

Tested with the latest available nightly of Slicer on mac - Aug 1.

@cpinter just wanted to make sure you saw this

  • Makes sense, we can change the name of the button. @lassoan please comment, as you had pretty strong opinions about this button earlier
  • The surface is not “deleted” and “created”. This is a very important feature of Segmentations (see Validity problem in slides), that the non-master representations are either up-to-date, or invalidated (removed so that they are re-created on demand). When you edit the labelmap, the surface becomes invalid immediately, and needs to be updated.
  • I’ll fix it, this used to work. Two other ways to hide/show the surface
    • Segmentations module Display section
    • Subject hierarchy right-click on the eye icon in the row of the segmentation
1 Like

2 posts were split to a new topic: How to use masking in Segment editor

@fedorov As it turns out about the third point, the options are there, but the flag that determines whether the advanced options are visible is false by default, but the tooltip was set nevertheless. What I did so far was to set the tooltip only if the advanced options are available.

As far as I remember we kept it disabled by default to avoid further clutter. Thoughts?

Makes sense, we can change the name of the button. @lassoan please comment, as you had pretty strong opinions about this button earlier

We already got feedback about the misleading button name (state button has action name) and I agree we should change it. The name should clearly indicate that it toggles closed surface representation (and not just hides/shows it) but otherwise I don’t have any strong preference.

I don’t think it adds much clutter, since it will not be shown by default. I assume you meant to add a little drop-down hint, as done in slice views link button? This by far would be a lot more convenient than the other options you mentioned to control surface view by going to other modules.

I definitely don’t know what is happening under the hood, but from the user perspective, if I un-click “Create surface” button, and then click it again right away (i.e., the representation does not change in between, so I would expect it to be up-to-date), there is a significant delay until I see the surface again in 3d view. It looks like the surface is re-generated, but perhaps it should not be if it didn’t change. You should be able to easily reproduce the delay by thresholding a whole body CT to make a segment.

I did find the other option to control 3d view in Segmentations. It shows up faster when I re-enable it, but there is still some delay.

The issue with the long-press dropdown was that we often activated those advanced visualization options unintentionally and that slowed down the operation. Also, keeping closed surface representation but not showing it should be discouraged, as you would still need to wait for the closed surface representation to be computed but you would not see the result. Implementing background conversion between representations would be nice and we plan to do it in the future, but it is quite low priority.

We could easily add segmentation display options to the Segment Editor module, but it would make an already complex module even more complicated (similarly, it would be useful to have segment import/export directly there…). Do you think we should merge Segmentations module features into Segment editor? Or fuse the two modules into one?

I think for now we should focus on making it more clear what the show/hide icon and Create surface buttons do. What do you think about keeping the button as a checkbox but change the title to simply 3D or Show in 3D?

I see. I don’t see this as a real use case, but we can certainly not delete it just hide it.

For sure. What we could also do is to add these options to the segment right-click menu as well. I don’t see any disadvantage of exposing this option in multiple places, especially if (as you also seem to agree) the long-press option is disabled by default. Currently the only action in that right-click menu is “Show only selected segments”. We could add the 2D outline, 2D fill, and 3D visibility options as well.

Actually this will be problematic after all. If we hide it but keep the representation, then after every editing step the conversion will still take place. According to the original design this should not be the case, but apparently some part of the code requests the surface so it’s re-generated.

Can you tell us whether this quick show/hide of only the surface while keeping the 2D is a general request, or is it annoying in a specific use case?
Would it be enough to show/hide the segment or the segmentation?

You might want to think about use cases where the user does not need to always see all of the segments. If you, for example, work with an atlas, you need to toggle visibility of individual structures, out of hundreds, while, for example, editing one single segment. If the segments are not edited, there should be no need to recompute the surface.

I don’t think the user should be discouraged from certain actions based on how things are implemented. They will see the performance hit, and will adjust their actions accordingly. But there should also not be unnecessary performance degradation where it is not needed, such as toggling surface visibility.

Sometimes I ask myself the same question, but I see good and bad either way… Maybe as a compromise to help users in the short term, add a shortcut button to jump directly to Segmentations from Segment Editor, and give some hint about what capabilities are available from there?

@cpinter the example I provided is not a real use case, but just a simple way to reproduce the problem.

The specific situation where I came across this is the following. I played with brain MR images to segment the tumor. I had surface rendering enabled, and noticed that there is a delay in applying Segment Editor effects. So I thought if I disable surface rendering, I can do editing more quickly, and then show the surface again after I am done. That’s when I noticed that even if I don’t touch the segment, and change my mind and need to look at 3d again after looking around in 2d, I get this delay.

It’s definitely not a stopper. Should I file a bug report about the fact that surface is re-generated when segment is unchanged? As I mentioned earlier, the behavior in show/hide of surface is different between Segmentations and Segment Editor, so maybe making those consistent is a good task to tackle, whenever there are cycles.

I like this idea.

True, validity could be handled on a per-segment basis. Unfortunately this would be a considerable implementation task, as representations are currently handled per-segmentation, and this change would require moving all the master representation and conversion related logic to the vtkSegment level. Imagine the segments and representations the rows and columns of a table. Now we can only remove whole rows or columns, but after this change we could remove individual cells. It’s a major change in the code, especially considering all testing and bugfixing etc.
A relatively easy way I see to support this is a specialized segment editor, where you have your atlas, and you edit one segment at a time. So basically we would have two segmentations: the atlas, and the edited segment only.

We tried and found the same. We’ll investigate, as there should be no delay in simply showing a segment in 3D.

Summarizing the definite actionables so far:

  • Rename Create surface button (“Show 3D” ?)
  • Investigate slow show/hide of only the surface representation
  • Add button to Segment Editor to switch to Segmentations. Its name TBD. The tooltip should mention visibility options, import/export, conversion parameters. Maybe long-click for quick export?
1 Like

@cpinter thank you for the detailed explanation and suggestions! This all makes sense to me.

Yes, a shortcut for quick export would probably be helpful, considering how often this question comes up.

Just referencing the PR which contains the changes requested here:

1 Like

PR above integrated in
https://github.com/Slicer/Slicer/commit/36fe64b16734c962156c5f574280a6fa7b9cccb6

Show/hide segmentation performance issue fixed in
https://github.com/Slicer/Slicer/commit/0a4374c08b401d23f88159ee45ae2dc81243205d
Tested on the brain atlas. Hiding the segmentation is faster than hiding the model hierarchy, and show seems to take the same amount of time.

1 Like