[Insight-developers] Threads and WarpImageFilter

Miller, James V (Research) millerjv at crd . ge . com
Wed, 10 Dec 2003 12:57:10 -0500


Vincent,

(I don't see the images on this email, register+warp.jpg, warp-only.jpg).

Here are some questions/things to try:

Is there any setting for the number of threads that produces a good image
other than 1?

What are the sizes of the images and how many threads are you trying to 
use?

In WarpImageFilter::ThreadedGenerateData() print out the
outputRegionForThread.  This is a little tricky to do because you need to
block the other threads 
while you print.  I usually use code something like this:

static SimpleFastMutexLock lock;
lock.Lock();
std::cerr << "Thread: " << threadId << ", Region = " << 
         outputRegionForThread << std::endl;
lock.UnLock();

Send me the print out of the regions and we'll see if any pixel is missed or
any pixel is modified twice. If it is the latter, then I know what the
problem
is.

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