I have run into a problem with a macro that I have up to now been running all right. I am trying to threshold a light region in dark bar surrounded by other light regions, as attached. For other images, I have been able to choose “dark background” and exclude selections on the edges to only choose the light image in the center, however, I have run across some images in which the region in the center is dark enough so that it is recognized as background. Can someone help me get around this? The basic code I have used in the past was suggested by @etadobson in this thread:
id = getImageID(); run("Duplicate...", " "); setAutoThreshold("Default dark"); //run("Threshold..."); run("Create Mask"); run("Fill Holes"); run("Analyze Particles...", "size=100000-Infinity exclude clear add"); selectImage(id); roiManager("Show All"); roiManager("Select", 0); run("Crop");
Can anyone help point me in the right direction so I can adjust this code to select the rectangular region in the center? Thanks!