Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lacan
Last active October 22, 2020 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lacan/a005c15c6a8735d7d904e85b9663b82d to your computer and use it in GitHub Desktop.
Save lacan/a005c15c6a8735d7d904e85b9663b82d to your computer and use it in GitHub Desktop.
[Nomalize Line Profile] Normalizes line profiles by making use of the Straighten command followed by scaling #Macro #ImageJ #Fiji #BIOP
/*
* Normalizes line profiles by making use of the Straighten command followed by scaling
* By Olivier Burri, BioImaging And Optics Platform
* In Response to http://forum.imagej.net/t/average-pixels-with-line-tool/6408?u=oburri
*
* OUTPUT is the values of the line profile as a results table
* Column name is the image name.
* the number of rows corresponds to the normalization length normLength
*/
normLength = 200; //px the final length you want
lineWidth = 10; // Line thickness to average intensities along the perpendicular axis
imageName = getTitle();
run("Straighten...", "title=SubImage line="+lineWidth);
run("Scale...", "x=- y=- width="+normLength+" height="+lineWidth+" interpolation=Bilinear create");
run("Line Width...", "line="+lineWidth);
makeLine(0,lineWidth/2, normLength, lineWidth/2);
data = getProfile();
for(i=0; i<normLength; i++) {
setResult(imageName, i, data[i]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment