Show slice intersection line only in specific view

Hi all,

I would like to show intersection line of 2D view only in Axial view.
I tried codes below, but it still remain other view.

Could I get sloution about this ?

    def intersectionOnOff(self, flag):
        sliceDisplayNode9 = slicer.app.layoutManager().sliceWidget("Slice9").sliceLogic().GetSliceDisplayNode()
        sliceDisplayNode10 = slicer.app.layoutManager().sliceWidget("Slice10").sliceLogic().GetSliceDisplayNode()
        
        for sliceDisplayNode in [sliceDisplayNode9, sliceDisplayNode10]:
            sliceDisplayNode.SetIntersectingSlicesVisibility(flag)
            sliceDisplayNode.SetSliceIntersectionThickness(10)

        sliceNode = slicer.util.getNode('Slice8')
        sliceNode.Modified()

If the views are linked, then changing one will affect all the rest. Make sure linking is off when you set this.

Hi Casba

Thank you for your reply

Could you give a advise more specific (plz with codes snippet) ?

I would like to remove the lines in Yellow and Green view showed in below figure

You need the opposite of this one
https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#set-all-slice-views-linked-by-default

Hi Csaba

I tried codes like below

When the Slicer first start the lines only on ‘Slice8’ (what I want), but start moving the slice, the other lines showed up in “Slice9” and “Slice10”

  for view in ["Slice9", "Slice10"]:
  
      sliceLogic = slicer.app.layoutManager().sliceWidget(view).sliceLogic()
      sliceDisplayNode = sliceLogic.GetSliceDisplayNode()
      sliceDisplayNode.SetIntersectingSlicesVisibility(flag)
      sliceDisplayNode.SetIntersectingSlicesLineThicknessMode(1)
      
  sliceCompositeNodes = slicer.util.getNodesByClass("vtkMRMLSliceCompositeNode")
  defaultSliceCompositeNode = slicer.mrmlScene.GetDefaultNodeByClass("vtkMRMLSliceCompositeNode")
  if not defaultSliceCompositeNode:
      defaultSliceCompositeNode = slicer.mrmlScene.CreateNodeByClass("vtkMRMLSliceCompositeNode")
      defaultSliceCompositeNode.UnRegister(None)  # CreateNodeByClass is factory method, need to unregister the result to prevent memory leaks
      slicer.mrmlScene.AddDefaultNode(defaultSliceCompositeNode)
  
  sliceCompositeNodes.append(defaultSliceCompositeNode)
  for sliceCompositeNode in sliceCompositeNodes:
      sliceCompositeNode.SetLinkedControl(False)
      sliceCompositeNode.SetHotLinkedControl(False)
          
  sliceNode = slicer.util.getNode('Slice8')
  sliceNode.Modified()

Hi all,

I posted a question last time but did not get solution, so I’m posting it again.

I created four 2D slice views looks like the video below.
Among these, I only want to display the intersection view in the axial window.

To achieve this, I tried changing the visibility to 0 or modifying the LinkedControl as shown below, but I observed that the intersection line reappeared when I moved the slice.

  1. sliceDisplayNode.SetIntersectingSlicesVisibility(0)

  2. sliceCompositeNode.SetLinkedControl(False)

Additionally, I performed SlabReconstruction on the leftmost panoramic view, but the line corresponding to the slab appeared, which interferes with the visualization.

Therefore, my questions are as follows:

  • How can I display the intersection line only in the axial view?

  • How can I remove the lines related to the slab?
    (When I enable slab reconstruction with sliceNode.SetSlabReconstructionEnabled(True), the line is generated, and I couldn’t find a way to turn it off.)


  • In addition, How can I change the thickness of the intersection line?
    (sliceDisplayNode.SetIntersectingSlicesLineThicknessMode(2) does not work.)

I suspect nobody has tried these exact features before so nobody has an out-of-the-box answer for you. But I think you can figure this out by digging into the code a bit - what you describe shouldn’t be that much different from other view-specific visibility controls. It would be best if you find a way to generalize the implementation in Slicer so these are easy to control, so if you can find a good architectures please contribute back, but since you are building your own custom app, you can even control these in an application-specific way that you keep in your codebase.