Posted by
Michael Schmid on
Jan 26, 2019; 3:02pm
URL: http://imagej.273.s1.nabble.com/1-D-Gaussian-multiplier-convolution-function-around-line-in-image-tp5021719p5021721.html
Hi Ethan,
is it right that you want the weighted *sum* over the pixels at fixed x?
Then, even if you don't need a convolution, the easiest might be doing
the 1D convolution and then selecting the value at the y position of
choice.
ImageJ has the possibility to do a 1D Gaussian blur (because 2D Gaussian
blur is done by blurring successively in x and y), but there is
currently no function in the user interface for it.
You can access it via Java or JavaScript:
ip = IJ.getImage().getProcessor();
g = new GaussianBlur();
g.blurGaussian(ip, 0.0, 6.37, 0.001);
IJ.getImage().updateAndDraw();
The four parameters of blurGaussian are the ImageProcessor, the sigma in
x, the sigma in y, and the accuracy of the kernel (the latter must be
less than 0.02; recommended values are 0.002 for 8-bit or RGB and and
0.00001 - 0.0002 for 16-bit or floating-point images.
Sigma is the length in pixels where the kernel decays from the maximum
(1) to 1/sqrt(e); the value of 6.37 gives you a FWHM (full width at half
maximum) of 15.
Note that the convolution is scaled such that if you have a constant
pixel value, his value is preserved after the convolution. In your
suggested equation, the sum would increase with the width of the
Gaussian, which is proportional to 1/sqrt(b).
Of course, you can also write a macro for it, or use Herbie's
Process>Math>macro and then add up all the pixels along a vertical line
(e.g., 'select all' and 'plot profile' will give you the average over
the pixel columns; multiply them with the image height to get the sum.)
Michael
________________________________________________________________
On 2019-01-26 02:36, Cohen, Ethan D wrote:
> I have an image, where I want to vertically weight the intensity the
> pixels, by a 1-D Gaussian function around a horizontal line ROI in the
> image, so that the peak is 3X the original intensity, with a Gaussian
> ½ bandwidth of say 15 pixels in the Y direction.
>
> Something like, v=3v* exp (-b*(y-y0)^2 -1*(y-y0));?
>
> Or maybe ImageJ already has a feature for 1-D Gaussian weighting (not
> blur)? I guess this is sort of a 1-D convolution.
>
> Is there a function already in ImageJ to do this?
> I suppose I could make some sort of weighting matrix, but it seems
> rather painful.
>
> Ethan.
>
>
> Ethan Cohen, Ph.D.
> Div of Biomedical Physics, WO62 Rm 1204
> Office of Science and Engineering Labs,
> FDA Center for Devices and Radiological Health
> White Oak Federal Res Ctr.
> 10903 New Hampshire Ave.
> Silver Spring, MD 20993
> Web:
http://go.usa.gov/cegV3> Office: 301-796-2485
> Lab:301-796-2762
> Fax: 301-796-9927
> Cell: 301-538-7544
>
> [cid:image001.png@01D1C57E.DFA022A0]<
http://www.fda.gov/>Excellent
> customer service is important to us. Please take a moment to provide
> feedback regarding the customer service you have received:
>
https://www.research.net/s/cdrhcustomerservice?O=700&D=740&B=740&E=&S=E> "THIS MESSAGE FROM ETHAN COHEN IS INTENDED ONLY FOR THE USE OF THE
> PARTY TO WHOM IT IS ADDRESSED AND MAY CONTAIN INFORMATION THAT IS
> PRIVILEGED, CONFIDENTIAL, AND PROTECTED FROM DISCLOSURE UNDER LAW. If
> you are not the addressee, or a person authorized to deliver the
> document to the addressee, you are hereby notified that any review,
> disclosure, dissemination, copying, or other action based on the
> content of this communication is not authorized. If you have received
> this document in error, please immediately notify the sender
> immediately by e-mail or phone."
> ________________________________
>
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html