[Insight-users] Noise simulation

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Thu Mar 25 18:27:58 EDT 2010


Hi Alex,

I think there is a problem with multithreading and the random  
generator - more specifically, the seeds are the same in all the  
threads.
I didn't noticed this on my macbook with only 2 cores, even when  
increasing the number of threads to a higher number than the number of  
cores, but I see the same behavior on my workstation with 16 threads.

How many threads are running in parallel on your system? The number is  
displayed while running one of the noise generator

   [glehmann at gbook build]$ ./shot ../images/cthead1.tif toto.png |  
grep "  Number Of Threads:"
     Number Of Threads: 2
     Number Of Threads: 2

You can limit the number of threads to a small number, or even to 1,  
with

   export ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=1

to workaround the problem.

I will restore the (non thread safe) seeding behavior in  
ThreadSafeMersenneTwisterRandomVariateGenerator and make it thread  
safe with a lock so that 2 threads can't get the same seed.

Thanks for the report!

Gaëtan


Le 25 mars 10 à 22:47, Oleksandr Dzyubak a écrit :

> Dear ITK users,
>
> Did anybody tested the noise simulation codes from the submission
> "Noise simulation" http://hdl.handle.net/10380/3158 ?
> The most needed (for me at least) noise generators
> (Gauss and salt and pepper)
> produce corrupted images with periodic line patterns
> (see attached images). To generate those images, I followed
> the parameter recommendations taken from the submission.
>
> ./gauss cthead1.tif cthead1_gauss_s22_8_m0.png 22.8 0
> ./sp cthead1.tif cthead1_sp_0016.png 0.016
>
> Did anybody get similar results?
>
> Alex
>
>
>
> Oleksandr Dzyubak wrote:
>> Hi Gaëtan,
>>
>> Nice and long awaited work.
>> I found a tiny typo in your code that prevents the submitted codes  
>> from
>> being compiled.
>> At least on my Linux box. The typo is sitting in your median.cxx  
>> and the
>> fix is below.
>>
>> // Part that gives the errors.
>> /*
>> FilterType::RadiusType r;
>> r.Fill(2);
>> //  filter->SetRadius(r);
>> */
>>
>> //  this fix solves the problem.
>> IType::SizeType r;
>> r[0] = 1;
>> r[1] = 1;
>> filter->SetRadius(r);
>>
>> Could you please add the fix and upload the code?
>>
>> Thanks,
>> Alex
>>
>
> <cthead1_gauss_s22_8_m0.png><cthead1_sp_0016.png>

-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr  http://www.itk.org
http://www.mandriva.org  http://www.bepo.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100325/e20a7f65/attachment.pgp>


More information about the Insight-users mailing list