Login  Register

Re: How is the line plot profile generated?

Posted by Michael Schmid on Mar 13, 2016; 8:50pm
URL: http://imagej.273.s1.nabble.com/How-is-the-line-plot-profile-generated-tp5015838p5015869.html

Hi Emmanuel,

at high magnification, the line profiles are very accurate if you enable
'Sub-Pixel Resolution' in the (Profile) Plot options. You may also want to
have 'Interploate Line Profiles' checked.

Without subpixel resolution, you should not expect an accurate result for
lines that have non-integer coordinates.

To ensure these settings don't get deactivated, I have them in the AutoRun
section of my StartupMacros file:

macro "AutoRun" {
  run("Profile Plot Options...", "draw interpolate sub-pixel");
//and anything else you want to happen at startup, e.g. Binary options, ...
}

Michael
______________________________________________________________

On Sun, March 13, 2016 20:50, Emmanuel Levy wrote:

> Dear All,
>
> I wished to add a piece of macro to illustrate the behaviour I observed
> and
> was describing (see below).
>
> Discussing offline with Avital made it clear what happens: pixel values
> are
> represented by the image-coordinate system and this introduces asymmetry -
> let's consider 3 pixels:
>  - x=0,y=0 (black)
>  - x=0,y=1 (white)
>   -x=0,y=2  (black)
>
> If I draw two horizontal lines at y=0.5 and y=2.5. They are both
> equidistant from the white pixel on the image (i.e., it looks symmetric)
> but they are not equidistant in the coordinate system, the line at y=0.5
> is
> only 0.5 pixels far from the while pixel's origin (at x=0,y=1), while the
> line at y=2.5 is 1.5 pixels away. This introduces asymmetry when plot
> profile calculates values.
>
> Would anyone know of a way of producing a symmetric behaviour for plot
> profile?
>
> Thanks for your help,
> All the best,
>
> Emmanuel
>
>
> ===========
>
> The macro below creates a whitish region at the centre of a 17 by 17px
> image, and adds a white pixel at the top of the image as well. It then
> draws two pairs of lines. I would expect the profile for the two pairs to
> be identical because the pixel environment is identical. However, the two
> profiles within each pair are different. e.g., if the line is 0.5 pixel
> above or below a white pixel will yield a very different outcome.
>
> newImage("Untitled", "8-bit Black", 17, 17, 1);
> makeRectangle(8, 8, 1, 1);
> run("Clear", "slice");
> run("Select All");
> run("Gaussian Blur...", "sigma=2");
> makeRectangle(7, 1, 1, 1);
> run("Clear", "slice");
> run("Enhance Contrast", "saturated=0.35");
>
> ///// FIRST PAIR OF PROFILES (left and right to the whitish spot)
> selectWindow("Untitled");
> makeLine(4.5, 5.5, 4.5, 11.5);
> run("Plot Profile");
>
> selectWindow("Untitled");
> makeLine(12.5, 5.5, 12.5, 11.5);
> run("Plot Profile");
>
>
> ///// SECOND PAIR OF PROFILES (top and bottom to the white pixel)
> selectWindow("Untitled");
> makeLine(5.5, 0.5, 9.5, 0.5);
> run("Plot Profile");
>
> selectWindow("Untitled");
> makeLine(5.5, 2.5, 9.5, 2.5);
> run("Plot Profile");
>
> On 10 March 2016 at 10:06, Jan Eglinger <[hidden email]> wrote:
>
>> Dear Avital and Emmanuel,
>>
>> > On 9 March 2016 at 21:28, Avital Steinberg <[hidden email]>
>> > wrote:
>> >> Herbie helped me in the other ImageJ forum
>>
>> Let's be nice and link to this discussion, so others can follow:
>> http://forum.imagej.net/t/how-is-the-plot-profile-calculated/1070
>>
>>
>> On 10.03.2016 07:26, Emmanuel Levy wrote:
>>
>>> I would have expected that, by default, only the pixels onto which the
>>> line
>>> is drawn are used and interpolated when calculating the profile. Is
>>> this
>>> non-symmetric behaviour of the interpolation an intended behaviour?
>>>
>>
>> I agree that there are inconsistencies between how lines and segmented
>> line selection are displayed on the image and the measurements of those
>> lines. Please see also my following related post on the forum:
>>
>>
>> http://forum.imagej.net/t/change-in-pixels-using-reslice-function/999/2?u=imagejan
>>
>>
>> I remember previous discussions about rectangular selections and the
>> behavior of the Fill and Draw commands that by now have been fixed. It
>> would be great to have a consistent ROI behavior through all types of
>> selections in ImageJ.
>>
>> Cheers,
>> Jan
>>
>>
>>
>>
>>>
>>> On 9 March 2016 at 21:28, Avital Steinberg <[hidden email]>
>>> wrote:
>>>
>>> Hi,
>>>> When I use ImageJ's graphical user interface and draw a line and then
>>>> select Analyze, plot profile (with the default settings), I get a plot
>>>> of
>>>> intensities vs. the distance from the beginning of the line. I was
>>>> wondering how the plot is generated, in terms of which pixels in the
>>>> neighborhood are taken into the weighted average, and how the weights
>>>> are
>>>> determined.
>>>>
>>>> Herbie helped me in the other ImageJ forum by suggesting that I plot a
>>>> ramp
>>>> image. Now I can sometimes predict the values that will appear in the
>>>> profile plot. (but only in some simple cases) After experimenting with
>>>> an
>>>> image, I noticed that the plot's x-axis scale changes abruptly from
>>>> 1.5
>>>> to
>>>> 2.0 (for example) and I was wondering if the distance between 2
>>>> adjacent
>>>> points changes when the scale suddenly changes.
>>>>
>>>> Thank you,
>>>> Avital
>>>>
>>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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