ITK Vessels segmentation code


  1. I am trying to run Vessels segmentation program from

But I am getting following error -
fatal error: itkMultiScaleHessianBasedMeasureImageFilter.h: No such file or directory

Also I am unable to understand that in this program, for Input what should I give 2D image/slice or 3D volume /series?
And how to choose the sigma values?

  1. Also I tried the program from

But still not getting an error -
itk::ExceptionObject (0x1682ae0)
Location: “void itk::RecursiveSeparableImageFilter<TInputImage, TOutputImage>::BeforeThreadedGenerateData() [with TInputImage = itk::Image<float, 3>; TOutputImage = itk::Image<float, 3>]”
File: /usr/local/include/ITK-4.13/itkRecursiveSeparableImageFilter.hxx
Line: 245
Description: itk::ERROR: RecursiveGaussianImageFilter(0x164fc50): The number of pixels along direction 2 is less than 4. This filter requires a minimum of four pixels along the dimension to be processed.

In this program dimension is 3. So should I give series as input? And how to select sigma and alpha values for vessels segmentation?

Please help me to solve this error.

The first example uses 2D images as input, the second one uses 3D images.

As answered on stack overflow, you need to set CMake variable Module_ITKReview to ON when configuring ITK.

You should change Dimension to be 2 if you are working with 2D images. 2D images have 1 pixel along third axis.

As to choosing proper sigma values, they should be close in size to the vessels present in the image. But you will have to experiment with different sizes to find the appropriate one for your task.

Thank you for the help.
Its working.

But I have one more doubt.
For following program -
strong text
If I changed the dimension = 2 in program, then I am getting following error. (attached in pdf)print.pdf (18.5 KB)
print1.pdf (16.9 KB)

How to solve it? & What changes should I do in program for dimension =2 ?

And also if I want to keep the dimension = 3, then it means i should provide 3D data ie. complete series of slices. Is it correct?
And for header file “itkImageSeriesReader” should include in program. It will work then?

The filter Hessian3DToVesselnessMeasureImageFilter is working only with 3D images, as its name implies. I guess the first example can be adjusted to work with different image dimensions, whereas the second one only works with 3D images.

That is correct. And you could use itkImageSeriesReader, or convert your series to a single-file 3D image (.mha, .nrrd etc) using e.g. Slicer.

I tried this Hessian3DToVesselnessMeasureImageFilter with my dicom series. But I am getting following error.

Error: In /home/PVirkar/bin/ITK/InsightToolkit-4.13.2/Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat/gdcmPixmapWriter.cxx, line 649, function bool gdcm::PixmapWriter::PrepareWrite(const gdcm::MediaStorage&)
Problem with NumberOfDimensions and MediaStorage

itk::ExceptionObject (0x238bab0)
Location: “virtual void itk::GDCMImageIO::Write(const void*)”
File: /home/PVirkar/bin/ITK/InsightToolkit-4.13.2/Modules/IO/GDCM/src/itkGDCMImageIO.cxx
Line: 1232
Description: itk::ERROR: GDCMImageIO(0x2342980): DICOM does not support this component type

I used signed short and unsigned int as pixel types (because it supports Dicom series) and dimension = 3.
But still I don’t understand why error showing “DICOM does not support this component type”

Also I would like to get a single dicom file as output, ie i am using itkImageFileWriter.

Not all combinations of pixel types etc are valid for DICOM. Try writing into a different format, e.g. .mha or .nrrd. If that succeeds, you can then try to figure out what is the problem with DICOM.

1 Like


I have again tried the example mentioned on

It is working with 2D DICOM image.
But when I modified the program to work with 3D Volume (by providing series of dicom slices), i am getting following memory allocation error.

Exception thrown while writing the series

itk::MemoryAllocationError (0x7fe504000950)
Location: “TElement* itk::ImportImageContainer<TElementIdentifier, TElement>::AllocateElements(itk::ImportImageContainer<TElementIdentifier, TElement>::ElementIdentifier, bool) const [with TElementIdentifier = long unsigned int; TElement = itk::SymmetricSecondRankTensor<double, 3>; itk::ImportImageContainer<TElementIdentifier, TElement>::ElementIdentifier = long unsigned int]”
File: /usr/local/include/ITK-5.0/itkImportImageContainer.hxx
Line: 199
Description: Failed to allocate memory for image.

What should I do to solve this error?
thanks in advance.

You could increase your virtual memory, or run the pipeline in a streaming fashion.

1 Like

How to run this streaming example with my vessel segmentation code?
Sorry But i don’t understand how to use this streaming example in my code.
And how to make pipeline using it?
Could you provide some code for it?

Chapter 8.3 in software guide has more information about it.

1 Like