Is there a way to delete manually all the particles within a rectangle I would draw? I’m working with charcoal particles and sometimes, there is some black/dark sediments (not charcoal) that I can’t exclude by thresholding method.
In her video on scripting Ellen Arena gives an example of how to apply the ROI manager to the original image (about 1:30:00 in). The macro code looks like this:
#@int(label = "Minimum size") minSize setBatchMode(true); id = getImageID(); // get original image id run("Duplicate...", " "); // duplicate original image and work on the copy run("Gaussian Blur...", "sigma=2"); setAutoThreshold("Default dark"); //run("Threshold..."); run("Create Mask"); run("Watershed"); run("Analyze Particles...", "size=" + minSize + "-Infinity display exclude add"); run("Clear Results"); // delete contents of results table selectImage(id); // activate original image roiManager("Show All with labels"); // overlay ROIs roiManager("Deselect"); roiManager("Measure"); // measure on original image
If you set up the parameters you measure to include the gray value then you could loop through the ROIs and filter by gray level. To get more flexibility you would probably want to migrate the code to a groovy or jython script. You could also do this at the end of the analysis by processing the
.tsv file you save and process with Excel, R with Rmarkdown, or Python with a Jupyter notebook. I prefer the last two for this task because one gets a reproducible report that plays well with version control. Both the R and Python communities have groups that provide examples.