I am attempting to compare some laser scans I took of bone samples to manual segmentations from MRI scans for my research. The scans are stl files and contain holes in the surface shell due to limitations of the laser scanner (see photos below).
As a result, converting the scans to segments using the typical “Convert Model to Segmentation Node” option leads to really weird segments that are not useable (also see photo below).
I assume the easiest way to fix this is to repair the holes in my scan and then convert the model node to a segment as usual. That said, I am having a little difficulty finding a module or extension with this capability. SurfaceToolbox Fill Holes function did not work for the large posterior holes and even seemed to invert the surface at points (blue model in the photo below). Is there an extension that can solve my issue, or am I better off filling holes in some other mesh editing software before importing to 3Dslicer?
Optionally you can further control the smoothing process by defining a second input: the Source. If defined, the input mesh is constrained to lie on the surface defined by the Source ivar.
You can check the WrapSolidifyEffect implementation as example of how it is used, link below:
Also, you may need to use the filter this twice, one time per bone
Thanks for the suggestion Mauro. I’m having difficulty implementing this filter since I admittedly have zero experience with VTK, and only basic proficiency in Python. I tried skimming the script repository at Script repository — 3D Slicer documentation and the first couple tutorials at Documentation/Nightly/Training - Slicer Wiki but I was having trouble finding info specific to my application (lots of varied commands and applications but nothing seemingly specific enough to work).
I especially don’t understand how to convert my model node correctly into vtkPolyData so I can run the filter, then back into a model I can manipulate in the 3Dslicer GUI.
My best attempt was below. I’m pretty sure this is complete nonsense code, sorry:
modelNode = getNode('vtkMRMLModelNode5')
filterItUp = vtk.vtkSmoothPolyDataFilter()
filterItUp.SetInputData(0, modelNode.GetPolyData())
#I also tried filterItUp.SetInputData(modelNode.GetPolyData())
filterItUp.Update()
modelNode.SetPolyDataConnection(filterItUp.GetOutputPort())
#I also tried
modelNode.SetAndObservePolyData(filterItUp.GetOutput())
I see no change in my original model in the 3D viewer after running this.
# overwrite the model contents
getNode('myModelToModifyName').SetAndObservePolyData(somePolydataFilter.GetOutput())
# or create a new model
modelsLogic = slicer.modules.models.logic()
model = modelsLogic.AddModel(somePolydataFilter.GetOutput())
I suggest you start with a SourceFilter and the second method, till you understand how it works