Centerline extraction from Polydata

1,423 views
Skip to first unread message

Alberto Corvò

unread,
Nov 6, 2013, 11:34:41 AM11/6/13
to vmtk-...@googlegroups.com
Hi everybody, 
I'm working on the centerline extraction of a polydata file .vtp. I tried the VMTK toolbox from terminal (Linux) and the result was great. Now I would like to write a small project based on this to extract some informations about the branches of my lungs's polydata model. Is there a class written in C++ which implements the seedselector as in the vmtkcenterlines.py?
If I wanted to extract the whole centerlines of my tubular structure what do you suggest me? I'm thinking about something automatic that could work as a 3dthinning algorithm

The VMTK module for Slicer 4 is not still available?

Thank you for the support
Alberto


Luca Antiga

unread,
Nov 7, 2013, 4:13:15 PM11/7/13
to vmtk-...@googlegroups.com
Hi Alberto,
 
On Wed, Nov 6, 2013 at 5:34 PM, Alberto Corvò <alberto...@gmail.com> wrote:
Hi everybody, 
I'm working on the centerline extraction of a polydata file .vtp. I tried the VMTK toolbox from terminal (Linux) and the result was great. Now I would like to write a small project based on this to extract some informations about the branches of my lungs's polydata model. Is there a class written in C++ which implements the seedselector as in the vmtkcenterlines.py?

No, there currently isn't. All interactive stuff is coded in Python in vmtk, but it can be translated quite directly in C++ using the same classes and following very similar patterns. Take a look at the VTK Examples for reference: http://www.vtk.org/Wiki/VTK/Examples/Cxx
 
If I wanted to extract the whole centerlines of my tubular structure what do you suggest me? I'm thinking about something automatic that could work as a 3dthinning algorithm

In case of a lung dataset vmtkcenterlines is challenging because you either need to locate all endpoints or to open the model at all the tree leaves, and both things are time consuming or require dedicated code.
Alternatively you could give vmtknetworkextraction a try - it's less accurate but it doesn't need endpoints. You could even compute endpoints with the latter and run the former, but there's not pre-canned way of coupling the two currently.

A 3D thinning approach is surely a valid alternative for your use case. It could be a nice addition to a future version of vmtk. I just added an issue on github as a reminder.
You can give this approach a shot using the Extract Skeleton module in Slicer 4 (under Filtering).

The VMTK module for Slicer 4 is not still available?

I'm not sure about the timeline for it, I can gather some information. 

Best,

Luca


Thank you for the support
Alberto


--
You received this message because you are subscribed to the Google Groups "vmtk-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vmtk-users+...@googlegroups.com.
To post to this group, send email to vmtk-...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Luca Antiga, PhD
Co-founder and Principal Scientist, OROBIX Srl
via L.A. Muratori 3, 24123 Bergamo, Italy

twitter: @lantiga
mobile: +39.347.43.16.596

"This message originates from OROBIX Srl and its contents and attachments are privileged and confidential and are intended only for the individual(s) or entity(ies) named above. This message should not be forwarded, distributed or disclosed. Any unauthorized use, dissemination and duplication is strictly prohibited and may be unlawful. All personal messages express views solely of the sender, which are not to be attributed to OROBIX Srl, and may not be copied or distributed without this disclaimer. If you are not the intended recipient or received this message in error, please delete this message and notify the sender by reply e-mail. Opinions, conclusions and other information in this message that do not relate to the official business of OROBIX Srl shall be understood as neither given nor endorsed by it."

Alberto Corvò

unread,
Nov 8, 2013, 1:26:58 PM11/8/13
to vmtk-...@googlegroups.com
Hi Luca, 
thank you for the reply and the advices!!
So I'm working on the C++ user-interaction to provide the SourceSeeds and the targetSeeds to the polydatacenterline algorithm. After that I would like to try to implement a whole centerline extraction, maybe giving  as targetseeds all the final boundaries of the branches? How to the detect the extreme points of the surface?

