[Insight-developers] thread safety (or lack) of transforms

Rupert Brooks rupe.brooks at gmail.com
Wed Aug 13 17:43:08 EDT 2008


Hi

A quick question about thread-safety of transforms.  Are transforms
supposed to be thread safe?  Are specific functions threadsafe and
others not?

The optimized image metrics are specifically designed to duplicate the
transform for each thread.  However, the ResampleImageFilter does not
and neither does the OptResampleImageFilter in the Review directory as
far as I can tell.  So it appears that the ResampleImageFilter assumes
threadsafety and the metrics dont.

I suspect that this is because the GetJacobian function is inherently
not threadsafe, but is not used by the ResampleImageFilter and is used
by the metrics.

Anyway, my question is - does the TransformPoint method of the
transforms have to be threadsafe, or should ResampleImageFilter be
changed?   I ask because I can optimize my modified Kernel transforms
significantly if i do not keep the TransformPoint threadsafe.  This
worked in the image metrics, but blew up in the ResampleFilter when i
tried it.  I was just wondering what the intention was when designing
the multithreaded registration framework.  Briefly - theres
calculations done for the TransformPoint that are also done for the
GetJacobian.  These can be cached, and since the registration
framework tends to call TransformPoint followed by GetJacobian a lot
there is a speed gain.  This could potentially apply to other
transforms, but i cant think of a significant example right off.

Thanks
Rupert

-- 
--------------------------------------------------------------
Rupert Brooks
McGill Centre for Intelligent Machines (www.cim.mcgill.ca)
Ph.D Student, Electrical and Computer Engineering
http://www.cyberus.ca/~rbrooks


More information about the Insight-developers mailing list