Login  Register

Re: Problem regarding cell counting

Posted by Joel Sheffield on Apr 24, 2014; 8:26pm
URL: http://imagej.273.s1.nabble.com/Problem-regarding-cell-counting-tp5007416p5007421.html

Hi Sarah,

Here's another approach.  First, I separated the channels --no need to work
with the red and blue channels, since they have no data anyway.  Then, I
ran the FFT bandpass filter to smooth out the background.  The idea is that
the variation in the background is some sort of low frequency wave
function, and you can exclude it from the image.  I then took the resulting
image and ran a threshold on it, using Image>Adjust>Adjust threshold, and
selected something that seemed to capture all of the cells.  I then went to
Edit>Selection>make mask to create a separate mask derived from the
thresholded image.  I then ran Process>binary>watershed to reduce the cell
clusters to individuals.  This was followed by Edit>selection>make
selection (on the binary image).  I then selected the original image, and
clicked on Edit>selection>restore selection.  This gave me the first image
that you can see.  Note that it includes most of the cells, but also lots
of smaller objects.  I then used Analyze Particles, having first selected
Area in set measurements.  In the Analyze Particles menu, I deselected
"ignore edges" and "ignore holes".  I also restricted the size to between
1000 and infinity.  That elminates the small stuff.  I also asked it to
display outlines.  You can see the result in the second image.  I Counted
90 cells in the first run, and 77 in the second.  The difference is due to
how I set the thresholds.  That can be tricky.

Here is the macro sequence, but it needs fleshing out.

run("Split Channels");
selectWindow("447_1.4_40XRGB_LeftBA_-1.84Bregma_c2.JPG (blue)");
close();
selectWindow("447_1.4_40XRGB_LeftBA_-1.84Bregma_c2.JPG (green)");
selectWindow("447_1.4_40XRGB_LeftBA_-1.84Bregma_c2.JPG (red)");
close();
selectWindow("447_1.4_40XRGB_LeftBA_-1.84Bregma_c2.JPG (green)");
run("Bandpass Filter...", "filter_large=200 filter_small=0 suppress=None
tolerance=5");
setAutoThreshold("Default");
//run("Threshold...");
run("Create Mask");
run("Watershed");
run("Create Selection");
selectWindow("447_1.4_40XRGB_LeftBA_-1.84Bregma_c2.JPG (green)");
run("Restore Selection");
run("Set Measurements...", "area mean redirect=None decimal=3");
selectWindow("447_1.4_40XRGB_LeftBA_-1.84Bregma_c2.JPG (green)");
run("Analyze Particles...", "size=200-Infinity show=Outlines display
clear");
close();
run("Analyze Particles...", "size=1000-Infinity show=Outlines display
clear");

Joel
[image: Inline image 3][image: Inline image 1]



Joel B. Sheffield, Ph.D
Department of Biology
Temple University
Philadelphia, PA 19122
Voice: 215 204 8839
e-mail: [hidden email]
URL:  http://astro.temple.edu/~jbs


On Thu, Apr 24, 2014 at 3:19 PM, SARAH ROSE STERLACE <
[hidden email]> wrote:

> Thank you so much your reply! The macro works pretty well, but conservative
> for the positive pictures, however, I also have neighboring regions (to
> show the limited spread) that have no fluorescent neurons stained, but do
> contain "dust." (or autofluorescence). It seems to recognize and
> overestimate in these regions.  I have attached a picture of the
> neighboring regions.  When I applied your macro, it came up with 38.
> Any thoughts?
> I am relatively new to Image J, so please let me know if this is because of
> "user error."
>
> thanks!
>
>
>
> On Thu, Apr 24, 2014 at 11:15 AM, BioVoxxel <[hidden email]
> >wrote:
>
> > Hi Sarah,
> >
> > You might try the following short macro:
> >
> > run("Subtract Background...", "rolling=100");
> > run("Median...", "radius=12");
> > run("Minimum...", "radius=8");
> > run("Find Maxima...", "noise=2 output=[Count] exclude");
> > run("Find Maxima...", "noise=2 output=[Point Selection] exclude");
> > run("Revert");
> >
> > If your images are all similar, this might be able to recognize mist of
> > your cells and count them.
> >
> > regards,
> > Jan
> >
> >
> > 2014-04-24 18:54 GMT+02:00 SARAH ROSE STERLACE <[hidden email]
> >:
> >
> > > Hello,
> > > I am having trouble how to figure out a way to automatically count the
> > GFP
> > > stain without counting the background. I have been using the ITCN
> plugin,
> > > but I cannot figure out how to have it just count the circles.  Any
> help
> > > would be greatly appreciated.
> > > I have been inverting the image, setting it to 8-bit and enhancing the
> > > contrast by 3% to show the cells stained deeper in the tissue better to
> > see
> > > if that would help.  (i have not attached that image because it exceeds
> > the
> > > size for the email) I am attaching an original image. I have about 100
> > > images to count, so if I could figure out how to automate the counting
> > that
> > > would be awesome!
> > >
> > > --
> > > Sarah R Sterlace, C. Phil
> > >
> > > --
> > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> > >
> >
> >
> >
> > --
> >
> > CEO: Dr. rer. nat. Jan Brocher
> > phone:  +49 (0)6234 917 03 39
> > mobile: +49 (0)176 705 746 81
> > e-mail: [hidden email]
> > info: [hidden email]
> > inquiries: [hidden email]
> > web: www.biovoxxel.de
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
>
>
> --
> Sarah R Sterlace, C. Phil
> my email address: [hidden email]
>
> Behavioral Neuroscience
> UCLA
> 502 Portola Plaza
> A225 Franz Hall
> Los Angeles, CA 90095-1563
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Drawing of mask.jpg (499K) Download Attachment
Threshold.JPG (132K) Download Attachment