Wrong Volume after Clipping

Hi all,
I am trying to clip a model and I expect to have a smaller volume after clipping.
I use vtkClipPolyData and vtkImplicitBoolean for clipping (my own way).
Green is the initial input and the blue is the cropped and I expect the volume to be smaller.
As you can see in the image I created the segmentation for both and it seems that I compare the right things. But if you check the Volumes are not correct.

Could you help or give any workaround?
Thanks


Model volume can only be interpreted for closed surfaces. Are your models all closed surfaces?

Are the volumes correct if you import the models into a segmentation and compute the volume of the segment (using Segment Statistics module)?

Thanks for your answer.

I used Segment Statistics Module and here are the results
Seems that there is an issue with the “Cutter”. I tried to close it with the following way but I am not sure if that is the right way:

segmentationNode.CreateClosedSurfaceRepresentation()

I don’t know what results do you expect. Did Segment Statistics provide correct results?

It would help if you could upload the scene somewhere and post the link here so that I can have a look.

I think I need the ones from Segment Statistics Column C and not Column F.
How can I close the segmentation for the cutter model? I try

segmentationNode.CreateClosedSurfaceRepresentation()

but it is not updating anything. But if I will try to close the surface from the “Segmentation” module works.
Do I miss something in the code?

Segments in a segmentations node are always “closed”, regardless of what representations are used. Calling CreateClosedSurfaceRepresentation() just ensures that closed surface representation is present. Segment statistics computes volume from both labelmap and closed surface representations (you can find more details in the tooltip when you hover the mouse over the table).

If you want to recreate closed surface representation from labelmap representation then make labelmap the master representation and delete and create closed surface representation.

Sure, I have uploaded these two files and I expect the cutter to have less Volume.

Hope that helps,
Thanks

I don’t know how did you close the surface but Segmentation module’s closed surface to labelmap importer closed it correctly, so I would recommend to use that.

I use the following code

> def export():
>   segmentationNode = slicer.util.getNode("Cutter-segmentation")
>   segmentationNode.CreateClosedSurfaceRepresentation()
>   segmentation=segmentationNode.GetSegmentation()
>   for segmentIndex in range(segmentation.GetNumberOfSegments()):
>     segmentID = segmentation.GetNthSegmentID(segmentIndex)
>     polydata = vtk.vtkPolyData()
>     segmentationNode.GetClosedSurfaceRepresentation(segmentID, polydata)
>     writer = vtk.vtkSTLWriter()
>     writer.SetInputData(polydata)
>     writer.SetFileName("D:/Cutter1.stl")
>     writer.Update()

Do I miss something?