//******************************************************************* // Date: July-2021 // Credits: StarDist, DeepImageJ // URL: // https://github.com/stardist/stardist // https://deepimagej.github.io/deepimagej // This macro was adapted from // https://github.com/deepimagej/imagej-macros/blob/648caa867f6ccb459649d4d3799efa1e2e0c5204/StarDist2D_Post-processing.ijm // Please cite the respective contributions when using this code. //******************************************************************* // Macro to run StarDist postprocessing on 2D images. // StarDist and deepImageJ plugins need to be installed. // The macro assumes that the image to process is a stack in which // the first channel corresponds to the object probability map // and the remaining channels are the radial distances from each // pixel to the object boundary. //******************************************************************* //Modified by Pradeep R for GAT neuron detection // Get the name of the image to call it if(getArgument()=="") { probThresh=0.611014148263967; nmsThresh=0.3; } else { args=getArgument(); arg_array=split(args, ","); probThresh=arg_array[0]; nmsThresh=arg_array[1]; probThresh = parseFloat(probThresh); nmsThresh = parseFloat(nmsThresh); } print("Using a probability of "+probThresh); print("Using a overlap/nmsthresh of "+nmsThresh); getDimensions(width, height, channels, slices, frames); name=getTitle(); //enteric neuron model specific threshold //probThresh=0.6110141482639674; //nmsThresh=0.3; // Isolate the detection probability scores run("Make Substack...", "slices=1 delete"); rename("scores"); // Isolate the oriented distances run("Fire"); selectWindow(name); run("Properties...", "channels=" + maxOf(channels, slices) - 1 + " slices=1 frames=1 pixel_width=1.0000 pixel_height=1.0000 voxel_depth=1.0000"); rename("distances"); run("royal"); // Run StarDist plugin run("Command From Macro", "command=[de.csbdresden.stardist.StarDist2DNMS], args=['prob':'scores', 'dist':'distances', 'probThresh':'" + probThresh + "', 'nmsThresh':'" + nmsThresh + "', 'outputType':'Label Image', 'excludeBoundary':'2', 'roiPosition':'Stack', 'verbose':'false'], process=[false]"); close("scores"); close("distances");