/** * 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 NUMBER_OF_DEPTHS=3; // the number of possible depths at which the diameter of the roots can be measured var BOX_WIDTH = 21.5; // the width of the rhizo-box (in reality 20) 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 AUTO_SCALE_COLOR="green"; // color of the line that indicates the distance used to set the spacial scale of the image var AUTO_SCALE_LINE_WIDTH= 3; // line width of the line that indicates the distance used to set the spacial scale of the image var AUTO_SCALE_FONT_SIZE = 112; // size of the font indicating the length used to set the spacial scale 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 = newArray(NUMBER_OF_DEPTHS) // 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 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(NUMBER_OF_DEPTHS * MAX_ROOTS); var numberOfRootsAtDepth = newArray(NUMBER_OF_DEPTHS); var DEPTH = 0; var ID = 0; var ANGLE = 0; var TITLE; var NUMBER = 0; var FOLDER; var currentDepthNumber = 0; var THRESHOLD_METHODS = newArray("Default", "Huang", "Intermodes", "IsoData", "IJ_IsoData", "Li", "MaxEntropy", "Mean", "MinError", "Minimum", "Moments", "Otsu", "Percentile", "RenyiEntropy", "Shanbhag", "Triangle", "Yen"); var THRESHOLD_METHOD = "Huang"; macro "AutoRun" { COUNT_ROOT_DEPTH[0] = 30; for (i=1;i