Select by points tool is available on the Dynamic Modeler module since end of October 2021 Slicer Preview Release
This tools allows you to create 2 types of output models from an input model, a fiducial list, a selection-distance and a selection-algorithm.
One of the possible outputs is copy of the input model with selection scalars (unselected=0, selected=1) according to the selection-algorithm and selection-distance using the fiducial points as seeds.
The other possible output crops out the part of the input model that is selected.
This tool was developed ad-honorem by:
Mauro I. Dominguez
Andras Lasso (Perklab)
This tool allows partial mesh registration workflows like weight-painting ICP on Blender.
Hi dear, thank you so much for sharing. Actually I am conducting a project to measure the distance of zygoma bone between T1 (taken after a week of operation) and T2 (taken after 6 months of operation).
I want to know if there is a displacement and if yes how much was in mm and in which direction.
My questions:
I am using Pickān paint, model to model distance, and mesh statistics to export the value in excel file: in the new release of the 3d slicer, I can not use pickān paint properly: as when trying to add a fiducial point: automatically a lot of points are added!!! previously you send me this answer of using dynamic modeler tool: when I have watched this demo, it is on the same bone not in two models as my case! so how can I solve this problem?
Thank you again and sorry to bother you.
import both DICOM, transformation, rigid registration with Elastix module, then segment each one as volume, saved each one independently.
open again both models to start doing the steps mentioned in previous message.
My question:
how to solve the problem of automatic many points addition that I am facing with the new release version of the 3D Slicer?ā
How dynamic modeler could be used to add fiducial points on T1 model then measure the distance between these points and their matching ones on T2 model? as you mentioned in previous answer.
Thank you
Thank you so much for your rapid reply.
Actually it is so clear and this is to do registration of two models.
My question actually was how to calculate the displacement amount after doing the registration step of the two models in regard to the ROI which is in my case the zygoma bone?
exactly, so you mean after doing the registration the next step is to do partial surface registration ( formed by the zygomatic bone of T1, in my case) in the dynamic modeler module then using model to model distance and then mesh statistics to export the values?
Thank you for this function! Though, I found that there are only two possibilities for output nodes at the moment: āModel with selection scalarsā and āModel of the selected cellsā. Is there a way to obtain a āmodel of the unselected cellsā as output? I tried multiple things, but canāt seem to obtain the required model.
What I tried: I can visualize the selection with the āModel with selection scalarsā and even āremove (i.e. turn invisible)ā the āModel of the selected cellsā by lowering the scalar threshold under 1. So, it is only showing the unselected cells, but I donāt find how the export this visualisation/selection as a model.
I also tried to subtract the āModel of the selected cellsā from the input node with the ācombine modelsā function from the Sandbox extension. This gives me an error message, the one that is discussed on this page: Difference of meshes sometimes an empty mesh Ā· Issue #40 Ā· zippy84/vtkbool Ā· GitHub.
Is there another way to obtain this āModel of the unselected cellsā?
Thanks in advance!
Thank you for your fast reply! Could you tell me how should I use these vtkThreshold and vtkGeometryFilter? (My apologies, Iām not familiar with coding in python and quite new to 3DSlicer).
I found how to call on my model (see under), but do not know how to apply the mentioned functions.
surface.SetInputConnection(threshold.GetOutputPort())
surface.Update() #This is needed on the last filter to chain execute them
thresholdedModel = slicer.modules.models.logic().AddModel(surface.GetOutput()) # GetOutput() returns Polydata while GetOutputPort() is a cable connection to the geometryFilter
Thank you for the advice, but it still doesnāt work. The script returns a new Surface Mesh (vtkPolyData), but it is empty (surface area and such are still 0).
Iāve been trying to use your script as an example, but it is hard for me (Iām a newbie and not familiar with python or C++ (I think?) at all). So my apologies for the questions.
modelNode = slicer.util.getNode("Model")
#it seems these lines from your script may be useful here, but I don't know how to translate them to python
vtkPointData* pointScalars = vtkPointData::SafeDownCast(inputMesh_WorldWithSelection->GetPointData());
pointScalars->AddArray(outputSelectionArray);
#inputMesh_WorldWithSelection should be replaced with modelNode
threshold = vtk.vtkThreshold()
threshold.SetInputConnection(modelNode.GetPolyDataConnection())
threshold.SetThresholdFunction(threshold.THRESHOLD_UPPER)
threshold.SetUpperThreshold(0.5)
threshold.Update() #added this line
surface = vtk.vtkGeometryFilter()
surface.SetInputConnection(threshold.GetOutputPort())
surface.Update()
thresholdedModel = slicer.modules.models.logic().AddModel(surface.GetOutput())
As this didnāt seem to work out (couldnāt figure out how to convert from one language to the other), I tried a different approach, but ran into another error message. Would this approach even be viable?
modelNode = slicer.util.getNode("Model")
scalars = arrayFromModelPointData(modelNode, 'Selection')
filter_arr = []
for element in scalars:
if element > 1:
filter_arr.append(True)
else:
filter_arr.append(False)
filtered = modelNode[filter_arr]
thresholdedModel = slicer.modules.models.logic().AddModel(filtered.GetOutput())
Error message:
Traceback (most recent call last):
File "<string>", line 9, in <module>
TypeError: 'MRMLCore.vtkMRMLModelNode' object is not subscriptable
Could you please help me out with this code? Iām quite lost how to make this work.