[Insight-users] Non thread-safe transform in itk::ResampleImageFilter

Julien Michel julien.michel at c-s.cnes.fr
Wed Mar 5 08:33:26 EST 2008


Dear itk users,

We have developped some sub-classes of itk::Transform, in which the 
output point is computed using another library. Unfortunately, it 
appears that the object and the method we use in this library are not 
thread safe (it implies allocation and free of some members ...). So 
using the itk::ResampleImageFilter with these transforms on a 
multi-processors environnement leads to segmentation fault.

The best would be to allocate one instance of this external library 
object per thread, but inside the TransformPoint() method from 
itk::Transform, we do not know neither if we are multi-threaded nor the 
thread id.

I found that the itk::Transform method has a version of the 
TransformPoint() method taking a thread id as argument, but it is 
wrapped  with an itkNotUsedMacro(), and the ResampleImageFilter does not 
seem to use it. Comments say that this method is keeped to preserve 
backward compatibility. Morover, the itk::ResampleImageFilter does not 
use this implementation. Is their a way to use this TransformPoint() 
with thread id ?

The other solution would be to maintain a pool of objects with 
associated mutex inside our transform, but it is rather inelegant ...

Thanks a lot for you help,
Best regards,

Julien Michel


More information about the Insight-users mailing list