/** * root_tools * * The root tools help to efficiently measure the following characteristics of plant roots: * - the angle of the opening of the whole root * - the depth to which it goes down * - the number of roots at 30 cm depth * - the diameters of the roots at depth * * written 2013 by Volker Baecker (INSERM) at Montpellier RIO Imaging (www.mri.cnrs.fr) */ var helpURL = "http://dev.mri.cnrs.fr/wiki/imagej-macros/Root_Tools"; var BOX_WIDTH = 20; // the width of the rhizo-box var DELTA = 10; // half of the height of the selection used to auto-set the scale var AUTO_SET_SCALE = true; // set the scale automatically var KNOWN_DISTANCE = 4; // known distance for spatial calibration (there are 20mm between two nails) var RADIUS=75; // radius of the circle drawn around the root point var ROOT_POINT_LINE_WIDTH = 15; // line width of the circle drawn around the root point var COLOR_ROOT_POINT = "red"; // color of the circle drawn around the root point var COUNT_ROOT_DEPTH = 30; // depth from the root point at which the horizontal line is drawn. The number of roots will be counted at that depth var HALF_LINE_WIDTH = 10; // half of the width of the line drawn at count root depth var WIDTH_DEPTH = 8; // line width of the line drawn at count root depth var COLOR_DEPTH = "cyan"; // color of the line drawn at count root depth var DX_ANGLE = 300; // delta x for the angle tool that is added to the image var DY_ANGLE = 600; // delta y for the angle tool that is added to the image var ANGLE_COLOR = "red"; // the color for marking the measured angle var ANGLE_LINE_WIDTH = 8; // the line width for marking the measured angle var MEASURE_DEPTH_COLOR = "magenta"; // the color of the line indicating the max. depth to which the root goes down var MEASURE_DEPTH_WIDTH = 8; // the line width of the line indicating the max. depth to which the root goes down var ZOOM_RADIUS = 20; // radius of the region around the click that is copied and zoomed var DIAMETER_COLOR = "yellow"; // color of the line indicating the measured root diameters var DIAMETER_WIDTH = 2; // width of the line indicating the measured root diameters var ON_IMAGE_OPEN_ON = false; // if true commands are run when an image is opened var ON_IMAGE_OPEN_COMMANDS = newArray("Rotate 90 Degrees Left", "Enhance Contrast, saturated=0.35"); var ON_IMAGE_OPEN_COMMANDS_CHECKED = newArray(true, true); var USE_GLOBAL_SCALE = true; var rootX; var rootY; var deepX; var deepY; var UNIT = "cm"; var X1; var X2; var Y; var MAX_ROOTS = 20; var DIAMETERS = newArray(MAX_ROOTS); var numberOfRootsAtThirty = 0; var DEPTH = 0; var ID = 0; var ANGLE = 0; var TITLE; var NUMBER = 0; var FOLDER; macro "AutoRun" { script = getJSRemoveAllImageListeners(); runJS(script); ON_IMAGE_OPEN_ON = call("ij.Prefs.get", "roots.on_image_open_on", false); if (ON_IMAGE_OPEN_ON) { script = getJSAddListeners(); runJS(script); } } macro "zoomIn [f1]" { run("In [+]"); } macro "zoomOut [f2]" { run("Out [-]"); } macro "Root Tools Help Action Tool- C134D01D04D06D11D1fD20D2fD3fDcfDd4Dd7De0De2De3De4De5De6De7Df2Df3Df4Df5Df6Df7Df9DfdC345D08D09D18D25D27D32D34D3aD42D43D5fD6dD92Da3Da5Dc5Dc8DdbC334D0fD12D19D30D3bD59D5aD69D6aDa2Da4DadDaeDafDb2Db3DbdDbeDc6Dd8DdeC666D53D54D62D77D7bD7cD7dD7eD91D94D95D9aD9bD9cD9fDa9DbaDcaDcbC234D02D03D05D07D0aD0bD10D2eD4aDb4DbfDceDd0Dd1Dd5Dd6DdfDe8De9DeaDebDecDeeDf8DfbC555D0eD1bD35D36D45D50D51D52D56D6fD7aD90D93D9dDa1Da6Db1Db7DbcDddC345D0cD15D1aD37D3dD40D5cDb5Db6Dc9DfeC777D1cD57D66D71D72D73D74D76D80D82D83D88D89D8aD8eD8fD97D98C234D00Dc4Dd3De1Df0Df1DfaDfcC445D17D29D2bD38D41D46D55D58D65D6bD6eD78D79D9eDa0DacDcdC335D13D14D16D1eD23D24D28D33D3eD4cD5eD68D6cDc7Dd2DefC666D1dD48D61D63D67D70D7fD96D99Da7Da8Db9DbbDccC234D21D2dD3cD4bD4fDc0Dc3Dd9DdaDedC556D0dD26D2aD39D44D47D60D64D75DaaDabDb8DdcC345D22D2cD31D49D4dD4eD5bD5dDb0Dc1Dc2C777D81D84D85D86D87D8bD8cD8dDff" { run('URL...', 'url='+helpURL); } macro "Root Tools Help Action Tool Options" { ON_IMAGE_OPEN_ON = call("ij.Prefs.get", "roots.on_image_open_on", false); Dialog.create("Root Tools - Options"); Dialog.addCheckbox("auto run commands when image opened", ON_IMAGE_OPEN_ON); for (i=0; i