How to load/add data onto Slicer through its API?

Hi is there a Slicer API that loads png, jpg, or any other common file format to Slicer. I know you can go to the ‘Add data into the scene’ to do it manually, but I want to try to include this to be automatic on my python script as well.

Thank you.

You can use the loadVolume function - see examples in the script repository.

Thank you. Also is there a way you can automatically display only the 3D panel?

Yes, see examples how to switch layout in the script repository (search for setLayout).