Disector counting frame

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

Disector counting frame

Robert Bagnell
Would it be possible to add an unbiased disector counting frame to
the choices in the Grid plug-in? This would be very helpful in
carrying out steriological counting of cells using the optical
disector method. Have I missed an existing plug-in to do this?

Many thanks,

Bob
--
C. Robert Bagnell, Jr., Ph.D.
Professor and
Director, Microscopy Services Laboratory
Department of Pathology and Laboratory Medicine
University of North Carolina at Chapel Hill
Chapel Hill, NC 27599
phone 919-966-2413
fax 919-966-6718
e-mail [hidden email]
web http://www.med.unc.edu/microscopy
Reply | Threaded
Open this post in threaded view
|

Re: Disector counting frame

Albert Cardona
Hi Robert,

> Would it be possible to add an unbiased disector counting frame to the
> choices in the Grid plug-in? This would be very helpful in carrying
> out steriological counting of cells using the optical disector method.
> Have I missed an existing plug-in to do this?


You can do this with TrakEM2's dissector data type:


http://www.ini.uzh.ch/~acardona/trakem2_manual.html#dissectors

The manual is a bit out of date, try "Measure" to get a results table of
counts.

The dissector data type lets you have counts across more than just two
sections; the results table will tag each identified object -- so
non-repeating tags are newly appearing objects.

The area where one does the dissector can be measure by doing a standard
ROI and seeing it's width/heigth in ImageJ's status bar. Unfortunately I
have not finished yet most of the measuring tools I'd like to have.

Please let me know if you run into any issues.

Albert

--
Albert Cardona
http://www.mcdb.ucla.edu/Research/Hartenstein/acardona
Reply | Threaded
Open this post in threaded view
|

Re: Disector counting frame

Teresa W
In reply to this post by Robert Bagnell
I used this approach to produce an unbiased dissector frame, and it may help those searching under this topic. I recorded the process as a macro and ran it automatically once I had determined the sizes of the different squares. It can be run on individual images or on an image stack.
 
Squares are defined in IJ by (X, Y, width, height), where XY is the right-hand top vertex. A random number generator and a spreadsheet can be used to calculate random XY co-ordinate start points, and so satisfy the requiremnts of an unbiased dissector.

Set on Record Macro to capture procedures.

From your thresholded binary image, first sample a square around 2x the size of the largest particle you want to count. Save as Sample image.

Set the Scale to global. Create and name a square frame image of the same size as the Sample square. Use New image & choose the required pixel size. Draw a slightly smaller square inside and fill it to give a border of black ~ 5-10 pixels. Save this border square as a binary Frame image.

Within the Sample image, draw a Count square to a known size (e.g. 1 mm2), starting from 0, 0 of the Sample image. Run Analyse Particles, Include On edges, Show Masks. Save the Mask as a binary Mask1 image. Save all Mask image as binary images, or later Image Calculator functions may not work.

Return to Sample image and use the Polygon tool to create an L-shaped ROI the inverse of the Count square, which shares 3 common vertices with the Count square on the inside part of the L. Using this L-ROI run Analyse Particles, Include On edges, Show Masks. Save Mask as Mask2 image. Then run Analyse Particles, exclude On Edges, Show Masks. Save Mask as Mask3. Subtract Mask 3 from Mask 2 to get only the particles intersecting the edges of the L-shaped ROI. Save as Mask 2. Add Mask2 to Mask1, Add Frame. Save as Mask2 and run Analyse Particles, exclude On Edges, Show Masks.

This gives you an image or a stack where the top and right-hand particles touching the Count square are excluded, while those jutting out of the bottom and left-hand have been stitched onto edges and are counted. There can be problems if your particles are too large for the Sample square and are truncated when they hit the border resulting from the Frame.

For stacks, I found that large stacks work best where the image stacks are all saved onto the Desktop, the use of Create New Window is used only when necessary, and intermediate image stacks are saved (hence all the Save steps).

Teresa Wegrzyn
Institute of Food, Nutrition and Human Health
Massey University
Palmerston North New Zealand.












Reply | Threaded
Open this post in threaded view
|

Re: Disector counting frame Ooops Actually Forbidden Line not Disector

Teresa W
In reply to this post by Robert Bagnell
What I thought I was talking about was an exclude/include count frame. My apologies.
Reply | Threaded
Open this post in threaded view
|

