// Elastin Fiber Length Quantification. // Epi vs. enothelium maybe? // Either way, a quick search of the Image.sc forums pointed towards the // Ridge Detection plugin. Looks like it's going to work fine. // https://imagej.net/Ridge_Detection // =============================== // Written by Wilson R Adams | Vanderbilt Biophotonics Center | 16 Feb 2021 // ============================== input = getTitle(); elastinlengths(input); function elastinlengths(img) { // Uses ridge detection to segment out elastin fiber features and quantifies their lengths. // Prep roiManager("reset"); imdir = getInfo("image.directory"); pardir = File.getParent(imdir); resdir = imdir+File.separator+"Results"; File.makeDirectory(resdir); // make results directory selectWindow(img); name = File.nameWithoutExtension; // get filename variable to rename outputs // Start Processing - Prep image for function run("Duplicate...", " "); wrk = getTitle(); run("Enhance Contrast", "saturated=0.35"); run("Enhance Contrast", "saturated=0.35"); //run("Gaussian Blur...", "sigma=1"); // does this help? - no not really. run("8-bit"); // Needs 8bit grayscale to run plugin // Run function to get fiber length run("Ridge Detection", "line_width=3 high_contrast=100 low_contrast=0 extend_line displayresults add_to_manager make_binary method_for_overlap_resolution=NONE sigma=1.37 lower_threshold=0 upper_threshold=4.25 minimum_line_length=10 maximum=0"); // Rejecting fibers shorter than 10px close("Junctions"); close("Results"); selectWindow("Summary"); saveAs("Results", resdir+File.separator+name+"_Summary.csv"); close(name+"_Summary.csv"); roiManager("save", resdir+File.separator+name+"_ROI.zip"); selectWindow(wrk+" Detected segments"); save(resdir+File.separator+wrk+" Detected segments.tif"); close(); close(); roiManager("reset"); close(); };