How to open a centerline 3d image in 3dslicer?

Operating system: ubuntu 20
Slicer version:4.11.20210226
Expected behavior: open a centerline image as expected
Actual behavior: opens the centerline image abnormally

I have extracted the center line of my label map images using bwskel function in matlab. I would like to open them in slicer. When I open them in matlab with volumeViewer it show that correctly as image below but when I open in slicer it shows a weird image. Why this happen and a how can I see the center line binary image in slicer as I see in matlab?

In matlab centerline image appeared as yellow lines:

In slicer centerline image appeared as :


Probably the matlab code is saving with options Slicer doesn’t expect. What format do you use for saving?

I am using nii.gz format for saving. Might be related to data type (uint, o so?)?

Most .nii.gz file load fine in Slicer but it’s not a great format for general purpose work for a lot of reasons. You could try nrrd or another format.

1 Like

You may try to turn off smoothing (in “Advanced create…” in Segmentations module), because smoothing may remove isolated voxels and very thin structures.

However, your rendering in Matlab looks like a quite low quality centerline extraction (looks like a very basic skeletonization). I would not bother even trying to read this data because it is unlikely that you could use it for anything. Instead, you can extract high-quality centerline, metrics, statistics, connectivity information, etc. using SlicerVMTK extension.

Thanks for helping . Unfortunately I could not find the option of "Advanced create’ in segmentation module. I have attached the picture which I see in the segmentation module and would be thankful if you could elaborate on the steps to find the advanced create for turning off the smoothing.

I have seen the skeletonization filter in 3d slicer and that does not have skeletonization in 3D. Also about the slicervmtk , it requires that I define the beginning and end of the path of center line manually which is not possible for many data that I have. Furthermore, as seen , my image has 4 main branches of pulmonary veins and providing the seed point of each of four takes so much time and is impossible. Even with trying the seed points the results with slicer was not acceptable. Please let me know if I have missed anything.

Long-click (hold down the left mouse button until the menu appears):


The module performs skeletonization in 3D. Why do you think it is not doing that?

You have the option of specifying endpoints manually, which is a very useful feature, but normally you just click “Auto-detect” to get all the endpoints automatically in a few seconds.

No problem at all, automatic endpoint detection should work well. If the segmented surface is noise then you may have more endpoints than you want, in that case you may either slightly smooth the segmentation, cut of small branches, or remove some of the detected endpoints.

It should be good. Something like this (blue network, green is centerline extraction result):

Could you attach a screenshot that illustrates the problem you ran into?

Thanks a lot the issue was resolved with turn off the smoothing and I can see the binary centerline correctly.
I had not tried the automatic end point detection and just tried it and it works very well with a bit error as some end points are joined together as seen. How to correct them and how to write a code in python to be able to automatically extract centerline for all images without loading them one by one in slicer and save them?

If you search the forum archives for vmtk and centerlines I’m pretty sure this has already been answered. Maybe someone who uses vmtk can jump in here.

In some cases it does not provide the centerline on some branches. here I first used automatic endpoint and then added manually some on the parts that did not get the endpoint . However, still the centerline cannot be obtained on some branches. Hoe can I get those in?

Which Slicer version did you encounter this problem with?

the version was 4.11

That should work. Then most likely the issue is that inside the left atrium, the concept of a centerline does not exist. You may want to specify a vessel endpoint at the origin of each vessel branch.