[Insight-developers] Threads and WarpImageFilter

Miller, James V (Research) millerjv at crd . ge . com
Fri, 12 Dec 2003 09:25:02 -0500


Vince, 

I checked in a fix to ITK that solves the problem you reported.  

The RGBToVectorPixelAccessor and VectorToRGBPixelAccessor were not
thread safe.  The accessor was returning a reference to an ivar as
the "converted" data value.  So multiple threads were writing/reading
to this one ivar at the same time. I changed the code to use a local
variable.

If you update Code/Common/itkRGBToVectorPixelAccessor.h, you should be 
all set.

Jim



-----Original Message-----
From: Vincent A. Magnotta [mailto:vincent-magnotta at uiowa . edu]
Sent: Wednesday, December 10, 2003 9:18 AM
To: insight-developers at itk . org
Subject: [Insight-developers] Threads and WarpImageFilter


I am trying to load deformation fields from a file (actually three
files) and then apply the deformation fields to an image. I started out
by modifying the Thirion Demons image registration application and
saving the deformation fields as three analyze files (one for each
direction x, y and z). If I use the WarpImageFilter in this program I
can warp the images and the output looks fine (register+warp.jpg). If I
load the deformation fields from disk and warp the image the result
looks like noise gets into the data (warp-only.jpg). If I make set the
maximum number of threads to be 1 before warping my output image does
not have this artifact. Does anyone have ideas why this may occur?

Attached is a little stand along program that contains the warping
procedure that exhibits the problem. 

Thanks,
Vince

-- 
Assistant Professor
Department of Radiology
0437 JCP
E-mail: vincent-magnotta at uiowa . edu
Phone: 319-356-8255
Fax: 319-353-6275
Website: http://www . radiology . uiowa . edu