// 2P Trigeminal Ganglion Image Segmentation // This approach works well but makes use of 'Cellpose', which is DL-derived segmentation process implemented in Python. You need to have an instance of the cellpose python package installed on your computer to run it. THen you need to install the PTBIOP update site, which is the Java/Fiji bridge for cellpose in python. It takes time to set up. And it took me a WHILE to get working.... and it takes forever to run.... but it works pretty well. // ==================================================== // Written by Wilson Adams, | Siciliano Lab | Feb 2022 // ==================================================== // Make first image a variable init = getTitle(); dir = getInfo("image.directory"); imgdir = dir+init; name = File.getNameWithoutExtension(imgdir); run("Z Project...", "stop=20 projection=[Average Intensity]"); avgip = getTitle(); // Run cellpose - Play with cellprob threshold, flow threshold, diameter, run("Cellpose Advanced", "diameter=20 cellproba_threshold=-1.0 flow_threshold=0.4 anisotropy=1.0 diam_threshold=12.0 model=cyto2 nuclei_channel=0 cyto_channel=0 dimensionmode=2D stitch_threshold=-1.0 omni=false cluster=false"); // Turn output into an ROI list run("Duplicate...", " "); setThreshold(1, 65535); setOption("BlackBackground", false); run("Convert to Mask"); run("Distance Transform Watershed", "distances=[Chessknight (5,7,11)] output=[32 bits] normalize dynamic=1 connectivity=8"); run("Duplicate...", " "); setThreshold(1, 65535); setOption("BlackBackground", false); run("Convert to Mask"); run("Analyze Particles...", "clear add"); // Pull out intensities selectWindow(init); run("Set Measurements...", "mean redirect=None decimal=3"); roiManager("multi-measure one"); // Close out un-needed stuff. // Prompt Saving Dialog.create("Save Measurements?"); Dialog.addChoice("Do you want to save the measurments from this script to the image directory?", Array.concat("yes", "no"), "yes"); Dialog.show(); saveit = Dialog.getChoice(); // Save stuff if prompted if (matches(saveit, "yes")) { saveAs("Results", dir+name+"_Results.csv"); roiManager("save", dir+name+"_Roiset.zip"); }