Skip to content
Snippets Groups Projects
Commit 51f9bd6b authored by Marius Hintsche's avatar Marius Hintsche
Browse files

add macro from ij website

parent 5f6d49fc
No related branches found
No related tags found
No related merge requests found
// Find Stack Maxima
//
// This macro runs the Process>Binary>Find Maxima
// command on all the images in a stack.
Dialog.create("Find Maxima");
Dialog.addNumber("Noise Tolerance:", 5);
Dialog.addChoice("Output Type:", newArray("Single Points", "Maxima Within Tolerance", "Segmented Particles", "Count"));
Dialog.addCheckbox("Exclude Edge Maxima", false);
Dialog.addCheckbox("Light Background", false);
Dialog.show();
tolerance = Dialog.getNumber();
type = Dialog.getChoice();
exclude = Dialog.getCheckbox();
light = Dialog.getCheckbox();
options = "";
if (exclude) options = options + " exclude";
if (light) options = options + " light";
setBatchMode(true);
input = getImageID();
n = nSlices();
for (i=1; i<=n; i++) {
showProgress(i, n);
selectImage(input);
setSlice(i);
run("Find Maxima...", "noise="+ tolerance +" output=["+type+"]"+options);
if (i==1)
output = getImageID();
else if (type!="Count") {
run("Select All");
run("Copy");
close();
selectImage(output);
run("Add Slice");
run("Paste");
}
}
run("Select None");
setBatchMode(false);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment