Change size of pictures with SlicerFab


I’m working on a project, I need to add my .stl file and convert this file into an image set with the extension SlicerFab.
But when I “generate bitmaps”, the pictures I obtain are too zoomed, how can I change the pictures size to get a full picture of a slice ?

Thank you for your help,


Hi -

The DPI settings and output scale exposed in the UI should let you control the zoom level.

Currently the size of the bitmap is hard coded to 1k x 1k. If needed you could edit the code to try different values. Those parameters could be exposed in the UI with a little coding.

Thanks for helping me, sorry but I’m not used to 3DSlicer, how do I edit the code ?
I’ve tried by pressing CTRL - 3 and just copy past what you gave me but it isn’t working.
And what’s the UI ?

Yes, editing the code is a bit of an advanced topic, but in this case it should be pretty easy and will let you experiment. First, you should turn on Developer Mode (Edit->Application Settings->Developer enable check box) and then restart Slicer. Then when you enter the module you should have an Edit button that will bring up a text editor with that module’s code. Find the lines I linked to and change the numbers. Save the file and click the Reload button in the module.

By UI, I meant the User Interface. The width and height values are hard coded, but widgets could be added to make them configurable like the other parameters.

Until now, I’m in the module SlicerFab, I can see the Edit button but when I click on it, nothing happens (I followed your instructions step by step from the begining. I have the Python interactor at the bottom but I think this is not what I need.
Do I need a software to open et edit the source code ?

You only need a text editor to change the python code. It should pick your default when you click Edit, but it depends on your configuration. If you look in the error log there’s probably some message about what file it tries to open, and if you can edit that file manually the rest of the steps should work. Or you can just search for the file named in your Slicer install and edit it there.

It works !!!
I have just found the file and change the pixel number.
Thank you so much for your help !


I’m not sure why we never exposed those fields in the user interface, but in case anyone feels it’s needed, it’s a pretty boilerplate feature to add just by copying and editing the code for the other parameters.