Visible segment in 3D may have a None representation name

Please consider these steps:

  • add a volume in a new scene
  • in the segment editor, paint anything in a slice view
  • in the python console
    • seg = getNode("Segmentation")
    • seg.GetDisplayNode().GetPreferredDisplayRepresentationName3D() == None # True
    • seg.CreateClosedSurfaceRepresentation()
      • the segment becomes visible in 3D
      • the Show 3D button gets enabled, but
      • seg.GetDisplayNode().GetPreferredDisplayRepresentationName3D() == None # still True
    • Uncheck/check the 3D button
      • seg.GetDisplayNode().GetPreferredDisplayRepresentationName3D() == None # False

The same is observed with CreateBinaryLabelMapRepresentation(), except that the segment does not become visible in 3D (which is logical).

One would expect that GetPreferredDisplayRepresentationName3D() would not be None if there is a 3D display.

What are your views about that ?

As far as I can tell (probably I implemented this but more than 5 years ago), this member is to override the default representation that is shown in a certain type of view. I think None is an acceptable value, and it means that the default representation is shown.

Does this cause any issue for you?

Well, I discovered this unexpected state after observing a minor issue that can be easily fixed. There is no need to touch the core of Segmentation, I just wanted to collect a few point of views.

Thank you for yours.