How to output the image to slicer view?

Dear everybody:

I am following the tutorials on “Programming in Slicer4” implementing the demo “Implemen:ng the
Laplace* Operator”. Everything is fine. The problems come out when I tried to modify the program using C++. Currently I have difficulties in converting the following lines into C++. I can’t find the corresponding class and method in C++.

# make the output volume appear in all the slice views
slicer.util.setSliceViewerLayers(background=self.outputSelector.currentNode())

Would any body help me out?

Thankyou very much

Hi - In general it can help to use the git grep command in the source directory to search for the definition and uses of methods. Or you can search the repository at the github page.

In this case, the method is define here:

Thank you very much!

I have solve this problem and have my C++ version of this “Implementing the Laplace* Operator” demo. :slight_smile:

You have introduced a good way of using “git grep”. That’s nice. Before your recommendation, I have tried to use grep in Ubuntu and “findstr” in Windows. I failed to get the correct answer because I searched in a wrong directory. I thought the function “setSliceViewerLayers” was a member function of some MRML classes.

Thank you. And I think it would be better to have the c++ version of this tutorial later on.