I tried the vmtknetworkextraction but it doesn't work, I ll post you the error that the prompt gives me. 

I had already thought about the Extract Skeleton model of Slicer but it didn t seem so feasible to work with a polydata model and actually I would like to create an interactive module to load on Slicer for a whole evaluation of the lungs model. 
Thank you for the link to the examples they are really useful for this purpose.

Thanks again 
Alberto 




2013/11/7 Luca Antiga <luca....@orobix.com>

--
You received this message because you are subscribed to a topic in the Google Groups "vmtk-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vmtk-users/OvHhe553mhc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vmtk-users+...@googlegroups.com.

Luca Antiga

unread,
Nov 8, 2013, 3:58:35 PM11/8/13
to vmtk-...@googlegroups.com
Hi Alberto,

On Fri, Nov 8, 2013 at 7:26 PM, Alberto Corvò <alberto...@gmail.com> wrote:
Hi Luca, 
thank you for the reply and the advices!!

No problem :-)
 
So I'm working on the C++ user-interaction to provide the SourceSeeds and the targetSeeds to the polydatacenterline algorithm. After that I would like to try to implement a whole centerline extraction, maybe giving  as targetseeds all the final boundaries of the branches? How to the detect the extreme points of the surface?

Indeed your dataset may have characteristics that help identifying the endpoints automatically, but it's of course specific to the geometry you are treating. I don't think your surface has open sections at the endpoints, so you have to detect them somehow. vmtknetworkextraction does it, so maybe send me the error messages and I can look into it.

Luca

Alberto Corvò

unread,
Nov 11, 2013, 11:41:11 AM11/11/13
to vmtk-...@googlegroups.com
Hi Luca, 
yes the model is a closed surface so my intention is now to evaluate the extremes boundaries and trying to evaluate a first skeleton model. 
I tried with the networkextraction just passing the .vtp model. The error is the following one:

ERROR: In /build/buildd/vmtk-0.9.0/vtkVmtk/Misc/vtkvmtkPolyDataNetworkExtraction.cxx, line 591
vtkvmtkPolyDataNetworkExtraction (0xcb6f40): Error: can't reconstruct new profile.

Thank you for the support
Alberto
 


2013/11/8 Luca Antiga <luca....@orobix.com>

Luca Antiga

unread,
Nov 19, 2013, 4:42:15 PM11/19/13
to vmtk-...@googlegroups.com
Hi Alberto, 
 sorry for the radio silence. The error indicates that the surface might be degenerate somewhere, which can happen in case of very complex surfaces like yours.
If you'd still like to play with this script, try fiddling with the -advancementratio parameter, keep it slightly larger than one (e.g. try 1.01, 1.05, 1.1). Chances are that the sphere iteratively chopping the surface will overcome the degeneracy. No guarantees, though. You can also try to smooth the surface - it won't solve topological degeneracies but it will produce fewer spurious side-brances in the final network.
Best,

Luca

Alberto Corvò

