Capture 3D view into PNG file with transparent background not working as expected

I have a 3D image which I want to take a screenshot of, I do not want to have the background or the axes (I, R, S) or purple lines when I save the image. The current state looks as follows:

I have run the ‘Capture 3D view into PNG file with transparent background’ script by saving it in a Python file and then running exec(open('./Users/me/Downloads/save.py').read()) in the Python console in Slicer (see screenshot).

However, the screenshot which is output does not have the current 3D view, and does not have a 3D background or hidden axes:

What can I do about this?

You need to ise the orthogonal prpjection

1 Like

Sorry I’m a bit new to this software- what does this mean?

Click on the pin icon on the upper left view and click where there is a cubb
Let me know if that helps

1 Like

You can configure the view with something like this:

    slicer.app.layoutManager().threeDWidget(0).viewLogic().GetViewNode().SetBackgroundColor((0,0,0))
    slicer.app.layoutManager().threeDWidget(0).viewLogic().GetViewNode().SetBackgroundColor2((0,0,0))
    slicer.app.layoutManager().threeDWidget(0).viewLogic().GetViewNode().SetBoxVisible(False)
    slicer.app.layoutManager().threeDWidget(0).viewLogic().GetViewNode().SetAxisLabelsVisible(False)
2 Likes