Forked from mutterer/multichannel_profile_plot.ijm
Last active
September 24, 2021 09:28
-
-
Save kwolbachia/ea7901298c0d9222e6e4d5829bdfed79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// yet another multichannel profile plotter | |
// with smart lookuptables | |
// modified and simplified to my tastes + "better" LUT detection | |
macro "Multiplot" { | |
id=getImageID(); | |
getDimensions(width, height, channels, slices, frames); | |
if (selectionType()==-1) exit; | |
Stack.getPosition(Channel, slice, frame); | |
getPixelSize(unit, pixelWidth, pixelHeight); | |
Plot.create("MultiPlot", "Distance ("+unit+")", "Grey value"); | |
for (i=1; i<=channels; i++) { | |
if (channels>1) Stack.setChannel(i); | |
p = getProfile(); | |
Plot.setColor(lutToHex2()); | |
Plot.setLineWidth(2); | |
Plot.add("line", p); | |
} | |
Stack.setPosition(Channel, slice, frame); | |
if (channels>1) {Stack.setDisplayMode("color"); Stack.setDisplayMode("composite");} | |
Plot.setBackgroundColor("#2f2f2f"); | |
Plot.setAxisLabelSize(14.0, "bold"); | |
Plot.setFormatFlags("11001100001111"); | |
Plot.update(); | |
selectWindow("MultiPlot"); | |
Plot.setLimitsToFit(); | |
selectImage(id); | |
} | |
function lutToHex2(){ | |
getLut(r,g,b); | |
if (is("Inverting LUT")) { R = r[0]; G = g[0]; B = b[0]; } | |
else { R = r[255]; G = g[255]; B = b[255]; } | |
if (R<16) xR = "0" + toHex(R); else xR = toHex(R); | |
if (G<16) xG = "0" + toHex(G); else xG = toHex(G); | |
if (B<16) xB = "0" + toHex(B); else xB = toHex(B); | |
return "#"+xR+xG+xB; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment