How to programmatically export data from segment statistics?

Operating system: Windows 10

I use segment statistics to generate a table of all the information I need.
My question is how can I export the table of information from slicer programmatically after I use segment statistics. Ideally, I would run a command that would just export the table.
Also, how can I generate a graph or histogram from segment statistics and export that as well(programmatically)

You can use

slicer.util.saveNode(tablenode,filename)

A “test.csv” filename will export it in the CSV format.

1 Like

Great, thanks. Also, do you know how I can generate a graph of all the segments and the info?

The segment statistics module generates a result table (find it in the Data module).
If you open this result table in the “Table” module, you can directly create a plot chart.

More sophisticated plotting requires Python scripting:

https://www.slicer.org/wiki/Documentation/Nightly/Developers/Plots