Thanks Kees,

you are right and it appears that the behaviour makes sense because the "Straightener"-mechanism is used in such cases (see the Forum post from June 2022)!

Great catch

Herbie

:::::::::::::::::::::::::::::::::::::::::::::::::::
Am 08.08.25 um 10:05 schrieb Straatman, Kees (Dr.):
Morning,

I don't think that solves the problem as you should use:

selectImage("Mock");
roiManager("Select", 0);
Roi.setStrokeWidth(2);
roiManager("Update");
roiManager("Multi Plot");

and this gives the same result/problem as the original code.

Some more information can be found at 
https://forum.image.sc/t/plot-profile-fits-a-spline-for-no-reason-on-polylines/68768

Depending on what you try to do you could use:

newImage("Mock", "16-bit black", 850, 850, 1);
makeLine(156,486,392,255,683,459);
roiManager("Add");

selectImage("Mock");
roiManager("Select", 0);
Roi.setStrokeWidth(1);
roiManager("Update");
roiManager("multi-measure measure_all one append");

selectImage("Mock");
roiManager("Select", 0);
Roi.setStrokeWidth(2);
roiManager("Update");
roiManager("multi-measure measure_all one append");


Best wishes
Kees

Dr Ir K.R. Straatman FRMS
Advanced Imaging Facility (RRID: SCR_020967)
University of Leicester
http://www.le.ac.uk/advanced-imaging-facility

-----Original Message-----

Sent: 07 August 2025 21:01
To: [email protected]
Subject: Re: Odd behavior from plotprofile

***CAUTION:*** This email was sent from an EXTERNAL source. Think before 
clicking links or opening attachments.

Greetings Lance,

did you try

selectImage("Mock");
roiManager("Select", 0);
Roi.setStrokeWidth(2);
roiManager("Multi Plot");

instead?

Best

Herbie

:::::::::::::::::::::::::::::::::::::::::::::
Am 07.08.25 um 20:13 schrieb Davidson, Lance:
Hi All,

Recent efforts to use plotprofile with different linewidths have given some 
surpising results where the length changes with the linewidth.

We are using free line ROIs automatically generated by segmentation algorithms. 
I've simplified the macro below to do the same thing with a simple two-segment 
polyline.

If the line is 1 pixel wide the reported distance is 685 pixels, if the line is 
2 pixels wide the distance is 705...

Not only is the plotprofile outcome odd, but the polyline gets "splined".

Any help or workaround would be appreciated.

Best,
Lance

Lance Davidson, MSc, PhD
William Kepler Whiteford Professor of Bioengineering University of
Pittsburgh

//---------------------- offending macro -----------------

newImage("Mock", "16-bit black", 850, 850, 1);
makeLine(156,486,392,255,683,459);
roiManager("Add");

selectImage("Mock");
roiManager("Select", 0);
Roi.setStrokeWidth(1);
run("Plot Profile");

selectImage("Mock");
roiManager("Select", 0);
Roi.setStrokeWidth(2);
run("Plot Profile");


--
ImageJ mailing list:
http://image/
j.nih.gov%2Fij%2Flist.html&data=05%7C02%7Ckrs5%40leicester.ac.uk%7C492
61affcd2440e7a3f908ddd5ed3a14%7Caebecd6a31d44b0195ce8274afe853d9%7C0%7
C0%7C638901937049177571%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydW
UsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D
%7C0%7C%7C%7C&sdata=HbwUOE%2Bcvnm7SX813YnM4hvuaV6Q16971kVC4r5%2F2nI%3D
&reserved=0


--
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

Reply via email to