I am new o the community. My clinical problem trying to solve is: Calculate vessel diameter/radius at each volume. I have done the follwoing:
load my volume
generated label map with only vessel of interest and croped both the volume and label map
generated a vessel shape with “Model Maker”
used VMTK centerline module to create centerline.
Also used Extract skeleton to get the 1D centerline points (just to double check)
Problems:
Which information to use and how to export in a format that will be useful for further radius calculation in MATLAB?
I found the following tutorial about VMTK module, in the older version there was possibility to export centerline data as .dat format. However, in the newer module installed by extention wizard of slicer version 4.10.2, i do not see the option to export data to “.dat” file
After installtion of the latest VMTK module, Vessel Enhancement sub module is missing. So i can’t follow the tutorial mentioned in the link completely.
Apart from the approach of exporting data and using it in MATLAB, is there a way in 3D Slicer, that i could directly see the information about, at each centerline point the radius i used?
Your valuable hep is appericiated very much.
Thanks!
VMTK module’s centerline directly provides radius measurement at each centerline points. You can copy-paste this code snippet into Slicer’s Python console to get each point’s position and radius at that position.
c = getNode('CenterlineComputationModel')
points = slicer.util.arrayFromModelPoints(c)
radii = slicer.util.arrayFromModelPointData(c, 'Radius')
for i, radius in enumerate(radii):
print("Point {0}: position={1}, radius={2}".format(i, points[i], radius))
Thank you very much for the reply. This was perfact. I have a couple of followup question…
Is the radius mentioned in the model same as the distance shown (voronoimodel overlayed on labelmap) in fig 1 of this post ?
I want to overlay the sphere or circle with the found radius and display its overlayed shape boundary with red color on to the main vessel model (as shown in fig1 of the thread) Can i visualise the overlayed sphere at each point?
How can i see properties/variables defined inside a model?
e.g.
when i type the following
>>> c = getNode('CenterlineComputationModel')
>>> c
Yes. You can generate the spheres using VTK glyph filter. Choose to scale the spheres using the “Radius” array. Create a model node from the filter output using slicer.modules.models.logic().AddModel(). See details and examples in Slicer programming tutorials. [quote=“Roni, post:3, topic:7234”]
How can i see properties/variables defined inside a model?
[/quote]
Data associated with points and cells of a model are listed on Models module / Display / Scalars section.
Thanks for the reply. I tried to implement what you suggested. However, unsccessful. So i searched online and found ur reply to similar post. Here is the link :Old reply to create glyph.
Based on your recommendation, i tried to combine your 2 replies, however, i got an error in line (4).
The words after % sign suggest my understanding of the lines. Would it be possible for you to please confirm if the steps are correct? and also my understanding of them?
`c=getNode('CenterlineComputationModel_1')` % Get the modelnode
points = slicer.util.arrayFromModelPoints(c)
radii = slicer.util.arrayFromModelPointData(c,'Radius') % Get radius
slicer.module.createmodels.logic().CreateSphere(radii) %create pheremodel with radius array
modelNode = slicer.util.getNode('SphereModel') % get node of the model
glyph3D = vtk.vtkGlyph3D() % create glyph node
glyph3D.SetInputConection(modelNode.GetPolyDataConnection()) % set the input connection from 'Spheremodel node'
arrowSource = vtk.vtkArrowSource() % create arrowsource
glyph3D.SetSourceConnection(arrowSource.GetOutputPort()) % No idea for what
glyph3D.SetVectorModeToUseNormal() % no idea why it is used
glyph3D.SetScaleFactor(radii) % scling with radius array
glyph3D.Update() % update
modelNode.SetAndObservePolyData(glyph3D.GetOutput()) % you get the output
I am not sure where and how should i use the line slicer.modules.models.logic().AddModel() in my code to get the final result.
Your help is very much helpful for me to proceed further. Thanks for your time and help.
slicer.modules.models.logic().AddModel() requires a vtkPolyData object or a filter output connection that produces vtkPolyData. This is exactly what centerline computation module provides.
If you want to create a tube model from the points and radii then use feed the centerline computation module output into a vtkTubeFilter, if you want to show the points as spheres then use vtkGlyph3D filter. You can configure both filters to change radius based on a chosen point data array.
If you do not need to modify point positions or radii then there is no need to use numpy (do not call slicer.util.arrayFrom…), just use VTK filters.