How to change VascularNetwork.tre file from TubeTK into 0-1 mask?

I am trying to use the TubeTK dataset here to do some intracranial vasculature segmentation task. Thus i need to use the VascularNetwork.tre file as the ground truth. The problem is how to change this .tre file to 3d 0-1 mask where 1 marks the existance of vessel?

Thanks for reaching out to us!

We have a jupyter notebook example that exactly shows how to do this!


Note that the one trick is to define a “Template” image which specifies the location, size, and resolution of the image you want to generate from the .tre file.

This demo also shows off the 3D visualization capabilities of itkWidgets.

Best regards,


Hi Stephen, thanks for your reply. Also there is a really beginner question about installing ITK. I am new to this and heavn’t installed it. The link you gave said ITK, ITKTubeTK and ITKWidgets are all required, I searched the web and it seems that all 3 can be installed simply using one ‘pip’ or ‘conda install’ command now, is this true? Cause I remeber seeing some old discussions that install ITK(or maybe TubeTK) is a very complex process with some really pain environment settings.

You’re right! The following should work:

pip install itktubetk
pip install itkwidgets[all]

Installing itktubetk will automatically bring in the most recent ITK.

Installing itkwidgets[all] will add support for jupyter lab, jupyter notebooks, colab, and sagemaker/studiolab