Login  Register

Re: Nuclei segmentation

Posted by Krs5 on Mar 19, 2014; 6:17pm
URL: http://imagej.273.s1.nabble.com/Nuclei-segmentation-tp5006953p5006997.html

Hi Chin,

I have written some macro code that might be useful. You probably have to change some of the settings but this works on the image you posted. It also uses the adjustable Watershed plugin as posted by Michael.

It will threshold an open image, run the adjustable watershed, get the perimeter values and all particles with a perimeter above 220 are extracted one by one to allow you to manually separate them. You might have to change this value in case too many wrong cells are selected.

-------------------------------- start code--------------------------
waitForUser("Please select the pencil tool");
run("Set Measurements...", "  perimeter redirect=None decimal=3");
setForegroundColor(255, 255, 255);
if (isOpen("ROI Manager")) {
        selectWindow("ROI Manager");
        run("Close");
}
title = getTitle();
setAutoThreshold("Huang dark");
setOption("BlackBackground", false);
run("Convert to Mask");
run("Adjustable Watershed", "tolerance=2");
run("Analyze Particles...", "display add");
roiManager("Deselect");
for (i=0;i<roiManager("count");i++){
        roiManager("select", i)
        run("Measure");
        if (getResult("Perim.", i)>220){  // You might have to change this number
                run("To Bounding Box");
                run("Enlarge...", "enlarge=1");
                Roi.getBounds(x, y, width, height);
                run("Duplicate...", "title=test");
                run("Set... ", "zoom=200");  // You can change the zoom
                waitForUser("Separate Cells");
                run("Copy");
                selectWindow(title);
                makeRectangle(x, y, width, height);
                run("Paste");
                selectWindow("test");
                close();
        }
}
roiManager("Show None");
selectWindow("ROI Manager");
run("Close");
selectWindow("Results");
run("Close");
-----end-----


Best wishes

Kees


Dr Ir K.R. Straatman
Senior Experimental Officer
Centre for Core Biotechnology Services
University of Leicester
http://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/lite/aif

ImageJ workshops 14 and 15 April: http://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/lite/aif/workshops/imagej-workshops-14-and-15-April-2014 (Still some places available)



-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of chin
Sent: 18 March 2014 07:14
To: [hidden email]
Subject: Re: Nuclei segmentation

Thank you all your answer.

Yeah, it seems no better ways to use watershed method to split connections between such irregular objects right now. I could only do is draw the lines to split them manully.
But it takes much time and
quite laborious job. Hopefully, there will be some labor-saving method for imagej developed by some experts.

best,
chin



--
View this message in context: http://imagej.1557.x6.nabble.com/Nuclei-segmentation-tp5006953p5006964.html
Sent from the ImageJ mailing list archive at Nabble.com.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html