I am trying to set nematode color in the filtered image from original image, used overlay but did not work. any solution for this task?

Original Image


Filtered Image

Hi @amaze

To get what you want:

  • select your original image
  • click on your ROI
  • click on Measure
    (after activating run (“Set Measurements …”, “mean display redirect = None decimal = 2”);

Hi @Mathew

According to your instruction, I first selected area on original image and then clicked on ROI manager added selected ROI. Afterward , Measured it. Ultimately, set Measurements with display redirect= None and decimal places= 2 however; it did not worked out. I am confused whether it need processing with filtered image or not. Could you please elaborate solution ?

Hi @amaze

This works for the image in this post.
(Here I isolated only two worms)
You will need to analyze each row (what does it do?)
You will probably have to adapt the (old Step) part to each image.
It’s up to you to adapt.

Please report
Thank you

//New step 1
run("Duplicate...", "title=1");
run("Duplicate...", "title=2");
//---------------------------------------
// Old Step
run("Invert");
run("RGB to CMYK");
run("Stack to Images");
close("Y");close("M");close("K");
selectWindow("C");
setAutoThreshold("Yen");
//run("Threshold...");
setOption("BlackBackground", false);
run("Convert to Mask");
run("Analyze Particles...", "size=3000-50000 circularity=0.00-0.20 display exclude add");

roiManager("Select", newArray(0,1));
roiManager("Combine");
roiManager("Add");
setBackgroundColor(255, 255, 255);
run("Clear Outside");
roiManager("Show All without labels");
roiManager("Show None");
//----------------------------------
//New Step 2
selectWindow("1");
roiManager("Show All");
roiManager("Measure");
selectWindow("Results");

Hi @Mathew,
Thank you for your macro. Got output image as below; however, background should not be with dust particle. I need output as image with nematodes only rather than ROI. Yea, I need a common filter that work for all images.

I do not understand what you want.

  • If you want the values ​​of the worms then you have them in the table
  • if you want an image with only the worms on a white or black background then you have to apply this:

Hope this helps.
Thank you