/* * Instructions- * Download this macro script, and go to plugins to install the "segmentation" macro script onto ImageJ * Once installed right click the "segmentation" icon to set the scale factor (0-10), and click ok * Click the icon again and set your desired Gaussian Blur radius, and for the outliers set your wanted radius and threshold, as a starting point I recommend trying out the radius=14 and threshold=50 * If you are not happy with the segmentation, modify the scale factor (incresae/decrease acordingly) before making adjustments to the outlier radius * * Segmentation script written by Eden Tamrat */ var SCALE_FACTOR = 2; macro "segmentation" {segmentN(); } macro "segmentation Action Tool - CfffCfc9D25D26D27D28D29D2aD2bD34D36D37D38D39D3aD3bD3cD44D46D47D48D49D4aD4bD4cD53D54D55D57D58D59D5aD5bD5cD5dD63D64D65D67D68D69D6aD6bD6cD6dD73D74D75D76D83D84D85D93D94D95Da4Db4C000D15D16D17D18D19D1aD1bD24D2cD33D35D3dD43D45D4dD52D56D5eD62D66D6eD72D77D78D79D7aD7bD7cD7dD7eD82D86D8eD92D96D9eDa3Da5DadDb3Db5DbdDc4DccDd5Dd6Dd7Dd8Dd9DdaDdbCc96D87D88D89D8aD8bD8cD8dD97D98D99D9aD9bD9cD9dDa6Da7Da8Da9DaaDabDacDb6Db7Db8Db9DbaDbbDbcDc5Dc6Dc7Dc8Dc9DcaDcbCbbbDaeDbeDcdDceDdcDddDdeDebDecDedDeeDfcDfd" {segmentN(); } macro "segmentation Action Tool Options" { Dialog.create("Nuclei segmentation Options"); Dialog.addNumber("scale factor:", SCALE_FACTOR); Dialog.show(); SCALE_FACTOR = Dialog.getNumber(); } function segmentN() {setBatchMode(true); run("Scale...", "x="+(1.0/SCALE_FACTOR)+" y="+(1.0/SCALE_FACTOR)+" interpolation=Bilinear create title=small_tmp"); run("8-bit") run("Gaussian Blur..."); setAutoThreshold("Huang dark"); run("Convert to Mask"); run("Despeckle"); run("Remove Outliers..."); run("Fill Holes"); run("Watershed"); run("Scale...", "x="+SCALE_FACTOR+" y="+SCALE_FACTOR+" interpolation=Bilinear create title=big_tmp"); setAutoThreshold("Huang dark"); roiManager("Reset"); run("Analyze Particles...", "size=0-Infinity circularity=0.40-1.00 show=Nothing exclude add"); selectWindow("small_tmp"); close(); selectWindow("big_tmp"); close(); roiManager("Show All"); setBatchMode(false); } EXTRA // // argument 0..4: (optional) display inputs // 0 for object/background binary image // 1 for watershed lines // 2 for red overlaid dams // 3 for labelized basins // 4 for colorized basins // Description of the arguments // // argument 1: (mandatory) // 0 for dark objects on bright background, 1 otherwise // // argument 2: (mandatory) // 0 a neighborhood of 4 pixels, 1 a neighborhood of 8 pixels (radius in pixels) // // argument 3: (mandatory) // minimum level [0..255] // // argument 4: (mandatory) // maximum level [0..255] //