unread,
Nov 20, 2013, 5:47:46 AM11/20/13
to vmtk-...@googlegroups.com
Hi Luca, 
thank you for the reply! I ll try to play a little, in the mean time I wrote my code in C++ to evaluate the centerline from the top of the trachea to some selected branches, now I would like to work on the identification of the selected branch providing some kind of informations about it (as Surface, Volume etc). Now I`m wondering I could link the mesh with the real size of the lungs extracted from my dicom image, is there something provided by the VMTK toolbok. 
Thank you again for the support
Alberto


2013/11/19 Luca Antiga <luca....@orobix.com>

Alberto Corvò

unread,
Nov 20, 2013, 7:15:41 AM11/20/13
to vmtk-...@googlegroups.com
Sorry Luca another question: how can I import the VMTK classes in a wrapped with python project? Where should I move the classes?
Thank you
Alberto


2013/11/20 Alberto Corvò <alberto...@gmail.com>

Luca Antiga

unread,
Nov 30, 2013, 12:31:22 PM11/30/13
to vmtk-...@googlegroups.com
Hi Alberto,
 did you make progress on this? Can you be a little more specific with the troubles you're having with python wrapping?
Usually you should start including the path where your wrapped modules are located in your PYTHONPATH environment variable (and make sure any dll are in your PATH environment variable).
Best,

Luca

Alberto Corvò

unread,
Dec 2, 2013, 1:16:09 PM12/2/13
to vmtk-...@googlegroups.com
Hi Luca, 
I made progresses in Python, meaning that I`m able now to use the algorithms of the VMTK tools. I used the centerline algorithm, and the smoothing one as shown in the scripts. I would like to use the branchextractor, branchgeometry and the other tools to gain something in terms of metrics and mm quantities (as volumes, surface for each kind of branch selected). 
I had problems with them because I didn t understand really how the GroupsId works. If I select just one target the GroupId is equal to zero..how can I extract information from the point and the area surronding the last one of the centerline?

After that I would like to work on the whole skeleton of the lungs model and maybe help to integrate it in the VMTK tool. 
Thank you for the support once again
Best
Alberto


2013/11/30 Luca Antiga <luca....@orobix.com>

Alberto Corvò

unread,
Dec 3, 2013, 10:19:58 AM12/3/13
to vmtk-...@googlegroups.com
And just a clarification. With classes as the centerlinesAttributes how can I retrieve the information that I seen being stored in the Centerline polydata as follow: 
 
centerlineAttributes = vtkvmtk.vtkvmtkCenterlineAttributesFilter()
centerlineAttributes.SetInput(self.Centerlines)
centerlineAttributes.SetAbscissasArrayName(self.AbscissasArrayName)
centerlineAttributes.SetParallelTransportNormalsArrayName(self.NormalsArrayName)
centerlineAttributes.Update()

self.Centerlines = centerlineAttributes.GetOutput()

I mean after the last line, I would like to know the Abscissas Value or the Normal, what do you suggest me to do?

Thanks a lot, 
Alberto


2013/12/2 Alberto Corvò <alberto...@gmail.com>

Luca Antiga

unread,
Dec 9, 2013, 6:13:36 AM12/9/13
to vmtk-...@googlegroups.com
Hi Alberto, 
 you should do the following:

abscissa = self.Centerlines.GetPointData().GetArray(self.AbscissasArrayName).GetTuple1(point_id)

Basically a PolyData contains PointData and CellData (and FieldData), which in turn contain arrays that can be retrieved using their name. 
PointData arrays contain one tuple per PolyData point, CellData arrays contain one tuple per PolyData cell (a cell is a topological entity like triangle, quad, polyline, etc).
A tuple is a n-component entry of an array which contains n scalars. The abscissa array only has one component per tuple, hence the use of GetTuple1, which returns the one and only scalar in the tuple.
The normal array is a 3-component tuple array, so you get a normal with 

normal = self.Centerlines.GetPointData().GetArray(self.NormalsArrayName).GetTuple3(point_id)

Hope this clarifies things a bit.

Luca

Alberto Corvò

unread,
Dec 26, 2013, 10:21:59 AM12/26/13
to vmtk-...@googlegroups.com
Hi Luca, 
sorry for disappearing. 
Yes definitely it worked! Thank you for the clarification. 
I would like to use the centerline algorithm in a new module of Slicer, how could I import the classes in Slicer even if VMTK is still not provided? Am I allowed to do sth like that?

I use the occasion to wish you happy holidays!
Alberto

Luca Antiga

unread,
Dec 27, 2013, 9:33:53 AM12/27/13
to vmtk-...@googlegroups.com
Hi Alberto,
 no problem, I do that all the time :-)

Thanks for letting me know that things work now. As for the centerline algorithm in Slicer, your safest bet at the current stage is probably to the relevant classes out of vmtk and build a C++ Slicer module including those in the source code.

Happy holidays!

