Line profile seems to filter data

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Line profile seems to filter data

msenko
If I draw a line with a width greater than 1 and generate a profile plot, the peaks in my data are progressively suppressed the further towards the right I am on the plot. It's almost as if there is a running average filter that gets wider as I move along the data set. The suppression shows up when the points are listed.
Generating a profile from a rectangle of the same size does not show this effect. Has anyone else seen this?

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Line profile seems to filter data

Michael Schmid
On 2018-11-09 22:59, Mark Senko wrote:
> If I draw a line with a width greater than 1 and generate a profile
> plot, the peaks in my data are progressively suppressed the further
> towards the right I am on the plot. It's almost as if there is a
> running average filter that gets wider as I move along the data set.
> The suppression shows up when the points are listed.
> Generating a profile from a rectangle of the same size does not show
> this effect. Has anyone else seen this?
>


Hi Mark,

sorry, I can't confirm this. Here is my test macro:

   newImage("Untitled", "32-bit black", 1024, 1024, 1);
   run("Macro...", "code=v=v+50*sin(x/2+y/50)");
   makeLine(26, 326, 1002, 364, 20);
   run("Plot Profile");

It shows the same amplitude of the sine wave from left to right.

These are my (Profile) Plot options:
   run("Plots...", "width=500 height=400 font=12 draw minimum=0 maximum=0
interpolate sub-pixel");

Do you have a sample image that you could post somewhere?
Best also specify the line coordinates and width that you are using, and
which options you have (e.g. use the macro recorder to record the
Edit>Options>Plots dialog)

Michael

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Line profile seems to filter data

msenko
https://bgitech-my.sharepoint.com/:f:/g/personal/msenko_genomics_cn/EudbH2S4RAtEhayyDauqrloBuJ6UiUowB-bNU_h_2wv2Ig?e=V4iUwU
<https://bgitech-my.sharepoint.com/:f:/g/personal/msenko_genomics_cn/EudbH2S4RAtEhayyDauqrloBuJ6UiUowB-bNU_h_2wv2Ig?e=V4iUwU>  

Here is a link to a directory that contains an image and a macro that
analyzes it. A plot is produced which shows the profile generated from a
line and a box.

<http://imagej.1557.x6.nabble.com/file/t382159/Profiles.jpg>

We tried to recreate this problem with a simple noise image generated in
ImageJ, but the problem doesn't show up. There must be something specific
about our data.....



--
Sent from: http://imagej.1557.x6.nabble.com/

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Line profile seems to filter data

Michael Schmid
Hi Mark,

unfortunately that mircosoft site did not allow me to download the files
to disk [only to a OneDrive account, but I have none], but I could see a
preview of the image and line profiles. Maybe have a solution:

If your line is close to horizontal, but not exactly horizontal, it will
start at an integer pixel position. Further pixels are sampled at
distances of 1, 2, 3, 4, etc.; these distances are measured along the
line, i.e., under an angle. For a non-horizontal line these positions
will be at non-integer pixel positions, and ImageJ will use interpolated
values. If the data are rather noisy or you have large variations
between neighboring pixels, the interpolated values will look more
smooth than the actual data.

You can disable interpolation in Edit>Options>Plots
("Interpolate Line Profiles").

Alternatively, you can hold the shift key while drawing the line to make
sure it is exactly horizontal.


Michael
________________________________________________________________
On 12.11.18 19:15, msenko wrote:

> https://bgitech-my.sharepoint.com/:f:/g/personal/msenko_genomics_cn/EudbH2S4RAtEhayyDauqrloBuJ6UiUowB-bNU_h_2wv2Ig?e=V4iUwU
> <https://bgitech-my.sharepoint.com/:f:/g/personal/msenko_genomics_cn/EudbH2S4RAtEhayyDauqrloBuJ6UiUowB-bNU_h_2wv2Ig?e=V4iUwU>
>
> Here is a link to a directory that contains an image and a macro that
> analyzes it. A plot is produced which shows the profile generated from a
> line and a box.
>
> <http://imagej.1557.x6.nabble.com/file/t382159/Profiles.jpg>
>
> We tried to recreate this problem with a simple noise image generated in
> ImageJ, but the problem doesn't show up. There must be something specific
> about our data.....
>
>
>
> --
> Sent from: http://imagej.1557.x6.nabble.com/
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Line profile seems to filter data

msenko
Thanks, Michael.  I had already tried turning off interpolation with no
effect. With the nature of our gridded data, I discovered early on about the
'shift' key! I definitely use it.

But, the profiles I posted were generated using the macro. The line/width
match exactly the rectangular width/height. In general, with our data, this
damping is very persistent and not very particular about the line
characteristics, except as you mentioned, that the line be truly horizontal.
The biggest question is 'Why don't the line and rectangle produce the same
profile?'

I didn't know that about OneDrive, I've never used it before. Here is a
google drive link:

https://drive.google.com/open?id=14BR7JTcLE6UfnCqK09MVaE9tsNAoQbzyhttp://
<https://drive.google.com/open?id=14BR7JTcLE6UfnCqK09MVaE9tsNAoQbzyhttp://>  



--
Sent from: http://imagej.1557.x6.nabble.com/

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Line profile seems to filter data

Michael Schmid
Hi Mark,

thank you for the clear example!
I see the problem now. It seems to lie in
PolygonRoi.fitSplineForStraightening; I'll see whether I can fix it.

Michael
________________________________________________________________
On 13.11.18 18:14, msenko wrote:

> Thanks, Michael.  I had already tried turning off interpolation with no
> effect. With the nature of our gridded data, I discovered early on about the
> 'shift' key! I definitely use it.
>
> But, the profiles I posted were generated using the macro. The line/width
> match exactly the rectangular width/height. In general, with our data, this
> damping is very persistent and not very particular about the line
> characteristics, except as you mentioned, that the line be truly horizontal.
> The biggest question is 'Why don't the line and rectangle produce the same
> profile?'
>
> I didn't know that about OneDrive, I've never used it before. Here is a
> google drive link:
>
> https://drive.google.com/open?id=14BR7JTcLE6UfnCqK09MVaE9tsNAoQbzyhttp://
> <https://drive.google.com/open?id=14BR7JTcLE6UfnCqK09MVaE9tsNAoQbzyhttp://>
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Line profile seems to filter data

Wayne Rasband-2
In reply to this post by msenko
> On Nov 9, 2018, at 4:59 PM, Mark Senko <[hidden email]> wrote:
>
> If I draw a line with a width greater than 1 and generate a profile plot, the peaks in my data are progressively suppressed the further towards the right I am on the plot. It's almost as if there is a running average filter that gets wider as I move along the data set. The suppression shows up when the points are listed.
> Generating a profile from a rectangle of the same size does not show this effect. Has anyone else seen this?

Thanks to Michael Schmid, this bug is fixed in the latest ImageJ daily build (1.52i41). Here is a macro that reproduces the bug:

  newImage("TestImage", "16-bit random", 4096, 512, 1);
  sx = 50;  // coords of UL corner of rectangle
  sy = 200;
  h = 300;
  w = 4500;
  makeRectangle(sx,sy,w,h);
  prof = getProfile();
  Plot.create("Prof Rect","rel pix","sig",prof);
  yline = sy+ h/2;
  makeLine(sx,yline,sx+w,yline,h);
  prof2 = getProfile();
  Plot.setColor("red");
  Plot.add("line",prof2);
  Plot.add("circle",prof2);
  Plot.setColor("black");
  Plot.show();

-wayne

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Line profile seems to filter data

msenko
This is awesome! Thanks, guys!



--
Sent from: http://imagej.1557.x6.nabble.com/

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html