//Smooths and Cleans up Skeleton for GB analysis Peter J. Lee 2/4/2015 11:49 AM //dir = getInfo("image.directory"); name = getTitle(); //path = dir+name; //print("\Smoothed Macro White Skeleton 4-Connected Macro Started on" +name); //if (!is(“binary”)) // restoreExit(“Sorry, you need a binary image for this macro!”); getPixel(0, 0) if (((getPixel(0, 0))!=0 || (getPixel(0, 1))!=0 || (getPixel(1, 0))!=0 || (getPixel(1, 1))!=0)) run("Invert"); /* Sometimes the outline procedure will leave a pixel border around the outside - this next step checks for this. */ /* i.e. the corner 4 pixels should now be all black, if not, we have a "border issue". */ if (((getPixel(0, 0))+(getPixel(0, 1))+(getPixel(1, 0))+(getPixel(1, 1))) != 0 ) restoreExit("Border Issue"); run("Gaussian Blur...", "sigma=1.50"); setAutoThreshold("Default dark"); //run("Threshold..."); setThreshold(67, 255); setOption("BlackBackground", false); run("Convert to Mask"); //selectWindow("Close"); //run("Close"); // skeleton3.txt by G. Landini // a skeletonization algorithm, different from the one in ImageJ // similar to skeleton1 but 4-connected // 3 Dec 2003 // uses BinaryThin2_.class available from http://www.mecourse.com/landinig/software/software.html // assumes a white object on a black background run("BinaryThin2 ", "kernel_a='1 1 1 2 1 2 0 0 0 ' kernel_b='2 1 1 0 1 1 0 0 2 ' rotations='rotate 45' iterations=-1 white"); // PruneAll by G. Landini // a pruning algorithm, different from the one in ImageJ // prunes all branches of a skeleton leaving only the closed loops // 8-connected // 4 Dec 2003 // uses BinaryThin_.class available from http://www.mecourse.com/landinig/software/software.html // assumes a white object on a black background run("BinaryThin ", "kernel_a='0 2 2 0 1 0 0 0 0' rotations='rotate 45' iterations=-1 white"); print("\Smoothed White Skeleton 4-Connected Macro Finished on " +name);