Detecting grid of a counting chamber (hemocytometer)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Detecting grid of a counting chamber (hemocytometer)

verified.human
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid of a counting chamber (hemocytometer)

Michael Schmid
Hi Tom,

maybe not the most elegant version, but something like this might work:

Rotate to get horizontal&vertical lines. If the angle differs from  
image to image, you could use the FFT, transform it from polar to  
cartesian coordinates, blur it in the direction that was formerly the  
radius and find the maxima.

Then duplicate the image. Using the 'Fast Filters' plugin, run a  
median filter with large radius (e.g. 30) in x, but radius=0 in y.
Subtract the background ('light background' off, radius=3 or so),  
then threshold it to get the lines without any interruption. A few  
short additional streaks won't hurt.

On the other copy, do the same with the median filter in y instead of  
x, to get the vertical lines.

Combine the two (Process>Image Calculator), so you have the full  
grid, rotate it back, crop it to the original size  
(Image>Adjust>Canvas Size).

Finally, you can run 'Analyze particles' on it, excluding the edge  
particles, and restricting the size range to a reasonable value for  
your squares.

To cast it into a macro, use Plugins>Macros>Record.


Michael
________________________________________________________________

On 12 Oct 2011, at 14:29, Tom Runia wrote:

> Hello everybody,
>
> I have this image of cells in a hemocytometer:
> http://tweakers.net/ext/f/tFsaAuonhgyescPqgBBBp5pP/full.png
> What I want to do is to detect and save all the squares that are fully
> visible (there are 12 in this case). Does anybody know a good and  
> easy way
> to detect these fully visible squares (or straight lines at least).  
> I can
> think of a manual way but hopefully ImageJ can help me with this
> problem! The next step is to count the cells in each square so  
> easiest way
> for me is to have all those squares as a ROI.
>
> Thanks!
>
> Tom
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid of a counting chamber (hemocytometer)

Bill Rothman
In reply to this post by verified.human
Tom,
I do a similar thing:count hematopoetic stem cell colony forming units.
If your cells are distributed randomly and it looks like a white dot for each cell.
Why not invert  b&W and thresh hold  out all but the black spots and then count with Analyze Particles in a roi that's a known multiple of the counting square?
Could be a problem with cells too close; we have to dilute to minimize close proximity objects.
Can you capture images without the grid?
Bill Rothman

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Tom Runia
Sent: Wednesday, October 12, 2011 8:29 AM
To: [hidden email]
Subject: Detecting grid of a counting chamber (hemocytometer)

Hello everybody,

I have this image of cells in a hemocytometer:
http://tweakers.net/ext/f/tFsaAuonhgyescPqgBBBp5pP/full.png
What I want to do is to detect and save all the squares that are fully
visible (there are 12 in this case). Does anybody know a good and easy way
to detect these fully visible squares (or straight lines at least). I can
think of a manual way but hopefully ImageJ can help me with this
problem! The next step is to count the cells in each square so easiest way
for me is to have all those squares as a ROI.

Thanks!

Tom
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid of a counting chamber (hemocytometer)

Anderson, Charles (DNR)
Perhaps a wildly wrong idea, but...

Wouldn't using any virtual grid of the same dimensions work just as well, rather than requiring that specific grid location and orientation? In that case, only the x,y coordinates of the objects (and the grid cell dimension in pixels--150 for an arbitrary example) are needed.  After obtaining the coordinates using Analyze Particles, I would use a separate stats program to assign them to grid_colum and grid_row ( those with 0 <= x <149 are in column 1, 150 <=x <299 are in column 2, etc.). The simply tabulate by column and row to obtain counts of objects in each grid cell.   Some additional care may be required to include only those cells completely within the image, or to place the origin at some random location.  

But, if you must use that particular grid, you could modify the approach from the web link below to create ROIs that are not horizontally aligned.

http://imagej.588099.n2.nabble.com/How-to-create-a-regular-grid-of-rectangular-ROI-s-td6250398.html

Charles Anderson

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Rothman, William
Sent: Wednesday, October 12, 2011 12:32 PM
To: [hidden email]
Subject: Re: Detecting grid of a counting chamber (hemocytometer)

Tom,
I do a similar thing:count hematopoetic stem cell colony forming units.
If your cells are distributed randomly and it looks like a white dot for each cell.
Why not invert  b&W and thresh hold  out all but the black spots and then count with Analyze Particles in a roi that's a known multiple of the counting square?
Could be a problem with cells too close; we have to dilute to minimize close proximity objects.
Can you capture images without the grid?
Bill Rothman

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Tom Runia
Sent: Wednesday, October 12, 2011 8:29 AM
To: [hidden email]
Subject: Detecting grid of a counting chamber (hemocytometer)

