using circularity exclusion on a stack

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

using circularity exclusion on a stack

Andrew Kligerman
Awhile back someone (I think it was Wayne) helped me include a small
macro to eliminate particles with too little circularity from images in
which I was counting particles.  I found I could not use this for a
stack, only individual images.  I got around this problem somewhat, by
changing the stack to a montage and then performing the erasure of non
circular particles and then particle analysis.  Just wondering why this
would not work on a stack and if I could get it to work.  Thanks for any
help.  By the way I know no computer language so I just cut and past to
write macros.

Andy

This is the original macro and then the one that does not work:

ORIGINAL

requires("1.29n");
minCircularity = getNumber("Minimum Circularity:", 0.92);
run("Blobs (25K)");
setThreshold(125, 248);
run("Set Measurements...", "area perimeter circularity decimal=3");
run("Analyze Particles...", "minimum=1 maximum=999999 bins=20
show=Nothing clear record");
for (i=0; i<nResults; i++) {
     x = getResult('XStart', i);
     y = getResult('YStart', i);
     circularity = getResult('Circ.', i);
     if (circularity<minCircularity) {
         doWand(x,y);
         run("Clear");
     }
}
run("Select None");
run("Analyze Particles...", "minimum=1 maximum=999999 bins=20
show=Nothing display clear");


THIS IS SOMETHING THAT WORKS WITHOUT A STACK BY CHANGING IT TO A MONTAGE


run("Image Sequence...", "open=C:\\DeangeloNCM480\\test\\Image1.tif
number=9 starting=1 increment=1 scale=100 file=Image");
run("RGB Split");
run("Close");
run("Close");
run("Median...", "radius=3 stack");
for (slice=1; slice<=nSlices; slice++) {run("Set Slice...",
"slice="+slice);
       run("Enhance Contrast", "saturated=0.4 normalize  ");
       run("Threshold", "slice");
   }
run("Options...", "iterations=1 ");
run("Fill Holes", "stack");
run("Erode", "stack");
run("Fill Holes", "stack");
run("Watershed", "stack");
run("Options...", "iterations=3 ");
run("Make Montage...", "columns=3 rows=3 scale=1 first=1 last=9
increment=1 border=0");
run("Set Measurements...", "area perimeter circularity decimal=3");
run("Analyze Particles...", "minimum 1 maximum=999999 bins=20
show=Nothing clear record");
minCircularity = getNumber("Minimum Circularity:",  0.80);
for (i=0; i<nResults; i++) {
     x = getResult('XStart', i);
     y = getResult('YStart', i);
     circularity = getResult('Circ.', i);
     if (circularity<minCircularity) {
         doWand(x,y);
         run("Clear");
     }
}
run("Select None");
run("Analyze Particles...", "minimum=300 maximum=1100 bins=100
show=Nothing display clear");
Reply | Threaded
Open this post in threaded view
|

Re: using circularity exclusion on a stack

Wayne Rasband
> Awhile back someone (I think it was Wayne) helped me include
> a small macro to eliminate particles with too little
> circularity from images in which I was counting particles. 
> I found I could not use this for a stack, only individual
> images.  I got around this problem somewhat, by changing the
> stack to a montage and then performing the erasure of non
> circular particles and then particle analysis.  Just
> wondering why this would not work on a stack and if I could
> get it to work.  Thanks for any help.  By the way I know no
> computer language so I just cut and past to write macros.

ImageJ 1.35e, due next week, adds a "Required Circularity" field to the
Analyze Particle dialog so the following macro code

   minCircularity = getNumber("Minimum Circularity:", 0.92);
   run("Analyze Particles...", "minimum=1 maximum=999999 show=Nothing
clear record");
   for (i=0; i<nResults; i++) {
       x = getResult('XStart', i);
       y = getResult('YStart', i);
       circularity = getResult('Circ.', i);
       if (circularity<minCircularity) {
           doWand(x,y);
           run("Clear");
       }
   }
   run("Select None");
   run("Analyze Particles...", "minimum=1 maximum=999999 show=Nothing
display clear");

can be replaced with

   minCircularity = getNumber("Minimum Circularity:", 0.92);
   run("Analyze Particles...", "minimum=1 maximum=999999 required="
      + minCircularity+" show=Nothing display clear");

-wayne



>
>
> Andy
>
> This is the original macro and then the one that does not work:
>
> ORIGINAL
>
> requires("1.29n");
> minCircularity = getNumber("Minimum Circularity:", 0.92);
> run("Blobs (25K)");
> setThreshold(125, 248);
> run("Set Measurements...", "area perimeter circularity decimal=3");
> run("Analyze Particles...", "minimum=1 maximum=999999 bins=20
> show=Nothing clear record");
> for (i=0; i<nResults; i++) {
>      x = getResult('XStart', i);
>      y = getResult('YStart', i);
>      circularity = getResult('Circ.', i);
>      if (circularity<minCircularity) {
>          doWand(x,y);
>          run("Clear");
>      }
> }
> run("Select None");
> run("Analyze Particles...", "minimum=1 maximum=999999 bins=20
> show=Nothing display clear");
>
>
> THIS IS SOMETHING THAT WORKS WITHOUT A STACK BY CHANGING IT TO A
> MONTAGE
>
>
> run("Image Sequence...", "open=C:\\DeangeloNCM480\\test\\Image1.tif
> number=9 starting=1 increment=1 scale=100 file=Image");
> run("RGB Split");
> run("Close");
> run("Close");
> run("Median...", "radius=3 stack");
> for (slice=1; slice<=nSlices; slice++) {run("Set Slice...",
> "slice="+slice);
>        run("Enhance Contrast", "saturated=0.4 normalize  ");
>        run("Threshold", "slice");
>    }
> run("Options...", "iterations=1 ");
> run("Fill Holes", "stack");
> run("Erode", "stack");
> run("Fill Holes", "stack");
> run("Watershed", "stack");
> run("Options...", "iterations=3 ");
> run("Make Montage...", "columns=3 rows=3 scale=1 first=1 last=9
> increment=1 border=0");
> run("Set Measurements...", "area perimeter circularity decimal=3");
> run("Analyze Particles...", "minimum 1 maximum=999999 bins=20
> show=Nothing clear record");
> minCircularity = getNumber("Minimum Circularity:",  0.80);
> for (i=0; i<nResults; i++) {
>      x = getResult('XStart', i);
>      y = getResult('YStart', i);
>      circularity = getResult('Circ.', i);
>      if (circularity<minCircularity) {
>          doWand(x,y);
>          run("Clear");
>      }
> }
> run("Select None");
> run("Analyze Particles...", "minimum=300 maximum=1100 bins=100
> show=Nothing display clear");
Reply | Threaded
Open this post in threaded view
|

Re: using circularity exclusion on a stack

Gabriel Landini
On Friday 07 October 2005 22:12, Wayne Rasband wrote:
> ImageJ 1.35e, due next week, adds a "Required Circularity" field to the
> Analyze Particle dialog
[...]

Wayne, now that you are thinking of adding such a useful extension, I have a
suggestion.
What about adding "Minimum" and "Maximum" circularity instead? This would
allow to retain non-circular particles or particles within a range of
circularities.

Cheers,

Gabriel
Ruy
Reply | Threaded
Open this post in threaded view
|

Calibration

Ruy
In reply to this post by Wayne Rasband
Hi

Two questions:

1) Is there a way (macro, plug-in) to get a calibration bar in all slices of
a given stack?  Analyze-Tools-Calibration bar only works for the current
slice.

2) Any plans to make Image J works with layers as Photoshop does?

Thanks in advance

Ruy Jaeger
 ========================================================================
                   Dr. Ruy G. Jaeger, DDS, MSD, PhD

 University of Sao Paulo            Institute of Biomedical Sciences
             Department of Cell and Developmental Biology
 Av. Prof. Lineu Prestes 1524 sala 405            Sao Paulo SP 05508-900
 Phone    55-11- 3091 8034                         FAX    55-11- 3091 7402
                                BRAZIL
          website: http://www.icb.usp.br/~rgjaeger/index.html
 ========================================================================
Reply | Threaded
Open this post in threaded view
|

Re: Calibration

Albert Cardona
Ruy,

I have a plugin that uses Layers over a clear canvas as in photoshop.
Each can be either an image or a path (a bezier curve at the moment),
with transparencies, and flat images can be exported. Further there can
be as many canvas in the Z axis as desired, each containing layers and
paths. It even has a nifty Photosho-like window with a list of layer
snapshots. If there's enough interest I can clear it out of all the
database and modelling stuff that is has and release it as a separate
plugin. There is no format I can think of now that would enable the
saving of such a layer set other than a flat image; that will have to
be for others to figure out.

Albert
Reply | Threaded
Open this post in threaded view
|

Re: Calibration

Volker Baecker
I would be interested, too.
Since the question about layers comes up regulary in the list I think
there must many people interested in this.
Volker

--
passerelle antivirus du campus CNRS de Montpellier
--
Reply | Threaded
Open this post in threaded view
|

Re: Calibration

Robert Dougherty
In reply to this post by Albert Cardona
Albert,

There is also a Layers plugin on my site:
http://www.optinav.com/ImageJplugins/list.htm.  The user interface is not
fancy at all, but you can save the layers because it uses image stacks.  It
sounds like some merging should take place.

Bob


Robert P. Dougherty, Ph.D.
President, OptiNav, Inc.
Phone (425) 467-1118
Fax (425) 467-1119
www.optinav.com
 

> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
> Albert Cardona
> Sent: Tuesday, October 11, 2005 8:27 AM
> To: [hidden email]
> Subject: Re: Calibration
>
> Ruy,
>
> I have a plugin that uses Layers over a clear canvas as in photoshop.
> Each can be either an image or a path (a bezier curve at the moment),
> with transparencies, and flat images can be exported. Further there can
> be as many canvas in the Z axis as desired, each containing layers and
> paths. It even has a nifty Photosho-like window with a list of layer
> snapshots. If there's enough interest I can clear it out of all the
> database and modelling stuff that is has and release it as a separate
> plugin. There is no format I can think of now that would enable the
> saving of such a layer set other than a flat image; that will have to
> be for others to figure out.
>
> Albert
Ruy
Reply | Threaded
Open this post in threaded view
|

Re: Calibration

Ruy
Thanks for the input.  I believe a layers plug-in would be of great interest
for Image J

Regards

Ruy


On 11/10/05 1:59 PM, "Robert Dougherty" <[hidden email]> wrote:

> Albert,
>
> There is also a Layers plugin on my site:
> http://www.optinav.com/ImageJplugins/list.htm.  The user interface is not
> fancy at all, but you can save the layers because it uses image stacks.  It
> sounds like some merging should take place.
>
> Bob
>
>
> Robert P. Dougherty, Ph.D.
> President, OptiNav, Inc.
> Phone (425) 467-1118
> Fax (425) 467-1119
> www.optinav.com
>
>
>> -----Original Message-----
>> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
>> Albert Cardona
>> Sent: Tuesday, October 11, 2005 8:27 AM
>> To: [hidden email]
>> Subject: Re: Calibration
>>
>> Ruy,
>>
>> I have a plugin that uses Layers over a clear canvas as in photoshop.
>> Each can be either an image or a path (a bezier curve at the moment),
>> with transparencies, and flat images can be exported. Further there can
>> be as many canvas in the Z axis as desired, each containing layers and
>> paths. It even has a nifty Photosho-like window with a list of layer
>> snapshots. If there's enough interest I can clear it out of all the
>> database and modelling stuff that is has and release it as a separate
>> plugin. There is no format I can think of now that would enable the
>> saving of such a layer set other than a flat image; that will have to
>> be for others to figure out.
>>
>> Albert
>

 ========================================================================
                   Dr. Ruy G. Jaeger, DDS, MSD, PhD

 University of Sao Paulo            Institute of Biomedical Sciences
             Department of Cell and Developmental Biology
 Av. Prof. Lineu Prestes 1524 sala 405            Sao Paulo SP 05508-900
 Phone    55-11- 3091 8034                         FAX    55-11- 3091 7402
                                BRAZIL
          website: http://www.icb.usp.br/~rgjaeger/index.html
 ========================================================================
Reply | Threaded
Open this post in threaded view
|

Re: Calibration

Joachim Walter
Another way to get "Layers" is to use the Image5D plugin, which is
available on the ImageJ website. Just use the color channels of an
Image5D like layers and display the Image5D in "Overlay" mode to see all
layers together. All layers (channels) are grayscale, but you can choose
a lookup table for each layer separately. Overlaying is done by just
adding up all channels. So it is not as fancy as Photoshop, but it works.
You can copy the image displayed in overlay mode to an RGB image via the
ImageJ clipboard (Ctrl-C; Ctrl-V).
Saving of Image5Ds is due in the next version soon to come...

Joachim


Ruy schrieb:
> Thanks for the input.  I believe a layers plug-in would be of great interest
> for Image J
>
> Regards
>
> Ruy
>
>

--
-----------------------------------------------
Dr. Joachim Walter

TILL I.D. GmbH
c\o BioImaging Zentrum
Großhaderner Str. 2
D-82152 Martinsried

Tel.: +49-89-2180-74189
Fax:  +49-89-2180-9974189

[hidden email]