Hi there, I’m creating a web app using ParaView and Trame for heart valve surgery planning. One of the features of this app is to perform various calculations based on where a cylinder representing a replacement valve is positioned on an STL file of a patient’s left ventricle. In order to perform these calculations, I need to perform a boolean intersection between the STL and the cylinder, which I can currently do in the Paraview GUI using the BooleanOperations filter by adding it as a plugin using the XML file in this post.
I am now trying to write a Python script to run the BooleanOperations filter to find the intersection of the STL and cylinder, then extract a subset of the points from this based on their x and y coordinates. While it seems like the script loads the plugin and does the boolean operation correctly, when I try to use servermanager.Fetch
to get the results, my app crashes with a segmentation fault, no other information about why it crashed is given. Since I have used servermanager.Fetch
for another calculation in the app with no issues, the only reason I can think of for the segfault happening is due to using a plugin to expose the BooleanOperations filter.
The relevant code is below. Any help on how to fix this is greatly appreciated!
def join_LV_implant(lv_stl, implant, BOOLEAN_FILTER_PATH):
# triangulate implant to use with boolean filter
triangled_implant = simple.Triangulate(Input=implant)
# do boolean operation of lv and triangulated implant
simple.LoadPlugin(BOOLEAN_FILTER_PATH, remote=False, ns=globals())
lv_implant_boolean = BooleanOperation(FirstSurface=lv_stl, SecondSurface=triangled_implant)
lv_implant_boolean.Operation = 'Intersection'
return lv_implant_boolean
def get_MV_dp(state, lv_implant_boolean):
...
# find mv_med_top using lv_implant_boolean
lv_implant_boolean.Operation = 'Intersection'
# clip data to narrow down the points
bool_clip1 = simple.Clip(Input=lv_implant_boolean)
bool_clip1.ClipType.Origin = [0.0, 0.0, -5.0]
bool_clip1.ClipType.Normal = [0.0, 1.0, 0.0]
bool_clip2 = simple.Clip(Input=bool_clip1)
bool_clip2.ClipType.Origin = [0.0, 0.0, -5.0]
bool_clip2.ClipType.Normal = [0.0, 0.0, -1.0]
boolean_data = servermanager.Fetch(bool_clip2) # crashes here
intersection_points = boolean_data.GetPoints()