Now, I need to extract the skeleton for a 3D mask. And I find the itkBinaryThinningImageFilter is useful for 2D mask, and it doesn’t work for a 3D mask.
Can ITK extract the skeleton for a 3D mask?
Now, I need to extract the skeleton for a 3D mask. And I find the itkBinaryThinningImageFilter is useful for 2D mask, and it doesn’t work for a 3D mask.
Can ITK extract the skeleton for a 3D mask?
itkBinaryThinningImageFilter works for 3D volumes. Does it take too long to run or do you experience other issue?
You could also take a look at ITKThickness3D remote module. Enabling Module_Thickness3D
when configuring ITK should make that module available.
Yes, it take about 280s for a 512512498 volume in release version, while it take about 9 s by Python (skimage.morphology.skeletonize_3d).
My code is:
constexpr unsigned int Dimension = 3;
using PixelType = float;
using ImageType = itk::Image< PixelType, Dimension >;
using ImageReaderType = itk::ImageFileReader<ImageType>;
ImageReaderType::Pointer reader = ImageReaderType::New();
reader->SetFileName("..\\mask.mha");
reader->Update();
ImageType::Pointer itkImage = reader->GetOutput();
using BinaryThinningImageFilterType = itk::BinaryThinningImageFilter<ImageType, ImageType>;
BinaryThinningImageFilterType::Pointer binaryThinningImageFilter = BinaryThinningImageFilterType::New();
binaryThinningImageFilter->SetInput(itkImage);
binaryThinningImageFilter->Update();
Why ITK take so long time to calculate the skeleton? Is there any method to make the time shorter?
Thank you for your suggestion. I am try to use this module. In addition, after obtaining the skeleton of a volume, how can I get the network of the skeleton?
In python, the skan module can obtain the skeleton graph. Thus, we can obtain the cross section image along the medial axis.
You can use SGEXT, a library that I develop and maintain, which uses a less noisy skeletonization algorithm, and also generates a graph (what you called a network) from it. Also includes tools to manipulate graphs, and other modules specific to my research.
I am right now parallelizing the 3D thinning algorithm to make it faster. The library is not yet in a super-easy to use state (it will be), but I encourage you to try it if you need its functionality. In the short future it will also be completely wrapped to use in python (right now is at 70%).
Thank you very much. We will test the SGEXT in our project.
Sounds great. Is it going to be available in ITK, too?
I would love too, but too much effort for the gain to be honest, not in my list of priorities. Also, DGtal has a GPL license, which will limit the benefits of having it in ITK.
Having said that, I would really love to integrate a digital topology module in ITK, @Niels_Dekker contribution of range neighbor iterators would greatly ease up its development.