Hello everybody,

I have this image of cells in a hemocytometer:
http://tweakers.net/ext/f/tFsaAuonhgyescPqgBBBp5pP/full.png
What I want to do is to detect and save all the squares that are fully
visible (there are 12 in this case). Does anybody know a good and easy way
to detect these fully visible squares (or straight lines at least). I can
think of a manual way but hopefully ImageJ can help me with this
problem! The next step is to count the cells in each square so easiest way
for me is to have all those squares as a ROI.

Thanks!

Tom
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid of a counting chamber (hemocytometer)

Benjamin Grant
Charles is correct, I can't think of any reason you need to follow the grid
from the hemocytometer, just make your own

On Wed, Oct 12, 2011 at 1:20 PM, Anderson, Charles (DNR) <
[hidden email]> wrote:

> Perhaps a wildly wrong idea, but...
>
> Wouldn't using any virtual grid of the same dimensions work just as well,
> rather than requiring that specific grid location and orientation? In that
> case, only the x,y coordinates of the objects (and the grid cell dimension
> in pixels--150 for an arbitrary example) are needed.  After obtaining the
> coordinates using Analyze Particles, I would use a separate stats program to
> assign them to grid_colum and grid_row ( those with 0 <= x <149 are in
> column 1, 150 <=x <299 are in column 2, etc.). The simply tabulate by column
> and row to obtain counts of objects in each grid cell.   Some additional
> care may be required to include only those cells completely within the
> image, or to place the origin at some random location.
>
> But, if you must use that particular grid, you could modify the approach
> from the web link below to create ROIs that are not horizontally aligned.
>
>
> http://imagej.588099.n2.nabble.com/How-to-create-a-regular-grid-of-rectangular-ROI-s-td6250398.html
>
> Charles Anderson
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
> Rothman, William
> Sent: Wednesday, October 12, 2011 12:32 PM
> To: [hidden email]
> Subject: Re: Detecting grid of a counting chamber (hemocytometer)
>
> Tom,
> I do a similar thing:count hematopoetic stem cell colony forming units.
> If your cells are distributed randomly and it looks like a white dot for
> each cell.
> Why not invert  b&W and thresh hold  out all but the black spots and then
> count with Analyze Particles in a roi that's a known multiple of the
> counting square?
> Could be a problem with cells too close; we have to dilute to minimize
> close proximity objects.
> Can you capture images without the grid?
> Bill Rothman
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Tom
> Runia
> Sent: Wednesday, October 12, 2011 8:29 AM
> To: [hidden email]
> Subject: Detecting grid of a counting chamber (hemocytometer)
>
> Hello everybody,
>
> I have this image of cells in a hemocytometer:
> http://tweakers.net/ext/f/tFsaAuonhgyescPqgBBBp5pP/full.png
> What I want to do is to detect and save all the squares that are fully
> visible (there are 12 in this case). Does anybody know a good and easy way
> to detect these fully visible squares (or straight lines at least). I can
> think of a manual way but hopefully ImageJ can help me with this
> problem! The next step is to count the cells in each square so easiest way
> for me is to have all those squares as a ROI.
>
> Thanks!
>
> Tom
>



--
Benjamin Grant
Rice University
Department of Bioengineering: McDevitt Lab
[hidden email]
www.tastechip.com
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid of a counting chamber (hemocytometer)

verified.human
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid of a counting chamber (hemocytometer)

fabrice senger-2
Give this a try...

