Set slice intersection doesn't work

This works on the python console:

nodes = slicer.util.getNodesByClass('vtkMRMLSliceCompositeNode')
for node in nodes:#Corrected this line and the one below because of bad indentation
  node.SetSliceIntersectionVisibility(True)

But if I append it to the onEntry function of my extension it doesn’t work. Why does this happen?

When you enter your module, enter() method is called, not onEntry. Indentation in your code snippet is also incorrect (second line should be indent level should be the same as the first). If these hints don’t help then set up a debugger and place a breakpoint in the method and inspect what is happening exactly when the method is executed.

Hi Andras. Thanks for your answer. I took your advice of using Code to debug and I tried it in this case but I didn’t had success finding the cause of this error (I checked that the code executes not too early like the other day).

Here it is the line that is causing trouble if you want to check it out:

Do you mean you get an error message when you run this line?
What is the error message?

When I said error I refer to an unexpected behaviour (that is: nothing happens).
The problem is when I execute those lines nothing happens and it should show the slice intersections.

Take advantage of your debugger. Step through your code, see how many composite nodes it finds. Add breakpoints to all the lines in all the files where SetSliceIntersectionVisibility is called (maybe after you enable visibility somewhere else it gets disabled). Add breakpoints at various other places in the code and iterate through the composite nodes and see if intersection visibility is still enabled - you should be able then find what makes the intersections hidden.

1 Like

Thank you Andras. I was able to find the problem: The onEntry function of Step5 was called before it was needed on the onExit function of Step4 so then the changes I setted up were being overwritten

1 Like