Calculating shared volume between two models

Operating system: MacOS
Slicer version: 4.11

Hi,

I want to calculate the total volume of these two tumor models and the shared volume (AKA how much they overlap/purple area). They are .vtk files, not segmentations. Thanks in advance!

image

There may be a better way to do this but the first thing that springs to mind for me is that you could import the vtk models as segments using the segmentations module (Go down to Export/import models and labelmaps and select Import and Model). Import both models using this method.

Now go to segment editor. You will need to load a volume of some sort to use as a master volume. Then you can use the logical operators effect in segment editor set to ‘Intersect’ to leave only the volume where the models intersect. Once you have the segment which represents the intersection volume you can delete the other segment as it wont be needed.

Then go to the segment statistics module and use that to find the volume of the segment you have just created.

4 Likes

Exactly. And after the model is imported, you can use Segment Comparison module (provided by SlicerRT extension) to compute percentage of shared volume, Dice coefficient, Hausdorff distance, etc.

Thank you for the help! I did what @Juicy advised but it creates a weirdly shaped volume (pink) that is a different shape than the intersecting volume. Any suggestions on why?

image

image

I did try this on two vtk spheres and it worked fine. Is there any chance you could share just the two vtk models and I can see if I can recreate the problem?

Otherwise if it is the logical operators step which is causing you problems you could follow the advice above from @lassoan and use slicerRT which doesnt sound like you need to use logical operators.

1 Like

I added the SlicerRT extension but it seems that some of the modules like Segment Comparison won’t load. @Juicy how can I share with you the two vtk models? Thank you!

I have sent you a private message with contact details if you wish to send the models through, thanks

1 Like

I managed to have a look at your models. Here is what worked for me:

  1. Import both the vtk models into a new instance of slicer

  2. Go to the models module and change the colours of the models (in this case I made tumor 1 blue and tumor 2 green). I also made them translucent and turned on slice display visibility. (this isn’t necessary for volume calculation just good to visually check).

  3. Go to the segmentations module and import both the models into a new segmentation node using the Export/import models and labelmaps.

  4. Go to the segment editor and notice that all the effects are greyed out until you select a master volume. Instead of selecting a master volume click the small “Specify geometry button” (see pic below). In the drop down box select “Segmentation” (should be the lowest option). In my case my segmentation labelmap had voxel sizes of 0.08 x 0.08 x 0.08mm which is good because you need small voxel sizes to accurately represent a small volume like this one. Then click “OK” and slicer will generate a dummy volume to use as a master volume which also has 0.08 x 0.08 x 0.08 voxel size.

  5. Then I selected tumor 1 from the list and clicked the “Logical Operators” as the effect. Change the operation to “Intersect” and select tumor 2 in the “Intersect with segment” box. Then click “Apply”. The tumor 1 segment will then be trimmed down to the area which intersects the other tumor 2.

  6. I deleted tumor 2 as this is now longer needed for the calculation. I renamed the tumor 1 segment “Shared volume” and changed the colour to red. With the outlines of the models visible in the slice views you can now easily see that the “Shared Volume” is in the area where the models intersect.

  7. Go to the Segment Statistics module and make the “Segmentation” node the input and press “Apply”

This shows the shared volume is 3222.88 mm^3 or 3.22 cm^3.

I also converted the vtk files to STL and uploaded them in blender and used the boolean effect to generate a model of the shared volume. The result from blender was 3222.95 mm^2, so a very close agreement.

Probably what when wrong for you was that you used a clinical scan as a reference volume (my fault as that is what I said to do) which typically have large voxel sizes around 0.5 x 0.5 x 0.5 for a fine slice CT scan (they will be even bigger for an MRI) this forces the segmentation to also have a large voxel size which will not be able to accurately represent a small volume like this one.

I also tried Segment Comparison which gave the volume of tumor 1 as 3.94 cm^2 and tumour 2 as 4.42 cm^2 but I couldn’t work out how to calculate the shared volume as I don’t understand what all the percentages mean in the Dice Coefficient area. @lassoan could you advise on this? Also, why are there two volume outputs in the Segment Statistics module? Volume (1) seems to be in closer agreement with Blender in this case.

3 Likes

Found some info on Segment Statistics in this post: https://discourse.slicer.org/t/segment-statistics/7303

My interpretation is one of the volumes is computed using a closed surface representation of the segment (similar to what you see when you press the 3d button in segment editor with surface smoothing ticked), and the other is computed by adding up the volume of all the individual voxels making up the segment.

I am guessing Volume (1) is the closed surface representation in this case? Volume (1) is slightly less in volume and agrees closely with the Blender computation which is based on surface models.

1 Like