Skip to content

Instantly share code, notes, and snippets.

@mutterer
Last active November 29, 2022 17:40
Show Gist options
  • Save mutterer/7e46cd8b682e93f0c43f98fafb1a970b to your computer and use it in GitHub Desktop.
Save mutterer/7e46cd8b682e93f0c43f98fafb1a970b to your computer and use it in GitHub Desktop.
2D_Gaussian_Fit_Tool.ijm
var r =6;
macro "2D Gaussian Fit Tool - C00cT0f16GTbf16f" {
setBatchMode(1);
getCursorLoc(x, y, z, f);
while (f&16>0) {
Overlay.clear;
getCursorLoc(x, y, z, f);
makeRectangle(x-r,y-r,2*r,2*r);
Overlay.addSelection('yellow', 0);
makePoint(x-r+gaussianFit(true),y-r+gaussianFit(false),"extralarge hybrid");
Overlay.addSelection('red');
wait(10);
}
}
function gaussianFit(horizontal) {
if (!horizontal) setKeyDown('alt');
k=getProfile();
setKeyDown('none');
Fit.doFit("Gaussian",Array.getSequence(k.length), k);
return Fit.p(2);
}
@mutterer
Copy link
Author

gaussianfit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment