[Insight-users] Generate gaussian noise image

Wok wokitk at gmail.com
Thu Mar 6 17:03:20 EST 2014


2014-03-06 23:00 GMT+01:00 Wok <wokitk at gmail.com>:
>> I noticed that the gaussian filter does not call Initialize of the NormalVariateGenerator, but I tried to add it, and it doesn't make any difference.
>
> As mentioned before, the thing is you can input a seed to Initialize.
>>  void itk::Statistics::NormalVariateGenerator::Initialize ( int  randomSeed)
>
> If your assumption about the threads is correct, I would fix the bug
> by modifying:
>> https://github.com/midas-journal/midas-journal-721/blob/master/noise/itkAdditiveGaussianNoiseImageFilter.txx
>
> so that Initialize is called with threadId.
>> template <class TInputImage, class TOutputImage> void AdditiveGaussianNoiseImageFilter<TInputImage, TOutputImage>
> ::ThreadedGenerateData( const OutputImageRegionType
> &outputRegionForThread, int threadId)
>
> Best,
>
> Wok
>
> 2014-03-06 22:40 GMT+01:00 Laurent Chauvin <lchauvin at bwh.harvard.edu>:
>> Do you mean ask the user to input a number (always different) for each
>> thread ?
>>
>> Thank you.
>> -Laurent
>>
>>
>> On Thu, Mar 6, 2014 at 4:32 PM, Bradley Lowekamp <blowekamp at mail.nih.gov>
>> wrote:
>>>
>>> I haven't looked at the classes closely. But would expect these filters
>>> have a user settable seed, to make the results reproduce able, and be the
>>> same independent with the number of threads.
>>>
>>> The trick would be to have each thread has a random number generator
>>> object, then at the beginning of each line seed it with a combination of the
>>> user defined seed, and the starting index of the scan-line ( perhaps
>>> multiplied by a prime number).
>>>
>>> Hope that some help... I just have some ideas in my head about some ways
>>> to do it...
>>>
>>> Brad
>>>
>>> On Mar 6, 2014, at 4:26 PM, Laurent Chauvin <lchauvin at bwh.harvard.edu>
>>> wrote:
>>>
>>> It actually works but you have to force the filter to only use 1 thread.
>>>
>>> I think otherwise all threads got the same "random" values, which generate
>>> same output for all threads.
>>> My guess is the image is divided in 'lines' or 'column', each of them
>>> managed by a separated thread. If all threads have same random values, then
>>> the output will be patterned.
>>>
>>> If it's possible to have different random values for each threads, then it
>>> should be possible to run it with multiple threads.
>>> I think one possibility would be to use a timestamp as seed for the
>>> NormalVariateGenerator filter.
>>> I tried with GetTimeStamp(), but this is the same timestamp for all
>>> threads.
>>> I tried with GetNumberOfThreads(), but still the same number for all
>>> threads.
>>> I tried with GetMTime(), same.
>>> I tried with 'this', but this is the same pointer too.
>>>
>>> I'm not sure which variable could be different in each thread.
>>>
>>> Thank you.
>>> -Laurent
>>>
>>>
>>> On Thu, Mar 6, 2014 at 3:56 PM, Laurent Chauvin <lchauvin at bwh.harvard.edu>
>>> wrote:
>>>>
>>>> I tried to use the itkAdditiveGaussianNoiseFilter, but on the output
>>>> image I obtain, the noise seems really patterned.
>>>>
>>>> I compiled the code from the article, and run exactly the same example
>>>> with same parameters and I don't have the same results as on the article.
>>>> As I mentionned, the noise I obtain seems really patterned.
>>>>
>>>> I enclosed the picture I obtain after running the 'gauss' example with
>>>> the same parameters as the article.
>>>>
>>>> Is it possible that the 'NormalVariateGenerator' used in the
>>>> AdditiveGaussianNoiseFilter changed since the article has been written ?
>>>> I noticed that the gaussian filter does not call Initialize of the
>>>> NormalVariateGenerator, but I tried to add it, and it doesn't make any
>>>> difference.
>>>>
>>>> Thank you.
>>>> -Laurent
>>>>
>>>>
>>>> On Thu, Mar 6, 2014 at 1:19 PM, Laurent Chauvin
>>>> <lchauvin at bwh.harvard.edu> wrote:
>>>>>
>>>>> I didn't look in the article for now.
>>>>>
>>>>> I was first trying to compile the code. There is a minor modification to
>>>>> do to be compatible with ITKv4, but otherwise it's pretty straight forward.
>>>>> So far I only tested itkAdditiveGaussianNoiseFilter.
>>>>>
>>>>> Thank you.
>>>>> -Laurent
>>>>>
>>>>>
>>>>> On Thu, Mar 6, 2014 at 1:11 PM, Bradley Lowekamp
>>>>> <blowekamp at mail.nih.gov> wrote:
>>>>>>
>>>>>> It would be great if you could to a brief review of the IJ article to
>>>>>> facilitate integrating it into ITK.
>>>>>>
>>>>>> Brad
>>>>>>
>>>>>> On Mar 6, 2014, at 12:17 PM, Laurent Chauvin <lchauvin at bwh.harvard.edu>
>>>>>> wrote:
>>>>>>
>>>>>> Thank you Bradley.
>>>>>>
>>>>>> Indeed I saw this article, but as it is from 2010, I thought maybe now
>>>>>> it would have been integrated into ITK.
>>>>>> I will look into that.
>>>>>>
>>>>>> Thank you.
>>>>>> -Laurent
>>>>>>
>>>>>>
>>>>>> On Thu, Mar 6, 2014 at 11:59 AM, Bradley Lowekamp
>>>>>> <blowekamp at mail.nih.gov> wrote:
>>>>>>>
>>>>>>> Have a look at this insight journal article:
>>>>>>>
>>>>>>> http://www.insight-journal.org/browse/publication/721
>>>>>>>
>>>>>>> I would also find this quite useful, and have been thinking about
>>>>>>> adding it to ITK.
>>>>>>> Brad
>>>>>>> On Mar 6, 2014, at 11:55 AM, Laurent Chauvin
>>>>>>> <lchauvin at bwh.harvard.edu> wrote:
>>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I'm trying to develop a filter, but in order to test it, I need to add
>>>>>>> some gaussian noise to my image.
>>>>>>> I looked for it but I couldn't find a ITK filter to generate noise.
>>>>>>>
>>>>>>> Is there a way to do this ?
>>>>>>>
>>>>>>> Thank you very much.
>>>>>>> -Laurent
>>>>>>>
>>>>>>> --
>>>>>>> Laurent Chauvin, MS
>>>>>>> Surgical Navigation and Robotics Laboratory, Radiology Department
>>>>>>> Brigham And Women's Hospital, Harvard Medical School
>>>>>>> http://wiki.ncigt.org/index.php/User:Lchauvin
>>>>>>> _____________________________________
>>>>>>> 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.php
>>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> The information in this e-mail is intended only for the person to whom
>>>>>>> it is
>>>>>>> addressed. If you believe this e-mail was sent to you in error and the
>>>>>>> e-mail
>>>>>>> contains patient information, please contact the Partners Compliance
>>>>>>> HelpLine at
>>>>>>> http://www.partners.org/complianceline . If the e-mail was sent to you
>>>>>>> in error
>>>>>>> but does not contain patient information, please contact the sender
>>>>>>> and properly
>>>>>>> dispose of the e-mail.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Laurent Chauvin, MS
>>>>>> Surgical Navigation and Robotics Laboratory, Radiology Department
>>>>>> Brigham And Women's Hospital, Harvard Medical School
>>>>>> http://wiki.ncigt.org/index.php/User:Lchauvin
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Laurent Chauvin, MS
>>>>> Surgical Navigation and Robotics Laboratory, Radiology Department
>>>>> Brigham And Women's Hospital, Harvard Medical School
>>>>> http://wiki.ncigt.org/index.php/User:Lchauvin
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Laurent Chauvin, MS
>>>> Surgical Navigation and Robotics Laboratory, Radiology Department
>>>> Brigham And Women's Hospital, Harvard Medical School
>>>> http://wiki.ncigt.org/index.php/User:Lchauvin
>>>
>>>
>>>
>>>
>>> --
>>> Laurent Chauvin, MS
>>> Surgical Navigation and Robotics Laboratory, Radiology Department
>>> Brigham And Women's Hospital, Harvard Medical School
>>> http://wiki.ncigt.org/index.php/User:Lchauvin
>>>
>>>
>>
>>
>>
>> --
>> Laurent Chauvin, MS
>> Surgical Navigation and Robotics Laboratory, Radiology Department
>> Brigham And Women's Hospital, Harvard Medical School
>> http://wiki.ncigt.org/index.php/User:Lchauvin
>>
>> _____________________________________
>> 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.php
>>
>> 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
>>


More information about the Insight-users mailing list