Re: Disector counting frame

Glen MacDonald-2
In reply to this post by Teresa W
Dear Teresa,
this an ingenious approach.  I have some macro lines that prompt for user input regarding grid placement and will create the grid with a systematic random placement that I will send separately.

Regards,
Glen
Glen MacDonald
Core for Communication Research
Virginia Merrill Bloedel Hearing Research Center
Box 357923
University of Washington
Seattle, WA 98195-7923  USA
(206) 616-4156
[hidden email]








On May 20, 2010, at 4:01 AM, Teresa W wrote:

> I used this approach to produce an unbiased dissector frame, and it may help
> those searching under this topic. I recorded the process as a macro and ran
> it automatically once I had determined the sizes of the different squares.
> It can be run on individual images or on an image stack.
>
> Squares are defined in IJ by (X, Y, width, height), where XY is the
> right-hand top vertex. A random number generator and a spreadsheet can be
> used to calculate random XY co-ordinate start points, and so satisfy the
> requiremnts of an unbiased dissector.
>
> Set on Record Macro to capture procedures.
>
> From your thresholded binary image, first sample a square around 2x the size
> of the largest particle you want to count. Save as Sample image.
>
> Set the Scale to global. Create and name a square frame image of the same
> size as the Sample square. Use New image & choose the required pixel size.
> Draw a slightly smaller square inside and fill it to give a border of black
> ~ 5-10 pixels. Save this border square as a binary Frame image.
>
> Within the Sample image, draw a Count square to a known size (e.g. 1 mm2),
> starting from 0, 0 of the Sample image. Run Analyse Particles, Include On
> edges, Show Masks. Save the Mask as a binary Mask1 image. Save all Mask
> image as binary images, or later Image Calculator functions may not work.
>
> Return to Sample image and use the Polygon tool to create an L-shaped ROI
> the inverse of the Count square, which shares 3 common vertices with the
> Count square on the inside part of the L. Using this L-ROI run Analyse
> Particles, Include On edges, Show Masks. Save Mask as Mask2 image. Then run
> Analyse Particles, exclude On Edges, Show Masks. Save Mask as Mask3.
> Subtract Mask 3 from Mask 2 to get only the particles intersecting the edges
> of the L-shaped ROI. Save as Mask 2. Add Mask2 to Mask1, Add Frame. Save as
> Mask2 and run Analyse Particles, exclude On Edges, Show Masks.
>
> This gives you an image or a stack where the top and right-hand particles
> touching the Count square are excluded, while those jutting out of the
> bottom and left-hand have been stitched onto edges and are counted. There
> can be problems if your particles are too large for the Sample square and
> are truncated when they hit the border resulting from the Frame.
>
> For stacks, I found that large stacks work best where the image stacks are
> all saved onto the Desktop, the use of Create New Window is used only when
> necessary, and intermediate image stacks are saved (hence all the Save
> steps).
>
> Teresa Wegrzyn
> Institute of Food, Nutrition and Human Health
> Massey University
> Palmerston North New Zealand.
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> View this message in context: http://imagej.588099.n2.nabble.com/Disector-counting-frame-tp636956p5079117.html
> Sent from the ImageJ mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Disector counting frame

Fabrice Senger
Glen MacDonald a écrit :

