How to open .TRE file?

Hi,

Oh actually I ran this using 5.0.1 on anaconda. So I guess the bug is the case here.

Thanks again for your fast responses.
Ali

Hi

Yes, quite a bit has been rapidly changing in itk. The nightly repo on GitHub is actually typically a good and safe bet.

Have a good week.

S

1 Like

Okay great thanks. I will follow from there.

Ali

1 Like

@Stephen_Aylward
I hope you are doing well and had a good day so far. So, after a lot of back and forth, I am using the nightly-master branch of itk. As you said, everything was resolved. However, the last step of installation I am getting a missing file error:

CMake Error at Modules/Remote/TubeTK/TubeTKLib/Filtering/cmake_install.cmake:41 (file):
file INSTALL cannot find
“/home/ali/GIT/ITK/Modules/Remote/TubeTK/TubeTKLib/Filtering/itktubeCastSpatialObjectFilter.h”.
Call Stack (most recent call first):
Modules/Remote/TubeTK/TubeTKLib/cmake_install.cmake:47 (include)
Modules/Remote/TubeTK/cmake_install.cmake:69 (include)
cmake_install.cmake:346 (include)
Makefile:61: recipe for target ‘install’ failed
make: *** [install] Error 1

Any idea how to resolve this issue? Because I checked the path and this header file is not there, obviously. :slight_smile:
Thanks
Ali

You may have found a bug!

I believe that the CastObject filter was moved to ITK (it isn’t in TubeTK), but perhaps the install script was not updated. Let me check on that tonight/tomorrow. I hope you will only need to delete one line to fix the bug in your copy. I thought I had done that, but maybe not!

s

So, finally after three days of continues work I managed to pull it off. It’s working, I only had to remove like 5 lines of cmake installation to make it to finish the install. So far, I can import packages with no error. Thanks a lot for the help.

1 Like

Hi,

In the file ITK/Modules/Remote/TubeTK/TubeTKLib/CMakeLists.txt

Please remove the line that say

itktubeCastSpatialObjectFilter.h

That should do it!

Sorry about that - I almost never do an install (I keep everything in their build trees).

All is now working for me, including using arrayfire (which uses the GPU to make certain operations 40x faster).

Let me know how it goes for you!

Thanks for your patience,

Stephen

2 Likes

Stephen,

Thank you so much for your great help. I got it running.

Thanks much

Ali

Hi,

Yes, just don’t run the merge step. The image you want is the one produced by this step:

TubesToImageFilterType = itk.ConvertTubesToImage[ImageType]
tubesToImageFilter = TubesToImageFilterType.New()
tubesToImageFilter.SetUseRadius(True)
tubesToImageFilter.SetTemplateImage(im1)
tubesToImageFilter.SetInput(tubeG)
tubesToImageFilter.Update()

outputImage = tubesToImageFilter.GetOutput()
view(outputImage)

The outputImage is what you want.

Congrats!!!

s

2 Likes

Perfect, thank you so much. I have to admit, there wasnt any way that I could pull this off without your patience and help.

Thanks much.

So happy it is now working!

Enjoy ITK!

Stephen

2 Likes

Hello @Stephen_Aylward,
I use the following code to convert the .tre file but I don’t know how to convert it into medical image format(e.g nifti,nrrd,mha etc).Can you tell me the way? Secondly, I have installed itkwidgets and its dependencies but the “view” is not showing anything either on Linux Jupyter notebook nor on windows?
TubesToImageFilterType = itk.ConvertTubesToImage[ImageType]
tubesToImageFilter = TubesToImageFilterType.New()
tubesToImageFilter.SetUseRadius(True)
tubesToImageFilter.SetTemplateImage(im1)
tubesToImageFilter.SetInput(tubeG)
tubesToImageFilter.Update()

outputImage = tubesToImageFilter.GetOutput()
view(outputImage)

Hi,

Are you certain that the space (considering origin, orientation, and spacing) occupied by im1 (the template image) overlaps with the space occupied by the vessels in the .tre file? Look at the x, y, z of a vessel centerline point and make certain it occurs within the space of the image.

Also, perhaps take a look at this notebook:
https://github.com/InsightSoftwareConsortium/ITKTubeTK/blob/master/examples/Demo-ITKSpatialObjects.ipynb

It shows another way to look at / render spatial objects, including tubes. It will confirm that you have tubes in your group.

Thanks
Stephen

1 Like

Thank you for your reply sir @Stephen_Aylward.
Actually, I have used both of the files to convert and I think they are giving the same result.

Please the attached Images.My question was how to convert that “outputimage” to .nii format to use as a label?
And why the view of itkwidgets is not working in Jupyter notebook? Are they are linked together?

The output is not surprising - the input and output images occupy the same space. However, it doesn’t tell me if your tubes occupy the space of the image.

Are you using the data provided with TubeTK - the images and the tubes?

To save an image the command is
itk.imwrite(im1, “filename.nii”)

yes ,the same dataset that is provided online by ITKTube.

Have you compiled ITK head from source (not an ITK release, but the head branch of the source code) and enabled TubeTK in cmake?

Regretfully the current pip install of ITK is not compatible with the head of TubeTK.

s

Hi,
Using these code, I got the following result.It seems that the connectivity of blood vessels is not as good as Ali,Why?Did I do something wrong?
TubesToImageFilterType = itk.ConvertTubesToImage[ImageType]
tubesToImageFilter = TubesToImageFilterType.New()
tubesToImageFilter.SetUseRadius(True)
tubesToImageFilter.SetTemplateImage(im1)
tubesToImageFilter.SetInput(tubeG)
tubesToImageFilter.Update()

outputImage = tubesToImageFilter.GetOutput()
view(outputImage)

Hi,

There are two issues that are combining to cause this visualization to look “choppy”.

First, the resolution of the image and the size of the small vessels are nearly the same - as a result, when ConvertTubesToImage is applied and it must decide if a voxel is inside or outside of a vessel, the really small vessels could only partially fill adjacent voxels in such a way that a “gap” seems to appear. This is generally known as “partial voluming”, and slightly blurring and/or dilating an image can help reduce this effect.

Second, the volume rendering transfer function being applied to visualize the image appears to have a sharp step in it that is accentuating the effects of partial voluming. Try smoothing the transfer function to have a more gentle slope and/or move the sharp step to a higher value so that more of the partial voxels are made to appear as “solid” vessel voxels.

Another solution to getting improved visualizations is to convert the .tre file into a VTK surface rendering. That eliminates partial voluming and the need for volume rendering. There is a command-line application included with TubeTK called ConvertTubesToSurface that generates .vtp files from .tre files. It is only available as a command-line tool so it is a bit more challenging to compile and generate it, but I’d be happy to help (perhaps it is best just to send you the executable :slight_smile: ).

Hope this helps,
Stephen

1 Like

This question has puzzled me for a long time, thank you for your detailed answer!

It’s really hard for me to use command-line tool,so,could you please send me the executable?

SongAng