From this thread:
“Cleaver generates a “background” mesh so that you can simulate embedding your structures in some material (soft tissue, etc). If you don’t need these mesh elements, then don’t use them. Each cell is assigned to a segment, specified by labels
cell attribute. You can use this attribute to assign material properties or remove parts of the mesh, etc.”
This is a simple question I am asking here. I do not know how to get going with slicer interpreter. every-time the application crashes due to some error I lost all my written code. is there any way to retrieve your last code in interpreter. I have to write again and again. How to setup environment for coding in slicer using scripting
I find the best thing is to create an extension with a scripted module and use the Reload buttons to execute the associated test. This way you can easily reproduce your work and add functionality incrementally.
See the slides and info here:
https://www.slicer.org/wiki/Documentation/Nightly/Developers/Python_scripting#Start_Here
The log file has a record of everything you typed in.
Thank you so much for replying. What about the edit it opens up for you in a notepad which is not good enough. What to do about this?
There are many editors available with good Python support – PyCharm (Community is free but does not support remote debugging), Spyder, Visual Studio Code, even Notepad++ has good basic Python highlighting and indenting.
By the way, along the lines Steve mentioned, if I don’t want to make a “full” module yet, then I usually still write my code in a file and load it with execfile
in case there is a crash while interacting with C++ APIs.
Everything that you typed in the console are automatically saved in application logs. After you restart Slicer, in menu choose: Help / Report a bug, select any of the previous session from the list, and you’ll see the commands you typed.
Previously, when I was not developing a module, I’ve been mostly copy-pasting from editors. However, now there is a new, very nice alternative: using Slicer from Jupyter notebooks. Instead of manual copy-pasting, you enter your code as small blocks of text, which is very easy to edit and re-run.
Dear Andras,
I do not understand the implicit function. If I want to get only the brain+tumur+ventricles mesh how do I define the implicit function?
Thank you
Looking forward
Sorry, I don’t know what implicit function you are referring to.
In extract geometry filter. there is an implicit function. I do not understand the purpose of using this implicit function?
Would you please explain what is its purpose?
I see, yes, vtkExtractGeometry is for extracting a sub-mesh using an implicit function, which is not what you need. I meant that you can use vtkGeometryFilter to extract boundary surface of an unstructured grid.
Andras, would you please tell me about the purpose of setextractionmodetospecified regions().
To get boundary surface, you need to use vtkGeometryFilter, not vtkExtractGeometry.
Hi Andras,
I am using filter like this. Could you please help me in understanding the pipeline for using filters?
First I am using connectivity filter to seperate the meshes. I am not sure I am using correctly the specified regions. then vtkgeometryfilter.
connect = vtk.vtkConnectivityFilter()
connect.SetInputData(mesh)
connect.SetExtractionModeToSpecifiedRegions()
connect.AddSpecifiedRegion(1)
connect2 = vtk.vtkConnectivityFilter()
connect2.SetInputData(mesh)
connect2.SetExtractionModeToSpecifiedRegions()
connect2.AddSpecifiedRegion(2)
connect3 = vtk.vtkConnectivityFilter()
connect3.SetInputData(mesh)
connect3.SetExtractionModeToSpecifiedRegions()
connect3.AddSpecifiedRegion(3)
brain = vtk.vtkGeometryFilter()
brain.SetInputConnection(connect3.GetOutputPort())
brainMapper = vtk.vtkPolyDataMapper()
brainMapper.SetInputConnection(brain.GetOutputPort())
brainActor = vtk.vtkActor()
brainActor.SetMapper(brainMapper)
Usual stuff:
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
ren.AddActor(brainActor)
Could you please tell me what I am doing right. Am I using it correctly?
I could not get the results (surface mesh corresponding to the volumetric mesh with direct correspondence to volumetric mesh point IDs, then you can use VTK geometry filter on the volumetric mesh)
To get help on how to use VTK, the VTK mailing list may be a better forum.
Anyway, some hints: If you need corresponding point IDs between selection/filtering input and output then read up on pedigree IDs. For example, vtkExtractSelectedThresholds may be able to extract sub-meshes defined by scalar range and provide pedigree IDs (point ID of the source mesh for each new point).
Dear Andras,
I used threshold to get the geometry of interest.
Next is to get all the points corresponding to volumetric mesh with direct correspondence to volumetric mesh point ids. I will follow what you suggested me and come back again.
Thank you so much for helping.
Andras could you please tell me is there any way to get auto completion in jupyter for vtk and slicer.
Thank you
Regards,
Saima Safdar
It works in latest nightly build. If it does not work for you then please report it in a separate topic.
Hi Andras,
What does cleaver meshing options represent. And what does tetGen meshing options represents.
Thank you
Regards,
Saima Safdar