Skip to content

Instantly share code, notes, and snippets.

@mutterer
Last active August 25, 2022 14:34
Show Gist options
  • Save mutterer/af4f60e85691d516a511f8f7200e9be6 to your computer and use it in GitHub Desktop.
Save mutterer/af4f60e85691d516a511f8f7200e9be6 to your computer and use it in GitHub Desktop.
// ImageJ 1.53t Linegraph Anlayzer demo
// ImageJ 1.53t Linegraph Anlayzer demo
run("Line Graph");
// calibrate and set plot origin
makeRectangle(80, 27, 409, 261);
Roi.getBounds(x, y, width, height);
calibrateFormRect(400,700,0,800);
function calibrateFormRect(xmin,xmax,ymin,ymax) {
dx=xmax-xmin;
dy=ymax-ymin;
xs=dx/width;
ys=dy/height;
run("Properties...", "origin="+(x-xmin/xs)+","+(y+height+ymin/ys)+" invert");
setVoxelSize(xs, ys, 1, "");
}
run("Analyze Line Graph");
// Count series in a plot
Plot.showValues();
h=split(Table.headings,'\t');
run("Close");
lastIndex=replace(h[h.length-1],"[^0-9]+","");
// assign colors to series, increase linewidth if needed
cols=newArray( "red", "blue", "cyan", "green", "magenta", "orange");
lw=2;
index=0;
while(index<=lastIndex) {
if((index%cols.length)==cols.length-1) lw=lw+2;
Plot.setStyle(index, ""+cols[index%cols.length]+",red,"+lw+",Line");
index++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment