How do I programmatically allow segment volumes from different segmentations to be shown in one table in the segment statistics module?

I know that we can use the segment statistics, module to get the volume of individual segments inside a segmentation in a table. How do I programmatically make it add volumes of segments in different segmentations? I would want the segment volume from a second or third segmentation to be added to the segment statistics table. So just one table for comparing volumes across segmentations. Is this possible? Any help is appreciated thanks.

It should be no problem at all. You can create a summary table (with an extra column to identify the segmentation node) and copy each cell of the segment statistics output table to this summary table using vtkMRMLTableNode methods (GetCellText, AddEmptyRow, SetCellText, etc.).

Hey, I still haven’t been able to implement this. Is there an example code so I can see it and understand or implement it?

Also, I want 2 segments from different segmentations to be added into one column without creating another table. For example, just selecting volume and segment and clicking add consecutively one after the other adding onto the same table. I think I could implement it if I look at some example code with table creation and manipulation.

These examples should help:

1 Like