[Insight-users] Topology preserving level sets

Amar Singh amar.singh at gmx.de
Tue Jan 20 11:13:17 EST 2009


Dear ITK-Users

I have been looking for an implementation of the topology preserving 
level-sets ("A Topology Preserving Level Set Method for Deformable 
Models" by Han, Xu and Prince, IEEE PAMI 2003) in ITK and I found the 
following contribution to the ITK mailing list by Charl Botha:
http://osdir.com/ml/lib.itk.user/2004-08/msg00389.html

Unfortunately, I am unable to compile the code and I would like to ask 
if anyone could give me a hint.  I use Ubuntu 7.04 and ITK 2.8.
At first, I copied the code in a header and source file and placed them in my 
.../InsightToolkit-3.8.0/Code/Algorithms folder. I then created a simple 
program that does nothing else but including the header file.
I got the following errors:
/vol/vipdata/users/asingh/workspace/InsightToolkit-3.8.0/Code/Algorithms/itkTPGACLevelSetImageFilter.h:52: 
error: expected ‘,’ or ‘...’ before ‘&’ token
/vol/vipdata/users/asingh/workspace/InsightToolkit-3.8.0/Code/Algorithms/itkTPGACLevelSetImageFilter.h:52: 
error: ISO C++ forbids declaration of ‘IndexType’ with no type
/vol/vipdata/users/asingh/workspace/InsightToolkit-3.8.0/Code/Algorithms/itkTPGACLevelSetImageFilter.txx:279: 
error: expected ‘,’ or ‘...’ before ‘&’ token
/vol/vipdata/users/asingh/workspace/InsightToolkit-3.8.0/Code/Algorithms/itkTPGACLevelSetImageFilter.txx:279: 
error: ISO C++ forbids declaration of ‘IndexType’ with no type
/vol/vipdata/users/asingh/workspace/InsightToolkit-3.8.0/Code/Algorithms/itkTPGACLevelSetImageFilter.txx: 
In member function ‘virtual typename 
itk::TPGACLevelSetImageFilter<TInputImage, TFeatureImage, 
TOutputPixelType>::ValueType itk::TPGACLevelSetImageFilter<TInputImage, 
TFeatureImage, TOutputPixelType>::CalculateUpdateValue(int)’:
/vol/vipdata/users/asingh/workspace/InsightToolkit-3.8.0/Code/Algorithms/itkTPGACLevelSetImageFilter.txx:293: 
error: ‘value’ was not declared in this scope
/vol/vipdata/users/asingh/workspace/InsightToolkit-3.8.0/Code/Algorithms/itkTPGACLevelSetImageFilter.txx:293: 
error: ‘dt’ was not declared in this scope
/vol/vipdata/users/asingh/workspace/InsightToolkit-3.8.0/Code/Algorithms/itkTPGACLevelSetImageFilter.txx:293: 
error: ‘change’ was not declared in this scope
/vol/vipdata/users/asingh/workspace/InsightToolkit-3.8.0/Code/Algorithms/itkTPGACLevelSetImageFilter.txx:308: 
error: ‘idx’ was not declared in this scope

This refers to the following line in the header file and its implementation 
in the source file:
 inline virtual ValueType CalculateUpdateValue(const IndexType &idx, 
const TimeStepType &dt, const ValueType &value, const ValueType &change);

So, "IndexType" and "TimeStepType" are not found.
I realized that this is an error that concerns the header files. Unfortunately, including "itkLevelSetFunction.h" explicitly did not solve the problem concerning  "TimeStepType", actually it didn't change anything. Furthermore, I have the impression that there are several "IndexType" in ITK, aren't there? (telling from executing "find . -name "*.h" -exec grep IndexType {} \;
" in my insight source directory).

I typedef'd IndexType and TimeStepType explicitly, choosing one random IndexType (the only one?):
typedef double TimeStepType;
typedef std::vector<long> IndexType;

By doing so, I could obviously get rid of the above errors, but then I had another warning and an error when I tried the LevelSet filter:
warning:
/.../InsightToolkit-3.8.0/Code/Algorithms/itkTPGACLevelSetImageFilter.txx:302: warning: missing braces around initializer for ‘long unsigned int [3]’
which is referring to line: Size<3> radius = {1,1,1};

and more importantly the error:
/.../xxx.cc:124:   instantiated from here
/.../InsightToolkit-3.8.0/Code/Algorithms/itkTPGACLevelSetImageFilter.txx:308: error: no matching function for call to ‘itk::NeighborhoodIterator<itk::Image<float, 3u>, itk::ZeroFluxNeumannBoundaryCondition<itk::Image<float, 3u> > >::SetLocation(const std::vector<long int, std::allocator<long int> >&)’
/vol/vipdata/users/asingh/workspace/InsightToolkit-3.8.0/Code/Common/itkConstNeighborhoodIterator.h:351: note: candidates are: void itk::ConstNeighborhoodIterator<TImage, TBoundaryCondition>::SetLocation(const itk::Index<itk::ConstNeighborhoodIterator<TImage,TBoundaryCondition>::Dimension>&) [with TImage = itk::Image<float, 3u>, TBoundaryCondition = itk::ZeroFluxNeumannBoundaryCondition<itk::Image<float, 3u> >]

I didn't really expect it to work, since my manual typedef'ing was just a workaround in order to see if that would be the only problem, but I was struck by the change of the iterator type in the proposition of the compiler (NeighborhoodIterator -> ConstNeighborhoodIterator).
I suppose that a lot of things have changed within ITK since the original posting of the code in 2004.
Has anyone compiled this successfully and can highlight the necessary steps for me to get it done?

Thank you very much!

Best regards
Amar




-- 
Sensationsangebot verlängert: GMX FreeDSL - Telefonanschluss + DSL 
für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K1308T4569a


More information about the Insight-users mailing list