> Dear Teresa,
> this an ingenious approach.  I have some macro lines that prompt for user input regarding grid placement and will create the grid with a systematic random placement that I will send separately.
>
> Regards,
> Glen
> Glen MacDonald
> Core for Communication Research
> Virginia Merrill Bloedel Hearing Research Center
> Box 357923
> University of Washington
> Seattle, WA 98195-7923  USA
> (206) 616-4156
> [hidden email]
>
>
>
>
>
>
>
>
> On May 20, 2010, at 4:01 AM, Teresa W wrote:
>
>  
>> I used this approach to produce an unbiased dissector frame, and it may help
>> those searching under this topic. I recorded the process as a macro and ran
>> it automatically once I had determined the sizes of the different squares.
>> It can be run on individual images or on an image stack.
>>
>> Squares are defined in IJ by (X, Y, width, height), where XY is the
>> right-hand top vertex. A random number generator and a spreadsheet can be
>> used to calculate random XY co-ordinate start points, and so satisfy the
>> requiremnts of an unbiased dissector.
>>
>> Set on Record Macro to capture procedures.
>>
>> From your thresholded binary image, first sample a square around 2x the size
>> of the largest particle you want to count. Save as Sample image.
>>
>> Set the Scale to global. Create and name a square frame image of the same
>> size as the Sample square. Use New image & choose the required pixel size.
>> Draw a slightly smaller square inside and fill it to give a border of black
>> ~ 5-10 pixels. Save this border square as a binary Frame image.
>>
>> Within the Sample image, draw a Count square to a known size (e.g. 1 mm2),
>> starting from 0, 0 of the Sample image. Run Analyse Particles, Include On
>> edges, Show Masks. Save the Mask as a binary Mask1 image. Save all Mask
>> image as binary images, or later Image Calculator functions may not work.
>>
>> Return to Sample image and use the Polygon tool to create an L-shaped ROI
>> the inverse of the Count square, which shares 3 common vertices with the
>> Count square on the inside part of the L. Using this L-ROI run Analyse
>> Particles, Include On edges, Show Masks. Save Mask as Mask2 image. Then run
>> Analyse Particles, exclude On Edges, Show Masks. Save Mask as Mask3.
>> Subtract Mask 3 from Mask 2 to get only the particles intersecting the edges
>> of the L-shaped ROI. Save as Mask 2. Add Mask2 to Mask1, Add Frame. Save as
>> Mask2 and run Analyse Particles, exclude On Edges, Show Masks.
>>
>> This gives you an image or a stack where the top and right-hand particles
>> touching the Count square are excluded, while those jutting out of the
>> bottom and left-hand have been stitched onto edges and are counted. There
>> can be problems if your particles are too large for the Sample square and
>> are truncated when they hit the border resulting from the Frame.
>>
>> For stacks, I found that large stacks work best where the image stacks are
>> all saved onto the Desktop, the use of Create New Window is used only when
>> necessary, and intermediate image stacks are saved (hence all the Save
>> steps).
>>
>> Teresa Wegrzyn
>> Institute of Food, Nutrition and Human Health
>> Massey University
>> Palmerston North New Zealand.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://imagej.588099.n2.nabble.com/Disector-counting-frame-tp636956p5079117.html
>> Sent from the ImageJ mailing list archive at Nabble.com.
>>    
>
>  
Dear all,

I'm very interested in this kind of approaches and just wonder if this
(those) macro's are available ?

Thanks in advance,

Fabrice.
Reply | Threaded
Open this post in threaded view
|

Re: Disector counting frame Ooops Actually Count Frame Macro

Teresa W
Thanks guys for the interest, Fabrice, here's the Count Frame macro
(Subsampled a rectangle (0, 0, 356, 356) from my tiff image by using Contol-Shift-X)

saveAs("Tiff", "C:\\Documents and Settings\\Desktop\\scan.tif");
//setTool(0);
makeRectangle(0, 0, 236, 236);
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 show=Masks");
saveAs("Tiff", "C:\\Documents and Settings\\tfwegrzy\\Desktop\\Mask2.tif");
selectWindow("scan.tif");
//setTool(2);
makePolygon(356,0,236,0,236,236,0,236,0,356,356,356);
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 show=Masks");
saveAs("Tiff", "C:\\Documents and Settings\\Desktop\\Mask3.tif");
selectWindow("scan.tif");
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 show=Masks exclude");
selectWindow("Mask3.tif");
imageCalculator("Subtract", "Mask3.tif","Mask of scan.tif");
//run("Image Calculator...", "image1=Mask3.tif operation=Subtract image2=Mask of scan.tif");
run("Save", "save=[C:\\Documents and Settings\\Desktop\\Mask3.tif]");
imageCalculator("Add", "Mask2.tif","Mask3.tif");
//run("Image Calculator...", "image1=Mask2.tif operation=Add image2=Mask3.tif");
run("Save", "save=[C:\\Documents and Settings\\Desktop\\Mask2.tif]");
imageCalculator("Add", "Mask2.tif","Print_frame.tif");
//run("Image Calculator...", "image1=Mask2.tif operation=Add image2=Print_frame.tif");
run("Save", "save=[C:\\Documents and Settings\\Desktop\\Mask2.tif]");
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00 show=Masks display exclude summarize");