Local thresholding

// local thresholding and unsharp masking by median filtering
// Other operations can be substituted for median filter
// For unsharp masking just cancel thresholding
// Rex Couture 11-13-03
// Based on macro by Gabriel Landini. Thanks to Wayne for help with Java.

Drag the file local_thresholding.ijm onto your ImageJ laucher window and run the macro from the macro editor.

run("Duplicate...", "title=Original");
run("32-bit");
run("Duplicate...", "title=Filtered");
a = getNumber("Radius", 7);
selectWindow("Filtered");
run("Median...", "radius=" +a);
run("Image Calculator...", "image1=Original operation=Subtract image2=Filtered create");
run("Rename...", "title=Result");
run("Threshold...");