Volume calculation (surface mesh) in paraview

In any case, for anyone that is looking for a solution and comes across this post:

from paraview import servermanager
from paraview.vtk.numpy_interface import dataset_adapter as dsa

#ensure that the filter is vtkPolyData type
if filter.GetDataInformation().GetDataSetTypeAsString()!='vtkPolyData':
    filterToUse=ExtractSurface(Input=filter)
else:
    filterToUse=filter

programmableFilter1 = ProgrammableFilter(registrationName='ProgrammableFilter1', Input=filter,OutputDataSetType='vtkPolyData',)
programmableFilter1.Script="""
import vtk
mesh = self.GetInputDataObject(0, 0)
surface = vtk.vtkDataSetSurfaceFilter()
surface.SetInputData(mesh)
surface.Update()
triangulate = vtk.vtkTriangleFilter()
triangulate.SetInputConnection(surface.GetOutputPort())
triangulate.Update()
mp = vtk.vtkMassProperties()
mp.SetInputConnection(triangulate.GetOutputPort())
mp.Update()
volume = mp.GetVolume()
area = mp.GetSurfaceArea()
# Create output: one point and one vertex cell
output.Initialize()
points = vtk.vtkPoints()
points.InsertNextPoint(0.0, 0.0, 0.0)
output.SetPoints(points)
vertices = vtk.vtkCellArray()
vertices.InsertNextCell(1)
vertices.InsertCellPoint(0)
output.SetVerts(vertices)
# Check boundary edges
boundaryEdges = vtk.vtkFeatureEdges()
boundaryEdges.SetInputConnection(triangulate.GetOutputPort())
boundaryEdges.BoundaryEdgesOn()
boundaryEdges.FeatureEdgesOff()
boundaryEdges.NonManifoldEdgesOff()
boundaryEdges.ManifoldEdgesOff()
boundaryEdges.Update()
nBoundary = boundaryEdges.GetOutput().GetNumberOfCells()
# Check non-manifold edges
nonManifoldEdges = vtk.vtkFeatureEdges()
nonManifoldEdges.SetInputConnection(triangulate.GetOutputPort())
nonManifoldEdges.BoundaryEdgesOff()
nonManifoldEdges.FeatureEdgesOff()
nonManifoldEdges.NonManifoldEdgesOn()
nonManifoldEdges.ManifoldEdgesOff()
nonManifoldEdges.Update()
nNonManifold = nonManifoldEdges.GetOutput().GetNumberOfCells()
isClosed = nBoundary == 0 and nNonManifold == 0
if not isClosed:
    print("Mesh is not closed!")
    volume=0
for name, value in [("Volume", volume), ("Area", area)]:
    array = vtk.vtkDoubleArray()
    array.SetName(name)
    array.InsertNextValue(value)
    output.GetCellData().AddArray(array)
print("Mesh area:", area)
print("Mesh volume:", volume)"""
data=dsa.WrapDataObject(servermanager.Fetch(programmableFilter1))
volume=data.CellData['Volume']
area=data.CellData['Area']

if the volume is still ==0 (meaning it is not manifold) one can use VESPA pluging with fill holes (or worst case scenario alpha wrapping) to create a new manifold watertight mesh in paraview itself, and extract the volume and area using the same ProgrammableFilter

best regards.