ITK python vessel segmentation

Hi all,

I am new to ITK and trying to do some work about brain vessel segmentation using ITK python. But I have no idea how to use those filters such as HessianRecursiveGaussianImageFilter and Hessian3DToVesselnessMeasureImageFilter in python using itk python module. Is there any detailed documentation about the usage of the these filters in python?

Thank you so much.

Hi @albert,
you may find some C++ use case of the itk::Hessian3DToVesselnessMeasureImageFilter and itk::HessianRecursiveGaussianImageFilter filters in the ITK SegmentBloodVessels example.

The example is unfortunately missing the Python code :bowing_man: :bowing_woman: . Both filters have their Python wrapping, so it should be fairly straightforward :rocket: to contribute to the example with the missing Python code.

Let me know should you need some help contributing with the Python code.


I went ahead and implemented the Python version of SegmentBloodVessels here :snake: . @albert @jhlegarreta please take a look and also review the pull request.

@albert a good exercise and way to contribute to the community, as suggested by @jhlegarreta, is to provide a Python conversion for the multi-scale vessel enhancement example.

@jhlegarreta @matt.mccormick, thank you for your quick answers. I have tried implementing the python script using these filters by myself and it works. But I’m unclear how to contribute to provide the missing python code for the examples.

Sounds awesome @albert !

First you’d need to create a GitHub account if you haven’t got one, then you’d fork the ITKExamples repository. You’d then clone it, and configure your origin and upstream remotes to point to your fork and the upstream/ITK repositories respectively.

Then the you typically create a new branch, e.g.

 git checkout -b AddMyExample origin/master

where AddMyExample should be a meaningful name for your example. You’d then add your files to the commit, add a meaningful, self-contained and complete commit message, push your branch to your origin, and GitHub would suggest opening a Pull Request. You’d be willing to add reviewers to approve or suggest modifications to the PR. You can add me or other fellows, for example.

If by (…) implementing the Python script (…) you mean the multi-scale vessel enhancement example Matt pointed, that would be it. Do not forget to add your Python file to the CMakeLists.txt file, and to the reSTructured Text (*.rst) file that is finally rendered, much like Matt did for his PR. Matt also took advantage to increase consistency in the code style, which would also be great for the mentioned example if necessary.

If by (…) implementing the Python script (…) you mean a complete new example, that would also be great. You’d need to create a new folder in the same category of the mentioned examples, and provide the CMakeLists.txt file, the *.rst file, the C++ Code.cxx and Python files, and the SHA512 files of the images produced. Once you have your output images, ITK provides a few ways to generate the hashes.

The complete contributing manual is found here.

Let us know if this works for you.

Thanks for your contributions.

1 Like