[Insight-users] add noise

Luis Ibanez luis.ibanez at kitware.com
Fri May 12 15:42:29 EDT 2006


Hi Cecilia,

One way is to sample input range of the erf() function
and  put into a std::map<> using the pairs {x,y} where
x = erf(y).

Then every time that you get a value from the uniform
distribution, you search for its interval in the std::map
and linearly interpolate between the ends of its interval.



   Regards,



       Luis


----------------------------------------
cecilia.zanella at studio.unibo.it wrote:
> 
> Hi Luis,
> I would like to follow the second option. So, I have to use the 
> itkRandomImageSource filter and pass the values of the resulting pixels to 
> an inverse erf() function, finally I have sum the two resulting images. I 
> have to ask you another question: how can I generate the inverse erf() 
> function?
> Thank you,
> Cecilia
> 
> 
> ----- Original Message ----- 
> From: "Luis Ibanez" <luis.ibanez at kitware.com>
> To: <cecilia.zanella at studio.unibo.it>
> Cc: <Insight-users at itk.org>
> Sent: Friday, May 12, 2006 3:14 PM
> Subject: Re: [Insight-users] add noise
> 
> 
> 
>>Hi Cecilia,
>>
>>There is no currently a filter in ITK for adding Gaussian noise.
>>
>>However you can easily put one together by combining the
>>following classes:
>>
>>1) Insight/Code/BasicFilters/itkRandomImageSource.h
>>   Insight/Code/BasicFilters/itkRandomImageSource.txx
>>
>>2) Insight/Code/Numerics/Statistics/itkNormalVariateGenerator.h
>>   Insight/Code/Numerics/Statistics/itkNormalVariateGenerator.cxx
>>
>>
>>The RandomImageSource is designed to generate an image with noise
>>following a Uniform distribution. You can replace the computation
>>of the uniform distribution by going to lines: 153-155 of the
>>itkRandomImageSource.txx and in there make calls to the Normal
>>VariateGenerator.
>>
>>
>>As a second option, you could simply take the values currently
>>generated from the uniform distribution, and pass them as argument
>>to an inverse erf() function, the values that are produced as output
>>will follow a Gaussian distribution.
>>
>>
>>You probably want to rename the resulting filter as a
>>GaussianNoiseSource, or something along those lines.
>>
>>Once you get this filter working, you could simply use the AddImage
>>filter in order to combine your input image with the Gaussian noise
>>image that you obtain from this filter.
>>
>>
>>Do you need the random image to be reproducible ?
>>or do you want it to be different every time that you run the filter ?
>>
>>
>>Please let us know if you find any problems,
>>
>>
>>   Thanks
>>
>>
>>     Luis
>>
>>
>>
>>=========================================
>>cecilia.zanella at studio.unibo.it wrote:
>>
>>>Hi,
>>>I have to add (Gaussian) noise to a synthetic volume: is there an ITK 
>>>filter able to execute this task?
>>>Thank you all...
>>>
>>>Cecilia
>>>
>>>
>>>_______________________________________________
>>>Insight-users mailing list
>>>Insight-users at itk.org
>>>http://www.itk.org/mailman/listinfo/insight-users
>>>
>>>
>>
>>
>>
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 
> 




More information about the Insight-users mailing list