[Insight-users] Noise simulation

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Fri Mar 26 19:46:29 EDT 2010


Le 26 mars 10 à 16:27, Oleksandr Dzyubak a écrit :

> Hi Gaëtan,
>
> I downloaded the updated version from your repository that you  
> provided.
> http://mima2.jouy.inra.fr/darcs/contrib-itk/noise/
>
> Below is the result of my tests.
>
> 1)
> The compilation was perfect.

great :-)

>
> 2)
> dzyubak at helium: /Original_Images$ ./median cthead1.tif  
> cthead1_median.png | grep " Number Of Threads"
>
> After Running the median program, I do see any difference
> between original and processed images.
> As I can see, in the median.cxx  you just removed the neighborhood  
> radius.
> What is the purpose of being that utility in the submission?
> Can't be the median.cxx  just removed from the package?
>

It does something here - by default, the radius is 1.
Just try on the output of the salt and pepper filter :-)

   ./sp ../images/cthead1.tif sp.png
   ./median sp.png out.png

it is very efficient for this kind of noise.

> 3)
> dzyubak at helium: /Original_Images$ ./gauss cthead1.tif  
> cthead1_gauss_s22_8_m0.png 22.8 0.0  | grep " Number Of Threads"
> Number Of Threads: 16
>   Global Maximum Number Of Threads: 128
>   Global Default Number Of Threads: 16
>
> The image has the same seeding problem as in the previous version.
> No changes at all.
>

err, yes, my fault. I forgot that this filter was not using the  
mersenne twister generator.
It's fixed now, by using the same random generator as in the other  
filters :-)

> 4)
> dzyubak at helium: /Original_Images$ ./sp cthead1.tif  
> cthead1_sp_001.png 0.01 | grep " Number Of Threads"
>
> Number Of Threads: 16
>   Global Maximum Number Of Threads: 128
>   Global Default Number Of Threads: 16
>
> Surprisingly, now cthead1_sp_001.png looks similar to that
> from your submission.  The incorrect seeding problem is gone.
> Noise really looks random.  However, I noticed that your image is   
> "noisier".
> Did you use the same parameter "0.01" or that is still the seeding  
> problem?

noiser? can your provide the images?

>
> 5)
> The shot and spekle noise generators work fine and my images
> are identical to yours.

great :-)

>
> 6)
> Peak signal to noise ratio. In your submission you have 20 dB. Mine  
> is below.
>
> dzyubak at helium: /Original_Images$ ./psnr cthead1.tif  
> cthead1_median.png
> PSNR: 37.3425 dB
>
> dzyubak at helium: /Original_Images$ ./psnr cthead1.tif  
> cthead1_gauss_s22_8_m0.png
> PSNR: 20.0251 dB
>
> dzyubak at helium: /Original_Images$ ./psnr cthead1.tif  
> cthead1_shot_s015.png
> PSNR: 20.0429 dB
>
> dzyubak at helium: /Original_Images$ ./psnr cthead1.tif  
> cthead1_spekle_s024.png
> PSNR: 20.0901 dB
>
> dzyubak at helium: /Original_Images$ ./psnr cthead1.tif  
> cthead1_sp_001.png
> PSNR: 22.4873 dB
>
> Interesting, the utility says that my salt and pepper is noisier,
> but just visual test yours is as twice noisier. Subjective  judgment?

PSNR is only a (not so bad) approximation of the image degradation as  
perceived by a human.
Our brain very capable to ignore the noise, and for some case like the  
salt and pepper case, the PSNR is not very representative of our  
feeling.

>
> Summing up.
> 1) What is the need for median.cxx ?
> Can't be this utility just removed from the submission?
>
> 2) The seeding problem in the Gauss noise generator is still there.
>
> Regards,
>
> Alex
>
>
> Gaëtan Lehmann wrote:
>>
>> Le 25 mars 10 à 23:27, Gaëtan Lehmann a écrit :
>>
>>>
>>> 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.
>>>
>>
>> This is fixed in the main repository:
>>
>>  http://mima2.jouy.inra.fr/darcs/contrib-itk/noise/
>>
>> As well as the problem you have reported in median.cxx.
>> Please let me know if there is something else wrong!
>>
>> Gaëtan
>>
>>
>>> 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
>>>
>>> _____________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://www.kitware.com/products/protraining.html
>>>
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.itk.org/mailman/listinfo/insight-users
>>
>

-- 
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/20100327/d4d62cd6/attachment-0001.pgp>


More information about the Insight-users mailing list