run("Enhance Contrast", "saturated=0.4 normalize equalize");
run("Duplicate...", "title=01");
run("Gaussian Blur...", "sigma=5");
imageCalculator("Subtract create", "258441.png","01");
setAutoThreshold("Default dark");
//run("Threshold...");
setThreshold(29, 255);
run("Convert to Mask");
run("Close");
run("Dilate");
run("Invert");
run("Analyze Particles...", "size=100-Infinity circularity=0.00-1.00
show=Nothing add");


2011/10/13 Tom Runia <[hidden email]>

> Thanks all for your helpfull comments!
>
> I think you are right about creating my own grid. That is a probably much
> better solution!
> First I thought that the cells might not be uniformly distrubited outside
> the squares but looking at some more images suggests this is not the case:
>
> http://tweakers.net/ext/f/qxSACpwr36khxQfNC0hlqqGO/full.png
> http://tweakers.net/ext/f/StU39NPWe6ZEnI1T57viR10x/full.png
>
> But still I have to automatically detect a square (or just a side) to
> determine the scale (pixel to mm) from the image, right? (sides are 50µm)
> Maybe I can use Michaels method to achieve this, but this method looks a
> little cumbersome. Maybe a pattern recognition approach works better in my
> case? Any thoughts on this would be more than welcome!
>
>
> 2011/10/12 Benjamin Grant <[hidden email]>
>
> > Charles is correct, I can't think of any reason you need to follow the
> grid
> > from the hemocytometer, just make your own
> >
> > On Wed, Oct 12, 2011 at 1:20 PM, Anderson, Charles (DNR) <
> > [hidden email]> wrote:
> >
> > > Perhaps a wildly wrong idea, but...
> > >
> > > Wouldn't using any virtual grid of the same dimensions work just as
> well,
> > > rather than requiring that specific grid location and orientation? In
> > that
> > > case, only the x,y coordinates of the objects (and the grid cell
> > dimension
> > > in pixels--150 for an arbitrary example) are needed.  After obtaining
> the
> > > coordinates using Analyze Particles, I would use a separate stats
> program
> > to
> > > assign them to grid_colum and grid_row ( those with 0 <= x <149 are in
> > > column 1, 150 <=x <299 are in column 2, etc.). The simply tabulate by
> > column
> > > and row to obtain counts of objects in each grid cell.   Some
> additional
> > > care may be required to include only those cells completely within the
> > > image, or to place the origin at some random location.
> > >
> > > But, if you must use that particular grid, you could modify the
> approach
> > > from the web link below to create ROIs that are not horizontally
> aligned.
> > >
> > >
> > >
> >
> http://imagej.588099.n2.nabble.com/How-to-create-a-regular-grid-of-rectangular-ROI-s-td6250398.html
> > >
> > > Charles Anderson
> > >
> > > -----Original Message-----
> > > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
> > > Rothman, William
> > > Sent: Wednesday, October 12, 2011 12:32 PM
> > > To: [hidden email]
> > > Subject: Re: Detecting grid of a counting chamber (hemocytometer)
> > >
> > > Tom,
> > > I do a similar thing:count hematopoetic stem cell colony forming units.
> > > If your cells are distributed randomly and it looks like a white dot
> for
> > > each cell.
> > > Why not invert  b&W and thresh hold  out all but the black spots and
> then
> > > count with Analyze Particles in a roi that's a known multiple of the
> > > counting square?
> > > Could be a problem with cells too close; we have to dilute to minimize
> > > close proximity objects.
> > > Can you capture images without the grid?
> > > Bill Rothman
> > >
> > > -----Original Message-----
> > > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
> > Tom
> > > Runia
> > > Sent: Wednesday, October 12, 2011 8:29 AM
> > > To: [hidden email]
> > > Subject: Detecting grid of a counting chamber (hemocytometer)
> > >
> > > Hello everybody,
> > >
> > > I have this image of cells in a hemocytometer:
> > > http://tweakers.net/ext/f/tFsaAuonhgyescPqgBBBp5pP/full.png
> > > What I want to do is to detect and save all the squares that are fully
> > > visible (there are 12 in this case). Does anybody know a good and easy
> > way
> > > to detect these fully visible squares (or straight lines at least). I
> can
> > > think of a manual way but hopefully ImageJ can help me with this
> > > problem! The next step is to count the cells in each square so easiest
> > way
> > > for me is to have all those squares as a ROI.
> > >
> > > Thanks!
> > >
> > > Tom
> > >
> >
> >
> >
> > --
> > Benjamin Grant
> > Rice University
> > Department of Bioengineering: McDevitt Lab
> > [hidden email]
> > www.tastechip.com
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid of a counting chamber (hemocytometer)

verified.human
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid of a counting chamber (hemocytometer)

fabrice senger-2
Hi,

the macro :

first you "enhance contrast" to see that your illumination is really not
even;
next you duplicate you image and apply a gaussian blur( in this case about
5)
then you substract that image to the original;
now you can threshold the resulting image and the lines appear clearly,
you get a binary image;
you should dilate so the lines are clean,
then you run "analyze particles" (with the option "add to manager")
go through the "ROI" and just keep the interesting ones or play around with
the size in "analyze particles"...

It's sought to give you soma orientations,

Fabrice.

2011/10/13 Tom Runia <[hidden email]>

> Hi Fabrice,
>
> I have tried the macro but I don't know what it is supposed to do...? I
> replaced the "258441.png" with my own (original) image but running the
> macro
> results in two images: one with a good contrast and one blurred image. Can
> you briefly explain what this macro does and what technique it's using?
> Thanks!
>
> Maybe a Hough Transform (line detection algorithm) is a good way to detect
> the lines? I had never heard from this method before, but I did some
> reading
> about it and it looks like a promising algorithm. Has anybody ever used it
> and if yes, will it be suitable for my problem?
>
> With some adjustments of the contrast and thresholding I can get a binary
> image like this one:
> http://tweakers.net/ext/f/6NszRBKaCOU9mYxRu0vbHw1G/full.png
>
> gr,
>
> Tom
>
>
> 2011/10/13 fabrice senger <[hidden email]>
>
> > Give this a try...
> >
> > run("Enhance Contrast", "saturated=0.4 normalize equalize");
> > run("Duplicate...", "title=01");
> > run("Gaussian Blur...", "sigma=5");
> > imageCalculator("Subtract create", "258441.png","01");
> > setAutoThreshold("Default dark");
> > //run("Threshold...");
> > setThreshold(29, 255);
> > run("Convert to Mask");
> > run("Close");
> > run("Dilate");
> > run("Invert");
> > run("Analyze Particles...", "size=100-Infinity circularity=0.00-1.00
> > show=Nothing add");
> >
> >
> > 2011/10/13 Tom Runia <[hidden email]>
> >
> > > Thanks all for your helpfull comments!
> > >
> > > I think you are right about creating my own grid. That is a probably
> much
> > > better solution!
> > > First I thought that the cells might not be uniformly distrubited
> outside
> > > the squares but looking at some more images suggests this is not the
> > case:
> > >
> > > http://tweakers.net/ext/f/qxSACpwr36khxQfNC0hlqqGO/full.png
> > > http://tweakers.net/ext/f/StU39NPWe6ZEnI1T57viR10x/full.png
> > >
> > > But still I have to automatically detect a square (or just a side) to
> > > determine the scale (pixel to mm) from the image, right? (sides are
> 50µm)
> > > Maybe I can use Michaels method to achieve this, but this method looks
> a
> > > little cumbersome. Maybe a pattern recognition approach works better in
> > my
> > > case? Any thoughts on this would be more than welcome!
> > >
> > >
> > > 2011/10/12 Benjamin Grant <[hidden email]>
> > >
> > > > Charles is correct, I can't think of any reason you need to follow
> the
> > > grid
> > > > from the hemocytometer, just make your own
> > > >
> > > > On Wed, Oct 12, 2011 at 1:20 PM, Anderson, Charles (DNR) <
> > > > [hidden email]> wrote:
> > > >
> > > > > Perhaps a wildly wrong idea, but...
> > > > >
> > > > > Wouldn't using any virtual grid of the same dimensions work just as
> > > well,
> > > > > rather than requiring that specific grid location and orientation?
> In
> > > > that
> > > > > case, only the x,y coordinates of the objects (and the grid cell
> > > > dimension
> > > > > in pixels--150 for an arbitrary example) are needed.  After
> obtaining
> > > the
> > > > > coordinates using Analyze Particles, I would use a separate stats
> > > program
> > > > to
> > > > > assign them to grid_colum and grid_row ( those with 0 <= x <149 are
> > in
> > > > > column 1, 150 <=x <299 are in column 2, etc.). The simply tabulate
> by
> > > > column
> > > > > and row to obtain counts of objects in each grid cell.   Some
> > > additional
> > > > > care may be required to include only those cells completely within
> > the
> > > > > image, or to place the origin at some random location.
> > > > >
> > > > > But, if you must use that particular grid, you could modify the
> > > approach
> > > > > from the web link below to create ROIs that are not horizontally
> > > aligned.
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> http://imagej.588099.n2.nabble.com/How-to-create-a-regular-grid-of-rectangular-ROI-s-td6250398.html
> > > > >
> > > > > Charles Anderson
> > > > >
> > > > > -----Original Message-----
> > > > > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf
> > Of
> > > > > Rothman, William
> > > > > Sent: Wednesday, October 12, 2011 12:32 PM
> > > > > To: [hidden email]
> > > > > Subject: Re: Detecting grid of a counting chamber (hemocytometer)
> > > > >
> > > > > Tom,
> > > > > I do a similar thing:count hematopoetic stem cell colony forming
> > units.
> > > > > If your cells are distributed randomly and it looks like a white
> dot
> > > for
> > > > > each cell.
> > > > > Why not invert  b&W and thresh hold  out all but the black spots
> and
> > > then
> > > > > count with Analyze Particles in a roi that's a known multiple of
> the
> > > > > counting square?
> > > > > Could be a problem with cells too close; we have to dilute to
> > minimize
> > > > > close proximity objects.
> > > > > Can you capture images without the grid?
> > > > > Bill Rothman
> > > > >
> > > > > -----Original Message-----
> > > > > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf
> > Of
> > > > Tom
> > > > > Runia
> > > > > Sent: Wednesday, October 12, 2011 8:29 AM
> > > > > To: [hidden email]
> > > > > Subject: Detecting grid of a counting chamber (hemocytometer)
> > > > >
> > > > > Hello everybody,
> > > > >
> > > > > I have this image of cells in a hemocytometer:
> > > > > http://tweakers.net/ext/f/tFsaAuonhgyescPqgBBBp5pP/full.png
> > > > > What I want to do is to detect and save all the squares that are
> > fully
> > > > > visible (there are 12 in this case). Does anybody know a good and
> > easy
> > > > way
> > > > > to detect these fully visible squares (or straight lines at least).
> I
> > > can
> > > > > think of a manual way but hopefully ImageJ can help me with this
> > > > > problem! The next step is to count the cells in each square so
> > easiest
> > > > way
> > > > > for me is to have all those squares as a ROI.
> > > > >
> > > > > Thanks!
> > > > >
> > > > > Tom
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Benjamin Grant
> > > > Rice University
> > > > Department of Bioengineering: McDevitt Lab
> > > > [hidden email]
> > > > www.tastechip.com
> > > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid of a counting chamber (hemocytometer)

Anderson, Charles (DNR)
In reply to this post by verified.human
Tom,

Keep it simple! The simplest approach would be to calibrate once for your standard image (same camera and magnification), then calculate the hemocytometer volume seen in a standard image. Then you simply need a macro to count and record the total targets in each image. The grid serves only in the initial manual calibration to calculate volume.

It is easy to reduce target objects to single pixel dark spots (255) on white (0).
run("Duplicate...", "title=a");
run("Gaussian Blur...", "sigma=1");
run("Find Maxima...", "noise=20 output=[Single Points]");
Or threshold and Analyze Particles to get the total count

If you simply MUST have separate counts for more than one grid cell, run Analyze Particles on the aMaxima image, export the target coordinates to a stats program and proceed as I previously suggested to tabulate counts per grid cell on your own grid.

More complex: create your own ROIs so each encloses 50 X 50 microns, then count the specks in each region. There is a previous post on "How to create a regular grid of rectangular ROI's?" that may help.

Other approaches have greater difficulty and may have bias. The Hough transform would certainly allow you to identify the grid lines (see similar examples in Burger and Burge's book), but you would then still have to figure out how to create ROIs from the lines. Skip the Hough transform and create your own ROIs.

Fabrice's code is ingenious, but many target objects near the lines end up fused to the thick grid lines where they would not be counted; counts would be severely biased. I deleted the "run("Close");" line and changed the image name, then Fabrice's code ran for me. Essentially, it exaggerates the contrast over several steps, then dilates to fill in any small gaps remaining in the lines. By inverting, the lines become white, thus the dark objects identified by Analyze Particles are the large black squares (with white holes) that are "inside" the white lines. The ROI's that surround each large black object only approximately define the interior of the grid cells. With some more work, you might then query each ROI to count the white targets inside. However, many target objects have been fused with the thick grid lines, thus your counts would be wrong.

Charles

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Tom Runia
Sent: Thursday, October 13, 2011 9:38 AM
To: [hidden email]
Subject: Re: Detecting grid of a counting chamber (hemocytometer)

Hi Fabrice,

I have tried the macro but I don't know what it is supposed to do...? I
replaced the "258441.png" with my own (original) image but running the macro
results in two images: one with a good contrast and one blurred image. Can
you briefly explain what this macro does and what technique it's using?
Thanks!

Maybe a Hough Transform (line detection algorithm) is a good way to detect
the lines? I had never heard from this method before, but I did some reading
about it and it looks like a promising algorithm. Has anybody ever used it
and if yes, will it be suitable for my problem?

With some adjustments of the contrast and thresholding I can get a binary
image like this one:
http://tweakers.net/ext/f/6NszRBKaCOU9mYxRu0vbHw1G/full.png

gr,

Tom


2011/10/13 fabrice senger <[hidden email]>

> Give this a try...
>
> run("Enhance Contrast", "saturated=0.4 normalize equalize");
> run("Duplicate...", "title=01");
> run("Gaussian Blur...", "sigma=5");
> imageCalculator("Subtract create", "258441.png","01");
> setAutoThreshold("Default dark");
> //run("Threshold...");
> setThreshold(29, 255);
> run("Convert to Mask");
> run("Close");
> run("Dilate");
> run("Invert");
> run("Analyze Particles...", "size=100-Infinity circularity=0.00-1.00
> show=Nothing add");
>
>
> 2011/10/13 Tom Runia <[hidden email]>
>
> > Thanks all for your helpfull comments!
> >
> > I think you are right about creating my own grid. That is a probably much
> > better solution!
> > First I thought that the cells might not be uniformly distrubited outside
> > the squares but looking at some more images suggests this is not the
> case:
> >
> > http://tweakers.net/ext/f/qxSACpwr36khxQfNC0hlqqGO/full.png
> > http://tweakers.net/ext/f/StU39NPWe6ZEnI1T57viR10x/full.png
> >
> > But still I have to automatically detect a square (or just a side) to
> > determine the scale (pixel to mm) from the image, right? (sides are 50µm)
> > Maybe I can use Michaels method to achieve this, but this method looks a
> > little cumbersome. Maybe a pattern recognition approach works better in
> my
> > case? Any thoughts on this would be more than welcome!
> >
> >
> > 2011/10/12 Benjamin Grant <[hidden email]>
> >
> > > Charles is correct, I can't think of any reason you need to follow the
> > grid
> > > from the hemocytometer, just make your own
> > >
> > > On Wed, Oct 12, 2011 at 1:20 PM, Anderson, Charles (DNR) <
> > > [hidden email]> wrote:
> > >
> > > > Perhaps a wildly wrong idea, but...
> > > >
> > > > Wouldn't using any virtual grid of the same dimensions work just as
> > well,
> > > > rather than requiring that specific grid location and orientation? In
> > > that
> > > > case, only the x,y coordinates of the objects (and the grid cell
> > > dimension
> > > > in pixels--150 for an arbitrary example) are needed.  After obtaining
> > the
> > > > coordinates using Analyze Particles, I would use a separate stats
> > program
> > > to
> > > > assign them to grid_colum and grid_row ( those with 0 <= x <149 are
> in
> > > > column 1, 150 <=x <299 are in column 2, etc.). The simply tabulate by
> > > column
> > > > and row to obtain counts of objects in each grid cell.   Some
> > additional
> > > > care may be required to include only those cells completely within
> the
> > > > image, or to place the origin at some random location.
> > > >
> > > > But, if you must use that particular grid, you could modify the
> > approach
> > > > from the web link below to create ROIs that are not horizontally
> > aligned.
> > > >
> > > >
> > > >
> > >
> >
> http://imagej.588099.n2.nabble.com/How-to-create-a-regular-grid-of-rectangular-ROI-s-td6250398.html
> > > >
> > > > Charles Anderson
> > > >
> > > > -----Original Message-----
> > > > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf
> Of
> > > > Rothman, William
> > > > Sent: Wednesday, October 12, 2011 12:32 PM
> > > > To: [hidden email]
> > > > Subject: Re: Detecting grid of a counting chamber (hemocytometer)
> > > >
> > > > Tom,
> > > > I do a similar thing:count hematopoetic stem cell colony forming
> units.
> > > > If your cells are distributed randomly and it looks like a white dot
> > for
> > > > each cell.
> > > > Why not invert  b&W and thresh hold  out all but the black spots and
> > then
> > > > count with Analyze Particles in a roi that's a known multiple of the
> > > > counting square?
> > > > Could be a problem with cells too close; we have to dilute to
> minimize
> > > > close proximity objects.
> > > > Can you capture images without the grid?
> > > > Bill Rothman
> > > >
> > > > -----Original Message-----
> > > > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf
> Of
> > > Tom
> > > > Runia
> > > > Sent: Wednesday, October 12, 2011 8:29 AM
> > > > To: [hidden email]
> > > > Subject: Detecting grid of a counting chamber (hemocytometer)
> > > >
> > > > Hello everybody,
> > > >
> > > > I have this image of cells in a hemocytometer:
> > > > http://tweakers.net/ext/f/tFsaAuonhgyescPqgBBBp5pP/full.png
> > > > What I want to do is to detect and save all the squares that are
> fully
> > > > visible (there are 12 in this case). Does anybody know a good and
> easy
> > > way
> > > > to detect these fully visible squares (or straight lines at least). I
> > can
> > > > think of a manual way but hopefully ImageJ can help me with this
> > > > problem! The next step is to count the cells in each square so
> easiest
> > > way
> > > > for me is to have all those squares as a ROI.
> > > >
> > > > Thanks!
> > > >
> > > > Tom
> > > >
> > >
> > >
> > >
> > > --
> > > Benjamin Grant
> > > Rice University
> > > Department of Bioengineering: McDevitt Lab
> > > [hidden email]
> > > www.tastechip.com
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Detecting grid of a counting chamber (hemocytometer)

fabrice senger-2
Yes!
I agree with Charles Idea, even my code is "ingenious".
Fabrice.

2011/10/13 Anderson, Charles (DNR) <[hidden email]>

> Tom,
>
> Keep it simple! The simplest approach would be to calibrate once for your
> standard image (same camera and magnification), then calculate the
> hemocytometer volume seen in a standard image. Then you simply need a macro
> to count and record the total targets in each image. The grid serves only in
> the initial manual calibration to calculate volume.
>
> It is easy to reduce target objects to single pixel dark spots (255) on
> white (0).
> run("Duplicate...", "title=a");
> run("Gaussian Blur...", "sigma=1");
> run("Find Maxima...", "noise=20 output=[Single Points]");
> Or threshold and Analyze Particles to get the total count
>
> If you simply MUST have separate counts for more than one grid cell, run
> Analyze Particles on the aMaxima image, export the target coordinates to a
> stats program and proceed as I previously suggested to tabulate counts per
> grid cell on your own grid.
>
> More complex: create your own ROIs so each encloses 50 X 50 microns, then
> count the specks in each region. There is a previous post on "How to create
> a regular grid of rectangular ROI's?" that may help.
>
> Other approaches have greater difficulty and may have bias. The Hough
> transform would certainly allow you to identify the grid lines (see similar
> examples in Burger and Burge's book), but you would then still have to
> figure out how to create ROIs from the lines. Skip the Hough transform and
> create your own ROIs.
>
> Fabrice's code is ingenious, but many target objects near the lines end up
> fused to the thick grid lines where they would not be counted; counts would
> be severely biased. I deleted the "run("Close");" line and changed the image
> name, then Fabrice's code ran for me. Essentially, it exaggerates the
> contrast over several steps, then dilates to fill in any small gaps
> remaining in the lines. By inverting, the lines become white, thus the dark
> objects identified by Analyze Particles are the large black squares (with
> white holes) that are "inside" the white lines. The ROI's that surround each
> large black object only approximately define the interior of the grid cells.
> With some more work, you might then query each ROI to count the white
> targets inside. However, many target objects have been fused with the thick
> grid lines, thus your counts would be wrong.
>
> Charles
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Tom
> Runia
> Sent: Thursday, October 13, 2011 9:38 AM
> To: [hidden email]
> Subject: Re: Detecting grid of a counting chamber (hemocytometer)
>
> Hi Fabrice,
>
> I have tried the macro but I don't know what it is supposed to do...? I
> replaced the "258441.png" with my own (original) image but running the
> macro
> results in two images: one with a good contrast and one blurred image. Can
> you briefly explain what this macro does and what technique it's using?
> Thanks!
>
> Maybe a Hough Transform (line detection algorithm) is a good way to detect
> the lines? I had never heard from this method before, but I did some
> reading
> about it and it looks like a promising algorithm. Has anybody ever used it
> and if yes, will it be suitable for my problem?
>
> With some adjustments of the contrast and thresholding I can get a binary
> image like this one:
> http://tweakers.net/ext/f/6NszRBKaCOU9mYxRu0vbHw1G/full.png
>
> gr,
>
> Tom
>
>
> 2011/10/13 fabrice senger <[hidden email]>
>
> > Give this a try...
> >
> > run("Enhance Contrast", "saturated=0.4 normalize equalize");
> > run("Duplicate...", "title=01");
> > run("Gaussian Blur...", "sigma=5");
> > imageCalculator("Subtract create", "258441.png","01");
> > setAutoThreshold("Default dark");
> > //run("Threshold...");
> > setThreshold(29, 255);
> > run("Convert to Mask");
> > run("Close");
> > run("Dilate");
> > run("Invert");
> > run("Analyze Particles...", "size=100-Infinity circularity=0.00-1.00
> > show=Nothing add");
> >
> >
> > 2011/10/13 Tom Runia <[hidden email]>
> >
> > > Thanks all for your helpfull comments!
> > >
> > > I think you are right about creating my own grid. That is a probably
> much
> > > better solution!
> > > First I thought that the cells might not be uniformly distrubited
> outside
> > > the squares but looking at some more images suggests this is not the
> > case:
> > >
> > > http://tweakers.net/ext/f/qxSACpwr36khxQfNC0hlqqGO/full.png
> > > http://tweakers.net/ext/f/StU39NPWe6ZEnI1T57viR10x/full.png
> > >
> > > But still I have to automatically detect a square (or just a side) to
> > > determine the scale (pixel to mm) from the image, right? (sides are
> 50µm)
> > > Maybe I can use Michaels method to achieve this, but this method looks
> a
> > > little cumbersome. Maybe a pattern recognition approach works better in
> > my
> > > case? Any thoughts on this would be more than welcome!
> > >
> > >
> > > 2011/10/12 Benjamin Grant <[hidden email]>
> > >
> > > > Charles is correct, I can't think of any reason you need to follow
> the
> > > grid
> > > > from the hemocytometer, just make your own
> > > >
> > > > On Wed, Oct 12, 2011 at 1:20 PM, Anderson, Charles (DNR) <
> > > > [hidden email]> wrote:
> > > >
> > > > > Perhaps a wildly wrong idea, but...
> > > > >
> > > > > Wouldn't using any virtual grid of the same dimensions work just as
> > > well,
> > > > > rather than requiring that specific grid location and orientation?
> In
> > > > that
> > > > > case, only the x,y coordinates of the objects (and the grid cell
> > > > dimension
> > > > > in pixels--150 for an arbitrary example) are needed.  After
> obtaining
> > > the
> > > > > coordinates using Analyze Particles, I would use a separate stats
> > > program
> > > > to
> > > > > assign them to grid_colum and grid_row ( those with 0 <= x <149 are
> > in
> > > > > column 1, 150 <=x <299 are in column 2, etc.). The simply tabulate
> by
> > > > column
> > > > > and row to obtain counts of objects in each grid cell.   Some
> > > additional
> > > > > care may be required to include only those cells completely within
> > the
> > > > > image, or to place the origin at some random location.
> > > > >
> > > > > But, if you must use that particular grid, you could modify the
> > > approach
> > > > > from the web link below to create ROIs that are not horizontally
> > > aligned.
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> http://imagej.588099.n2.nabble.com/How-to-create-a-regular-grid-of-rectangular-ROI-s-td6250398.html
> > > > >
> > > > > Charles Anderson
> > > > >
> > > > > -----Original Message-----
> > > > > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf
> > Of
> > > > > Rothman, William
> > > > > Sent: Wednesday, October 12, 2011 12:32 PM
> > > > > To: [hidden email]
> > > > > Subject: Re: Detecting grid of a counting chamber (hemocytometer)
> > > > >
> > > > > Tom,
> > > > > I do a similar thing:count hematopoetic stem cell colony forming
> > units.
> > > > > If your cells are distributed randomly and it looks like a white
> dot
> > > for
> > > > > each cell.
> > > > > Why not invert  b&W and thresh hold  out all but the black spots
> and
> > > then
> > > > > count with Analyze Particles in a roi that's a known multiple of
> the
> > > > > counting square?
> > > > > Could be a problem with cells too close; we have to dilute to
> > minimize
> > > > > close proximity objects.
> > > > > Can you capture images without the grid?
> > > > > Bill Rothman
> > > > >
> > > > > -----Original Message-----
> > > > > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf
> > Of
> > > > Tom
> > > > > Runia
> > > > > Sent: Wednesday, October 12, 2011 8:29 AM
> > > > > To: [hidden email]
> > > > > Subject: Detecting grid of a counting chamber (hemocytometer)
> > > > >
> > > > > Hello everybody,
> > > > >
> > > > > I have this image of cells in a hemocytometer:
> > > > > http://tweakers.net/ext/f/tFsaAuonhgyescPqgBBBp5pP/full.png
> > > > > What I want to do is to detect and save all the squares that are
> > fully
> > > > > visible (there are 12 in this case). Does anybody know a good and
> > easy
> > > > way
> > > > > to detect these fully visible squares (or straight lines at least).
> I
> > > can
> > > > > think of a manual way but hopefully ImageJ can help me with this
> > > > > problem! The next step is to count the cells in each square so
> > easiest
> > > > way
> > > > > for me is to have all those squares as a ROI.
> > > > >
> > > > > Thanks!
> > > > >
> > > > > Tom
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Benjamin Grant
> > > > Rice University
> > > > Department of Bioengineering: McDevitt Lab
> > > > [hidden email]
> > > > www.tastechip.com
> > > >
> > >
> >
>