Login  Register

Re: How is the line plot profile generated?

Posted by Herbie on Mar 13, 2016; 9:09pm
URL: http://imagej.273.s1.nabble.com/How-is-the-line-plot-profile-generated-tp5015838p5015872.html

Emmanuel,

sensor elements deliver numbers not squares.
(What happens in camera sensors is integrative sampling which causes a
small lowpass effect on the recorded light distribution.)

Subpixel resolution is obtained by spatial interpolation (and this is
perfectly ok if the camera sensor samples according to the sampling
theorem) of an array of discrete numbers.

There are many interpolation schemes but only one is correct but costly
and not used for lcd/oled-displays.

Best

Herbie

:::::::::::::::::::::::::::::::::::::::::::
Am 13.03.16 um 22:04 schrieb Emmanuel Levy:

> Hi Herbie,
>
> Thanks for your reply.
>
> as Avital might have told you, the line profile uses nearest neighborhood
>> interpolation and I assume that coordinates having xy.5 values will be
>> rounded up.
>>
>>
> The line profile uses continuous coordinates and there is no rounding as
> far as I can see. That's perhaps clearer if you use the "live" mode of the
> profile plot and move a line around.
>
>
>> Please note that pixel values are mathematical points and the squares that
>> are commonly mistaken as pixels are for visualization only.
>>
>
> I see what you mean but I don't fully agree because (i) camera sensors are
> not dimensionless, they take up space and I find pixels a convenient
> physical representation of sensors, beyond just being a "data structure".
> And (ii) light captured by cameras is not discreet but continuous, and one
> can try to estimate continuous parameters from pixel data. i.e., sub-pixel
> information can be inferred from the data.
>
> All the best,
>
> Emmanuel
>
>
>
>
>> HTH
>>
>> Herbie
>>
>> :::::::::::::::::::::::::::::::::::::::::::
>> Am 13.03.16 um 20:50 schrieb Emmanuel Levy:
>>
>>> 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
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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