Luca

Alberto Corvò

unread,
Dec 27, 2013, 10:09:21 AM12/27/13
to vmtk-...@googlegroups.com
Ok thank you :D So basically create a CLI module of Slicer with the 4-5 classes that I need to run the centerline algorithm, right? 

Luca Antiga

unread,
Dec 27, 2013, 10:12:33 AM12/27/13
to vmtk-...@googlegroups.com
Yes, that's the idea. Just remember to include the license file for vmtk in your module.

Luca

Alberto Corvò

unread,
Dec 27, 2013, 10:15:09 AM12/27/13
to vmtk-...@googlegroups.com
Yes definitely!! I ll do that in the following weeks to improve a navigation module. Then I ll work to produce a whole skeleton of the Lungs model, unfortunately the networkextractor due to the complexity of the model didn t return results.

Luca Antiga

unread,
Dec 27, 2013, 10:15:48 AM12/27/13
to vmtk-...@googlegroups.com
Great, keep us posted!

Luca

Alberto Corvò

unread,
Jan 14, 2014, 6:46:59 AM1/14/14
to vmtk-...@googlegroups.com
Hi Luca, 
I`m working on the centerlines module that I would like to integratate on Slicer. I`ve selected the classes that I need to evaluate the centerlines, now could you suggest me a module that I can take as example for realizing that? I would like to have clear the structure of it and how to link the classes, so far I had experience just with the scripted modules and I have to train a little. 
And changing sort of problem, it s not clear to me what  the 3 coordinates that I obtain from the RadiusArray of the centerlinesAttributes point? 

Luca Antiga

unread,
Jan 20, 2014, 4:42:21 AM1/20/14
to vmtk-...@googlegroups.com
Hi Alberto,
 if you are taking the CLI route, just create a stand-alone executable using the vmtk classes you extracted, then for integrating into Slicer take a look at this


and as an example


There might be new opportunities coming up for integrating vmtk and Slicer. Thanks for Simone Manini's hard work we just finished packaging vmtk as a python egg for all platforms. This will become the official way of installing vmtk on all platforms (in addition to compiling from source, of course).
I have a trick in mind for integrating vmtk into Slicer as a python scripted module, ping me if you're interested once the eggs are out (likely later this week).

Best,

Luca

Alberto Corvò

unread,
Jan 20, 2014, 5:46:28 AM1/20/14
to vmtk-...@googlegroups.com
Hi Luca, 
thank you for the ideas. 
Yes I'm definitely interested due to I would like to use the whole package for an accurate analysis of the lungs model created and the geometry analysis provided by VMTK is really feasible! 
Just keep me posted about the release, in the meantime I'll work on my CLI module, it is certainly a good way to learn how to to. 

Best, 
Alberto

Alberto Corvò

unread,
Feb 5, 2014, 5:52:51 AM2/5/14
to vmtk-...@googlegroups.com
Hi Luca, 
there are some news about the integrations of VMTK in Slicer?
You told me about the chance to move it somehow on it last time.. is it still a valuable way?

Some time ago I had worked on C++ for creating a centerline application using vtkvmtkpolydatacenterlines classes, but now I have problems on linking these classes in a simple ReadPolyData example of vtk. I attach some screenshots with a list of the errors and on the right the files included in the project. 
I can t see what I should fix. 

Thank you very much for the support
Alberto
Screenshot 2014-02-05 10.49.35.png
Screenshot 2014-02-05 10.49.52.png

Luca Antiga

unread,
Feb 7, 2014, 4:34:33 AM2/7/14
to vmtk-...@googlegroups.com
HI Alberto,
 sorry, no news on Slicer yet. To be honest I didn't have a lot of time to experiment since we released the binaries, but we're in a better position to investigate now.

I've been looking at the error, the best way to go is if you send over the CMakeLists.txt and CMakeCache.txt files for your project, so we can take a look.

Thanks

Luca

Reply all
Reply to author
Forward
0 new messages