Closed abrewe closed 1 year ago
The ImageJ 1.53t35 daily build adds a “Live” option to the Edit>Options>Plots dialog. I decided not to add the pixel/absolute scale option because it would not be obvious what it does, it does nothing for some types of selections, there where changes to the code I did not understand and these plots can be done with a simple macro like the following.
// AbsoluteProfilePlot.ijm
type = Roi.getType;
if (!(type=="rectangle"||type=="line"))
exit("Rectangle or stright line selection required");
if (type=="line") {
getLine(x1, y1, x2, y2, width);
if (!(x1==x2||y1==y2))
exit("Line selections must be horizontal or vertical");
}
profile = getProfile();
n = profile.length;
xpoints = Array.getSequence(n);
if (type=="rectangle") {
Roi.getBounds(x, y, width, height);
if (width>height)
start = x;
else
start = y;
} else {
if (x1==x2)
start = y1;
else
start = x1;
}
getVoxelSize(pw, ph, pd, unit);
for (i=0; i<n; i++)
xpoints[i] = xpoints[i]*pw + start*pw;
Plot.create("Plot", "Distance", "Intensity", xpoints, profile);
Plot.show();
Options>> button added on bottom of Plot Window allows for quicker access to Plot Defaults. Absolute Pixel Scaling and Auto-Live checkbox options have been added to the Profile Plot Options.
When Absolute pixel scale is selected, the x-axes of Profile Plots for vertical and horizontal straight-line selections and rectangular ROIS start at the actual coordinate of the selection. X-axis uses Y pixel coordinates for vertical line selections and rectangular ROI plots when vertical profile is selected, or x pixel coordinates for horizontal line selections and rectangular ROI horizontal profile plots. Absolute Pixel Scaling works with a calibrated scale set in Analyze>Set Scale…, x-axis starts from calibrated coordinate value. Useful when calibrating with ImageJ.
When auto-live is enabled, every plot opened thereafter will automatically toggle live profiling on. Saves time when many live plots need to be opened.
Credit to Peter Kenesei for implementation of similar features on an old version of ImageJ.