Automatic recognition/quantifying area to replace freehand tracing

imagej

#1

Hi,

I have a question regarding the analysis of a distinct shape within a complex image. I am currently analyzing fluorescent macro images (only 10x) of in vivo models, whereby I determine the surface area of two different structures via freehand tracing. This is time consuming, which is why i would like to automate it via a macro for example to allow for batch processing.

The problem is that it is hard to ‘isolate’ the shape via thresholding since there are numerous other structures present in my images which contain the same level of fluorescence. Do you have any tips on how to deal with a challenge like this? I am trying the weka segmentation algorithm, but this is not suitable for shape recognition i guess, since it also sees other structures as the one I am looking for

I could upload a picture if requested!

Thanks!


#2

Good day Jan Willem,

a typical sample image or small image excerpt is always helpful, but only in TIF- or PNG format.

Please note what I’ve just replied here and many times before:
http://forum.image.sc/t/automated-cell-measurements-identification-from-binary-images/9714/6?u=herbie

Regards

Herbie


#3

Thank you for the quick reply, here you can see an example of my image:

The structure I am looking to quantify is the upside-down mushroom/triangle in the middle.

regards,
JW


#4

Nice image.

Here is what I get with the Magic Wand Tool and tolerance 12 without pre-processing:
Attempt

Regards

Herbie


#5

The wand tool indeed shows promising, but is there a possibility to automate the wand tool selecting the structure, since i am expecting to have several hundreds to thousands of photo’s?


#6

Jan Willem,

you may try with an automatic threshold. For the sample image “MaxEntropy” may be suited. Make sure your image is of type 8-bit.

Here is an ImageJ-macro that works (though not perfectly) for the sample image:

// macro start
requires("1.51u");
setBatchMode(true);
run("8-bit");
orig = getImageID();
run("Duplicate...", " ");
setAutoThreshold("MaxEntropy dark");
run("Convert to Mask");
run("Analyze Particles...", "size=0.15-0.30 show=Outlines");
selectImage(orig);
run("Restore Selection");
setBatchMode(false);
exit();
// macro end

Paste the above macro code to an empty macro window (Plugins >> New >> Macro) and run it.

Regards

Herbie


#7

thanks Herbie, I’ll give it a try!


#8

Here is a more elaborated macro:

// macro start
requires("1.51u");
setBatchMode(true);
run("8-bit");
org = getImageID();
run("Duplicate...", " ");
setAutoThreshold("MaxEntropy dark");
run("Analyze Particles...", "size=0.15-0.30 add");
resetThreshold();
roiManager("Select", 0);
run("Clear Outside");
run("Set...", "value=255");
run("Select None");
run("Invert");
run("Watershed");
roiManager("Delete");
run("Analyze Particles...", "size=0.15-0.30 add");
selectImage(org);
run("Restore Selection");
roiManager("Select", 0);
setBatchMode(false);
exit();
// macro end

Paste the above macro code to an empty macro window (Plugins >> New >> Macro) and run it.

No idea how it generalizes for other images.

Regards

Herbie


#9

thanks for the help Herbie!