Project

General

Profile

Files » simple_grey_morphology.txt

example of a toolset that does simple greyscale morphology - Volker Baecker, 06/28/2011 06:25 PM

 
var radius = 1;

macro "Unused Tool-1 - " {} // leave slot between text tool and magnifying glass unused

macro "Erode Action Tool- C000T4b12e" {
erode();
}

macro "Dilate Action Tool- C000T4b12d" {
dilate();
}

macro "Close Action Tool- C000T4b12c" {
close();
}

macro "Open Action Tool- C000T4b12o" {
open();
}

macro "Sequential Filtering Action Tool- C000T4b12s" {
sequentialFiltering();
}

macro "White Top Hat Action Tool- C000T4b12w" {
whiteTopHat();
}

macro "Black Top Hat Action Tool- C000T4b12b" {
blackTopHat();
}

macro 'Erode Action Tool Options' {
radius = getNumber("radius:",radius);
}

function erode() {
run("Minimum...", "radius=" + radius);
}

function dilate() {
run("Maximum...", "radius=" + radius);
}

function close() {
dilate();
erode();
}

function open() {
erode();
dilate();
}

function sequentialFiltering() {
open();
close();
}

function whiteTopHat() {
setBatchMode(true);
in = getTitle();
run("Duplicate...", "title=opened");
open();
imageCalculator("Subtract", in,"opened");
selectWindow("opened");
run("Close");
setBatchMode("exit and display");
}

function blackTopHat() {
setBatchMode(true);
in = getTitle();
run("Duplicate...", "title=original");
selectWindow(in);
close();
imageCalculator("Subtract", in, "original");
selectWindow("original");
run("Close");
setBatchMode("exit and display");
}
(17-17/18)