[Insight-users] Noise simulation

Oleksandr Dzyubak adzyubak at gmail.com
Thu Mar 25 20:26:07 EDT 2010


Hi Gaëtan,

Yes, you are right. In my case I have 16 threads which creates a problem.

dzyubak at helium: /Original_Images$ ./shot cthead1.tif toto.png | grep "  
Number Of Threads:"
  Number Of Threads: 16
  Number Of Threads: 16

Alex

Gaëtan Lehmann wrote:
>
> 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>
>



More information about the Insight-users mailing list