Sure, that will work well for everyone.<br><br>Kishore<br><br>2010/4/1 Gaëtan Lehmann <span dir="ltr"><<a href="mailto:gaetan.lehmann@jouy.inra.fr">gaetan.lehmann@jouy.inra.fr</a>></span><br><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br>
Le 2 avr. 10 à 01:42, Kishore Mosaliganti a écrit :<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Gaetan,<br>
<br>
</blockquote>
<br>
Hi Kishore,<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I found that in the itkSaltAndPepperNoiseImageFilter, it would be more useful if the values m and M be computed from the minima and minima in the image.<br>
<br>
Currently, you are taking the pixel type maxima and minima which precludes the use of int or double or float pixel types in the image model with a narrow dynamic range of data.<br>
<br>
Does that sound reasonable ?<br>
</blockquote>
<br></div>
That may not produce the expected behavior, because the maximum/minimum may not be the expected value. In the example image for example, the maximum is 200 (on purpose, to avoid saturating the pixel values when adding noise), but I do want a salt and pepper in the range [0 255].<br>
<br>
I had the same problem with the PSNR computation, where the maximum possible value of the pixel type should be used. To make it usable with pixel types which are not the ones used in the image format, the value used was measured as the maximum value in the image, but with that same example image, the value was not the expected one.<br>
<br>
In both cases, maybe the values should default to the maximum/minimum possible value, but be modifiable by the user with the usual Set/Get methods.<br>
<br>
Does it sound like reasonable option?<br><font color="#888888">
<br>
Gaëtan</font><div><div></div><div class="h5"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Kishore<br>
<br>
<br>
2010/4/1 Gaëtan Lehmann <<a href="mailto:gaetan.lehmann@jouy.inra.fr" target="_blank">gaetan.lehmann@jouy.inra.fr</a>><br>
<br>
Hi,<br>
<br>
Le 30 mars 10 à 17:40, Oleksandr Dzyubak a écrit :<br>
<br>
Hi Gaëtan,<br>
<br>
I have done my homework.<br>
<br>
1) I studied the ITK header.<br>
<br>
InsightToolkit/Common/itkMersenneTwisterRandomVariateGenerator.h<br>
<br>
In that header the link to the inventors' web page<br>
<a href="http://www.math.keio.ac.jp/%7Ematumoto/emt.html" target="_blank">www.math.keio.ac.jp/~matumoto/emt.html</a> is dead.<br>
The correct and still alive one is below.<br>
<br>
<a href="http://www.math.sci.hiroshima-u.ac.jp/%7Em-mat/MT/emt.html" target="_blank">http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html</a><br>
<br>
2) I have also read the article by the inventors<br>
M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator", ACM Trans. on Modeling and Computer Simulation Vol. 8, No. 1, January pp.3-30 (1998).<br>
<br>
This classical article (along with others) can be downloaded from<br>
the Makoto Matsumoto's home page.<br>
<br>
<a href="http://www.math.sci.hiroshima-u.ac.jp/%7Em-mat/MT/ARTICLES/earticles.html" target="_blank">http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/ARTICLES/earticles.html</a><br>
<br>
3) From that article: "A new algorithm called Mersenne Twister<br>
is proposed for generating uniform pseudorandom numbers."<br>
Period is (2^ 19937) - 1, 632-dimensional equidistribution up to 32-bit accuracy.<br>
So the period is a such huge number<br>
that this generator could be considered as a "true random".<br>
<br>
Sounds good :-)<br>
<br>
<br>
<br>
4) New debugged and updated release 2009/11/17 of the generator<br>
can be downloaded using link below.<br>
<br>
<a href="http://www.math.sci.hiroshima-u.ac.jp/%7Em-mat/MT/SFMT/index.html" target="_blank">http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html</a><br>
<br>
<br>
5) I downloaded and tested the updated code version from the link you provided.<br>
<a href="http://mima2.jouy.inra.fr/darcs/contrib-itk/noise/" target="_blank">http://mima2.jouy.inra.fr/darcs/contrib-itk/noise/</a><br>
<br>
a) Compiles -- fine.<br>
b) Works -- fantastic.<br>
c) Tested images are identical to those provided in the submission.<br>
<br>
Great!<br>
<br>
<br>
<br>
6) Could you upload the revised version to the Insight Journal?<br>
I would be more than happy to write a review and<br>
recommend to add it to the ITK library.<br>
<br>
<br>
I just tried, but I'm still stuck at that stage <a href="http://insight-journal.com/submit/step10/59" target="_blank">http://insight-journal.com/submit/step10/59</a>, as for the fftconv contrib.<br>
Julien, did you have a chance to look at that?<br>
<br>
<br>
Thanks for nice work,<br>
<br>
Thanks a lot for your very useful report and comments<br>
<br>
Gaëtan<br>
<br>
<br>
<br>
Alex<br>
<br>
<br>
Gaëtan Lehmann wrote:<br>
<br>
Le 29 mars 10 à 15:54, Oleksandr Dzyubak a écrit :<br>
<br>
<br>
Hi Gaëtan,<br>
<br>
<br>
Hi Alex,<br>
<br>
Whenever I try to send images using a regular email client,<br>
my emails get bounced. So I used the web page uploader<br>
from <a href="http://nabble.com" target="_blank">nabble.com</a> to send the images. I hope you also got a copy.<br>
If not, below is the link to the images.<br>
<br>
<a href="http://old.nabble.com/Noise-simulation-to27990624.html#a28069421" target="_blank">http://old.nabble.com/Noise-simulation-to27990624.html#a28069421</a><br>
<br>
I'd say there is a small difference between the two images, but that's a random process :-)<br>
<br>
<br>
About median.cxx. In your submission you use it<br>
just as a denoiser to demonstrate that it works nice on, in particular, images<br>
with "salt-and-pepper", right?<br>
<br>
I included it to experiment a bit with PSNR calculator and denoising. That's really a not much useful program - I didn't event mentioned it in the paper!<br>
<br>
<br>
About the generator. How good is it? Is it random or chaotic?<br>
What is the cycle?<br>
<br>
I can't say at all. I simply modified the Mersenne Twister generator from ITK to make it thread safe.<br>
I actually don't have much skills in random generator.<br>
<br>
<br>
You say that the Gauss has been fixed.<br>
Is it possible the get the updated version?<br>
<br>
<br>
Sure! It is in the main development repository.<br>
<br>
<a href="http://mima2.jouy.inra.fr/darcs/contrib-itk/noise/" target="_blank">http://mima2.jouy.inra.fr/darcs/contrib-itk/noise/</a><br>
<br>
I think I didn't say that you can use darcs to get it (<a href="http://www.darcs.net" target="_blank">http://www.darcs.net</a>)<br>
<br>
darcs get <a href="http://mima2.jouy.inra.fr/darcs/contrib-itk/noise/" target="_blank">http://mima2.jouy.inra.fr/darcs/contrib-itk/noise/</a><br>
<br>
Thanks,<br>
<br>
Gaëtan<br>
<br>
<br>
Thanks,<br>
<br>
Alex<br>
<br>
Gaëtan Lehmann wrote:<br>
<br>
Le 26 mars 10 à 16:27, Oleksandr Dzyubak a écrit :<br>
<br>
Hi Gaëtan,<br>
<br>
I downloaded the updated version from your repository that you provided.<br>
<a href="http://mima2.jouy.inra.fr/darcs/contrib-itk/noise/" target="_blank">http://mima2.jouy.inra.fr/darcs/contrib-itk/noise/</a><br>
<br>
Below is the result of my tests.<br>
<br>
1)<br>
The compilation was perfect.<br>
<br>
great :-)<br>
<br>
<br>
2)<br>
dzyubak@helium: /Original_Images$ ./median cthead1.tif cthead1_median.png | grep " Number Of Threads"<br>
<br>
After Running the median program, I do see any difference<br>
between original and processed images.<br>
As I can see, in the median.cxx you just removed the neighborhood radius.<br>
What is the purpose of being that utility in the submission?<br>
Can't be the median.cxx just removed from the package?<br>
<br>
<br>
It does something here - by default, the radius is 1.<br>
Just try on the output of the salt and pepper filter :-)<br>
<br>
./sp ../images/cthead1.tif sp.png<br>
./median sp.png out.png<br>
<br>
it is very efficient for this kind of noise.<br>
<br>
3)<br>
dzyubak@helium: /Original_Images$ ./gauss cthead1.tif cthead1_gauss_s22_8_m0.png 22.8 0.0 | grep " Number Of Threads"<br>
Number Of Threads: 16<br>
Global Maximum Number Of Threads: 128<br>
Global Default Number Of Threads: 16<br>
<br>
The image has the same seeding problem as in the previous version.<br>
No changes at all.<br>
<br>
<br>
err, yes, my fault. I forgot that this filter was not using the mersenne twister generator.<br>
It's fixed now, by using the same random generator as in the other filters :-)<br>
<br>
4)<br>
dzyubak@helium: /Original_Images$ ./sp cthead1.tif cthead1_sp_001.png 0.01 | grep " Number Of Threads"<br>
<br>
Number Of Threads: 16<br>
Global Maximum Number Of Threads: 128<br>
Global Default Number Of Threads: 16<br>
<br>
Surprisingly, now cthead1_sp_001.png looks similar to that<br>
from your submission. The incorrect seeding problem is gone.<br>
Noise really looks random. However, I noticed that your image is "noisier".<br>
Did you use the same parameter "0.01" or that is still the seeding problem?<br>
<br>
noiser? can your provide the images?<br>
<br>
<br>
5)<br>
The shot and spekle noise generators work fine and my images<br>
are identical to yours.<br>
<br>
great :-)<br>
<br>
<br>
6)<br>
Peak signal to noise ratio. In your submission you have 20 dB. Mine is below.<br>
<br>
dzyubak@helium: /Original_Images$ ./psnr cthead1.tif cthead1_median.png<br>
PSNR: 37.3425 dB<br>
<br>
dzyubak@helium: /Original_Images$ ./psnr cthead1.tif cthead1_gauss_s22_8_m0.png<br>
PSNR: 20.0251 dB<br>
<br>
dzyubak@helium: /Original_Images$ ./psnr cthead1.tif cthead1_shot_s015.png<br>
PSNR: 20.0429 dB<br>
<br>
dzyubak@helium: /Original_Images$ ./psnr cthead1.tif cthead1_spekle_s024.png<br>
PSNR: 20.0901 dB<br>
<br>
dzyubak@helium: /Original_Images$ ./psnr cthead1.tif cthead1_sp_001.png<br>
PSNR: 22.4873 dB<br>
<br>
Interesting, the utility says that my salt and pepper is noisier,<br>
but just visual test yours is as twice noisier. Subjective judgment?<br>
<br>
PSNR is only a (not so bad) approximation of the image degradation as perceived by a human.<br>
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.<br>
<br>
<br>
Summing up.<br>
1) What is the need for median.cxx ?<br>
Can't be this utility just removed from the submission?<br>
<br>
2) The seeding problem in the Gauss noise generator is still there.<br>
<br>
Regards,<br>
<br>
Alex<br>
<br>
<br>
Gaëtan Lehmann wrote:<br>
<br>
Le 25 mars 10 à 23:27, Gaëtan Lehmann a écrit :<br>
<br>
<br>
Hi Alex,<br>
<br>
I think there is a problem with multithreading and the random generator - more specifically, the seeds are the same in all the threads.<br>
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.<br>
<br>
How many threads are running in parallel on your system? The number is displayed while running one of the noise generator<br>
<br>
[glehmann@gbook build]$ ./shot ../images/cthead1.tif toto.png | grep " Number Of Threads:"<br>
Number Of Threads: 2<br>
Number Of Threads: 2<br>
<br>
You can limit the number of threads to a small number, or even to 1, with<br>
<br>
export ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=1<br>
<br>
to workaround the problem.<br>
<br>
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.<br>
<br>
<br>
This is fixed in the main repository:<br>
<br>
<a href="http://mima2.jouy.inra.fr/darcs/contrib-itk/noise/" target="_blank">http://mima2.jouy.inra.fr/darcs/contrib-itk/noise/</a><br>
<br>
As well as the problem you have reported in median.cxx.<br>
Please let me know if there is something else wrong!<br>
<br>
Gaëtan<br>
<br>
<br>
Thanks for the report!<br>
<br>
Gaëtan<br>
<br>
<br>
Le 25 mars 10 à 22:47, Oleksandr Dzyubak a écrit :<br>
<br>
Dear ITK users,<br>
<br>
Did anybody tested the noise simulation codes from the submission<br>
"Noise simulation" <a href="http://hdl.handle.net/10380/3158" target="_blank">http://hdl.handle.net/10380/3158</a> ?<br>
The most needed (for me at least) noise generators<br>
(Gauss and salt and pepper)<br>
produce corrupted images with periodic line patterns<br>
(see attached images). To generate those images, I followed<br>
the parameter recommendations taken from the submission.<br>
<br>
./gauss cthead1.tif cthead1_gauss_s22_8_m0.png 22.8 0<br>
./sp cthead1.tif cthead1_sp_0016.png 0.016<br>
<br>
Did anybody get similar results?<br>
<br>
Alex<br>
<br>
<br>
<br>
Oleksandr Dzyubak wrote:<br>
Hi Gaëtan,<br>
<br>
Nice and long awaited work.<br>
I found a tiny typo in your code that prevents the submitted codes from<br>
being compiled.<br>
At least on my Linux box. The typo is sitting in your median.cxx and the<br>
fix is below.<br>
<br>
// Part that gives the errors.<br>
/*<br>
FilterType::RadiusType r;<br>
r.Fill(2);<br>
// filter->SetRadius(r);<br>
*/<br>
<br>
// this fix solves the problem.<br>
IType::SizeType r;<br>
r[0] = 1;<br>
r[1] = 1;<br>
filter->SetRadius(r);<br>
<br>
Could you please add the fix and upload the code?<br>
<br>
Thanks,<br>
Alex<br>
<br>
<br>
<cthead1_gauss_s22_8_m0.png><cthead1_sp_0016.png><br>
<br>
-- <br>
Gaëtan Lehmann<br>
Biologie du Développement et de la Reproduction<br>
INRA de Jouy-en-Josas (France)<br>
tel: +33 1 34 65 29 66 fax: 01 34 65 29 09<br>
<a href="http://voxel.jouy.inra.fr" target="_blank">http://voxel.jouy.inra.fr</a> <a href="http://www.itk.org" target="_blank">http://www.itk.org</a><br>
<a href="http://www.mandriva.org" target="_blank">http://www.mandriva.org</a> <a href="http://www.bepo.fr" target="_blank">http://www.bepo.fr</a><br>
<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
-- <br>
Gaëtan Lehmann<br>
Biologie du Développement et de la Reproduction<br>
INRA de Jouy-en-Josas (France)<br>
tel: +33 1 34 65 29 66 fax: 01 34 65 29 09<br>
<a href="http://voxel.jouy.inra.fr" target="_blank">http://voxel.jouy.inra.fr</a> <a href="http://www.itk.org" target="_blank">http://www.itk.org</a><br>
<a href="http://www.mandriva.org" target="_blank">http://www.mandriva.org</a> <a href="http://www.bepo.fr" target="_blank">http://www.bepo.fr</a><br>
<br>
<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br>
<br>
</blockquote>
<br>
-- <br>
Gaëtan Lehmann<br>
Biologie du Développement et de la Reproduction<br>
INRA de Jouy-en-Josas (France)<br>
tel: +33 1 34 65 29 66 fax: 01 34 65 29 09<br>
<a href="http://voxel.jouy.inra.fr" target="_blank">http://voxel.jouy.inra.fr</a> <a href="http://www.itk.org" target="_blank">http://www.itk.org</a><br>
<a href="http://www.mandriva.org" target="_blank">http://www.mandriva.org</a> <a href="http://www.bepo.fr" target="_blank">http://www.bepo.fr</a><br>
<br>
</div></div></blockquote></div><br>