Analyze Particles Overlay problems

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

Analyze Particles Overlay problems

Stein Rørvik
I want to run Analyze Particles on a stack, but only on specific slices.
I want the results (which particles were analyzed or not) to be shown as an overlay.
If I say yes to process all slices, the results are as expected:
There is an individual overlay for each slice.

But if I want to analyze a single slice, the result overlay is "global"; that is, one overlay for the entire stack. So when I process another slice, the previous result overlay is lost. I think the overlay should have been applied to a single slice position in this case as well.

Am I missing an option somewhere? Or is this a bug?

Also, I cannot figure out where in the preferences/options to set the result overlay colors (outline color and label color), nor how to do this in a macro.

Demo macro, illustrating what I want to do:
------------------------------

//analyze entire stack
run("T1 Head (2.4M, 16-bits)");
setThreshold(350, 65535);
run("Analyze Particles...", "size=10-Infinity pixel show=Overlay stack");
setSlice(nSlices/2);
//results are as expected; an individual overlay for each slice

//analyze slice 30 and 60
run("T1 Head (2.4M, 16-bits)");
setThreshold(350, 65535);
setSlice(30);
run("Analyze Particles...", "size=10-Infinity pixel show=Overlay slice");
setSlice(60);
run("Analyze Particles...", "size=10-Infinity pixel show=Overlay slice");

setSlice(30);
//problem: overlay is per stack, not per slice, so the result overlay for slice 30 was lost

run("Tile");

------------------------------

I am using daily build ImageJ 1.52j with Java 1.6 on Windows 7/64-bit.


Stein


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Analyze Particles Overlay problems

Krs5
Dear Stein,

You can use the ROI Manger for this:

//analyze slice 30 and 60
roiManager("Associate", "true");

run("T1 Head (2.4M, 16-bits)");
setThreshold(350, 65535);
setSlice(30);
run("Analyze Particles...", "size=10-Infinity pixel add slice");
setSlice(60);
run("Analyze Particles...", "size=10-Infinity pixel add slice");

setSlice(30);

Best wishes

Kees


Dr Ir K.R. Straatman
Senior Experimental Officer
Advanced Imaging Facility
Centre for Core Biotechnology Services
University of Leicester
www.le.ac.uk/advanced-imaging-facility



-----Original Message-----
From: Stein Rørvik <[hidden email]>
Sent: 12 December 2018 10:12
To: [hidden email]
Subject: Analyze Particles Overlay problems

I want to run Analyze Particles on a stack, but only on specific slices.
I want the results (which particles were analyzed or not) to be shown as an overlay.
If I say yes to process all slices, the results are as expected:
There is an individual overlay for each slice.

But if I want to analyze a single slice, the result overlay is "global"; that is, one overlay for the entire stack. So when I process another slice, the previous result overlay is lost. I think the overlay should have been applied to a single slice position in this case as well.

Am I missing an option somewhere? Or is this a bug?

Also, I cannot figure out where in the preferences/options to set the result overlay colors (outline color and label color), nor how to do this in a macro.

Demo macro, illustrating what I want to do:
------------------------------

//analyze entire stack
run("T1 Head (2.4M, 16-bits)");
setThreshold(350, 65535);
run("Analyze Particles...", "size=10-Infinity pixel show=Overlay stack"); setSlice(nSlices/2); //results are as expected; an individual overlay for each slice

//analyze slice 30 and 60
run("T1 Head (2.4M, 16-bits)");
setThreshold(350, 65535);
setSlice(30);
run("Analyze Particles...", "size=10-Infinity pixel show=Overlay slice"); setSlice(60); run("Analyze Particles...", "size=10-Infinity pixel show=Overlay slice");

setSlice(30);
//problem: overlay is per stack, not per slice, so the result overlay for slice 30 was lost

run("Tile");

------------------------------

I am using daily build ImageJ 1.52j with Java 1.6 on Windows 7/64-bit.


Stein


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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Analyze Particles Overlay problems

Wayne Rasband-2
In reply to this post by Stein Rørvik
> On Dec 12, 2018, at 5:12 AM, Stein Rørvik <[hidden email]> wrote:
>
> I want to run Analyze Particles on a stack, but only on specific slices.
> I want the results (which particles were analyzed or not) to be shown as an overlay.
> If I say yes to process all slices, the results are as expected:
> There is an individual overlay for each slice.
>
> But if I want to analyze a single slice, the result overlay is "global"; that is, one overlay for the entire stack. So when I process another slice, the previous result overlay is lost. I think the overlay should have been applied to a single slice position in this case as well.
>
> Am I missing an option somewhere? Or is this a bug?

It’s a bug that is fixed in the daily build (1.52j26). The following example runs the particle analyzer on two slices of a stack and set the overlay color to red.

-wayne

  run("T1 Head (2.4M, 16-bits)");
  setThreshold(150, 65535);
  setSlice(60);
  run("Analyze Particles...", "size=400 show=Overlay slice");
  setThreshold(250, 65535);
  setSlice(62);
  run("Analyze Particles...", "size=400 show=Overlay slice");
  resetThreshold;
  for (i=0; i<Overlay.size; i++) {
     Overlay.activateSelection(i);
     Roi.setStrokeColor("red");
     Roi.setStrokeWidth(1);
  }
  Roi.remove;
  Overlay.setFontSize(18);
  run("In [+]"); run("In [+]”);


> Also, I cannot figure out where in the preferences/options to set the result overlay colors (outline color and label color), nor how to do this in a macro.
>
> Demo macro, illustrating what I want to do:
> ------------------------------
>
> //analyze entire stack
> run("T1 Head (2.4M, 16-bits)");
> setThreshold(350, 65535);
> run("Analyze Particles...", "size=10-Infinity pixel show=Overlay stack");
> setSlice(nSlices/2);
> //results are as expected; an individual overlay for each slice
>
> //analyze slice 30 and 60
> run("T1 Head (2.4M, 16-bits)");
> setThreshold(350, 65535);
> setSlice(30);
> run("Analyze Particles...", "size=10-Infinity pixel show=Overlay slice");
> setSlice(60);
> run("Analyze Particles...", "size=10-Infinity pixel show=Overlay slice");
>
> setSlice(30);
> //problem: overlay is per stack, not per slice, so the result overlay for slice 30 was lost
>
> run("Tile");
>
> ------------------------------
>
> I am using daily build ImageJ 1.52j with Java 1.6 on Windows 7/64-bit.
>
>
> Stein
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Analyze Particles Overlay problems

Stein Rørvik
Thanks, this works great!

Overlay.setFontSize is not mentioned in the macro documentation.

How can I change the label color as well?
A corresponding Overlay.setFontColor function could be useful.

Stein

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Wayne Rasband
Sent: 13. desember 2018 03:39
To: [hidden email]
Subject: Re: Analyze Particles Overlay problems

> On Dec 12, 2018, at 5:12 AM, Stein Rørvik <[hidden email]> wrote:
>
> I want to run Analyze Particles on a stack, but only on specific slices.
> I want the results (which particles were analyzed or not) to be shown as an overlay.
> If I say yes to process all slices, the results are as expected:
> There is an individual overlay for each slice.
>
> But if I want to analyze a single slice, the result overlay is "global"; that is, one overlay for the entire stack. So when I process another slice, the previous result overlay is lost. I think the overlay should have been applied to a single slice position in this case as well.
>
> Am I missing an option somewhere? Or is this a bug?

It’s a bug that is fixed in the daily build (1.52j26). The following example runs the particle analyzer on two slices of a stack and set the overlay color to red.

-wayne

  run("T1 Head (2.4M, 16-bits)");
  setThreshold(150, 65535);
  setSlice(60);
  run("Analyze Particles...", "size=400 show=Overlay slice");
  setThreshold(250, 65535);
  setSlice(62);
  run("Analyze Particles...", "size=400 show=Overlay slice");
  resetThreshold;
  for (i=0; i<Overlay.size; i++) {
     Overlay.activateSelection(i);
     Roi.setStrokeColor("red");
     Roi.setStrokeWidth(1);
  }
  Roi.remove;
  Overlay.setFontSize(18);
  run("In [+]"); run("In [+]”);


> Also, I cannot figure out where in the preferences/options to set the result overlay colors (outline color and label color), nor how to do this in a macro.
>
> Demo macro, illustrating what I want to do:
> ------------------------------
>
> //analyze entire stack
> run("T1 Head (2.4M, 16-bits)");
> setThreshold(350, 65535);
> run("Analyze Particles...", "size=10-Infinity pixel show=Overlay
> stack"); setSlice(nSlices/2); //results are as expected; an individual
> overlay for each slice
>
> //analyze slice 30 and 60
> run("T1 Head (2.4M, 16-bits)");
> setThreshold(350, 65535);
> setSlice(30);
> run("Analyze Particles...", "size=10-Infinity pixel show=Overlay
> slice"); setSlice(60); run("Analyze Particles...", "size=10-Infinity
> pixel show=Overlay slice");
>
> setSlice(30);
> //problem: overlay is per stack, not per slice, so the result overlay
> for slice 30 was lost
>
> run("Tile");
>
> ------------------------------
>
> I am using daily build ImageJ 1.52j with Java 1.6 on Windows 7/64-bit.
>
>
> Stein
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Analyze Particles Overlay problems

Wayne Rasband-2
> On Dec 13, 2018, at 5:01 AM, Stein Rørvik <[hidden email]> wrote:
>
> Thanks, this works great!
>
> Overlay.setFontSize is not mentioned in the macro documentation.
>
> How can I change the label color as well?
> A corresponding Overlay.setFontColor function could be useful.

The latest daily build adds an Overlay.setLabelColor() function. There are two versions, one that sets the label color and another that sets both the label and background color. This function, and other new functions, are in the macro documentation at

   http://wsr.imagej.net/developer/macro/functions.html

Here is an updated version of the example macro:

  run("T1 Head (2.4M, 16-bits)");
  setThreshold(150, 65535);
  setSlice(60);
  run("Analyze Particles...", "size=400 show=Overlay slice");
  setThreshold(250, 65535);
  setSlice(62);
  run("Analyze Particles...", "size=400 show=Overlay slice");
  resetThreshold;
  Roi.remove;
  Overlay.setStrokeColor("red");
  Overlay.setStrokeWidth(1);
  Overlay.setLabelFontSize(12, "bold scale");
  Overlay.setLabelColor("cyan","black");
  run("In [+]"); run("In [+]”);

-wayne

> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Wayne Rasband
> Sent: 13. desember 2018 03:39
> To: [hidden email]
> Subject: Re: Analyze Particles Overlay problems
>
>> On Dec 12, 2018, at 5:12 AM, Stein Rørvik <[hidden email]> wrote:
>>
>> I want to run Analyze Particles on a stack, but only on specific slices.
>> I want the results (which particles were analyzed or not) to be shown as an overlay.
>> If I say yes to process all slices, the results are as expected:
>> There is an individual overlay for each slice.
>>
>> But if I want to analyze a single slice, the result overlay is "global"; that is, one overlay for the entire stack. So when I process another slice, the previous result overlay is lost. I think the overlay should have been applied to a single slice position in this case as well.
>>
>> Am I missing an option somewhere? Or is this a bug?
>
> It’s a bug that is fixed in the daily build (1.52j26). The following example runs the particle analyzer on two slices of a stack and set the overlay color to red.
>
> -wayne
>
>  run("T1 Head (2.4M, 16-bits)");
>  setThreshold(150, 65535);
>  setSlice(60);
>  run("Analyze Particles...", "size=400 show=Overlay slice");
>  setThreshold(250, 65535);
>  setSlice(62);
>  run("Analyze Particles...", "size=400 show=Overlay slice");
>  resetThreshold;
>  for (i=0; i<Overlay.size; i++) {
>     Overlay.activateSelection(i);
>     Roi.setStrokeColor("red");
>     Roi.setStrokeWidth(1);
>  }
>  Roi.remove;
>  Overlay.setFontSize(18);
>  run("In [+]"); run("In [+]”);
>
>
>> Also, I cannot figure out where in the preferences/options to set the result overlay colors (outline color and label color), nor how to do this in a macro.
>>
>> Demo macro, illustrating what I want to do:
>> ------------------------------
>>
>> //analyze entire stack
>> run("T1 Head (2.4M, 16-bits)");
>> setThreshold(350, 65535);
>> run("Analyze Particles...", "size=10-Infinity pixel show=Overlay
>> stack"); setSlice(nSlices/2); //results are as expected; an individual
>> overlay for each slice
>>
>> //analyze slice 30 and 60
>> run("T1 Head (2.4M, 16-bits)");
>> setThreshold(350, 65535);
>> setSlice(30);
>> run("Analyze Particles...", "size=10-Infinity pixel show=Overlay
>> slice"); setSlice(60); run("Analyze Particles...", "size=10-Infinity
>> pixel show=Overlay slice");
>>
>> setSlice(30);
>> //problem: overlay is per stack, not per slice, so the result overlay
>> for slice 30 was lost
>>
>> run("Tile");
>>
>> ------------------------------
>>
>> I am using daily build ImageJ 1.52j with Java 1.6 on Windows 7/64-bit.
>>
>>
>> Stein

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Analyze Particles Overlay problems

Krs5
I am not sure this problem is related to recent changes with overlays but when I add the overlays to the ROI manager with 'Associate "Show All" ROIs with slices' selected and change the 'Stroke color' under ROI Manager > properties... all ROIs are shown on the first slice and the association with slice number is lost. This is only happening when done manually. When run in a macro all seems fine.

Best wishes

Kees


-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Wayne Rasband
Sent: 14 December 2018 07:25
To: [hidden email]
Subject: Re: Analyze Particles Overlay problems

> On Dec 13, 2018, at 5:01 AM, Stein Rørvik <[hidden email]> wrote:
>
> Thanks, this works great!
>
> Overlay.setFontSize is not mentioned in the macro documentation.
>
> How can I change the label color as well?
> A corresponding Overlay.setFontColor function could be useful.

The latest daily build adds an Overlay.setLabelColor() function. There are two versions, one that sets the label color and another that sets both the label and background color. This function, and other new functions, are in the macro documentation at

   http://wsr.imagej.net/developer/macro/functions.html

Here is an updated version of the example macro:

  run("T1 Head (2.4M, 16-bits)");
  setThreshold(150, 65535);
  setSlice(60);
  run("Analyze Particles...", "size=400 show=Overlay slice");
  setThreshold(250, 65535);
  setSlice(62);
  run("Analyze Particles...", "size=400 show=Overlay slice");
  resetThreshold;
  Roi.remove;
  Overlay.setStrokeColor("red");
  Overlay.setStrokeWidth(1);
  Overlay.setLabelFontSize(12, "bold scale");
  Overlay.setLabelColor("cyan","black");
  run("In [+]"); run("In [+]”);

-wayne

> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Wayne
> Rasband
> Sent: 13. desember 2018 03:39
> To: [hidden email]
> Subject: Re: Analyze Particles Overlay problems
>
>> On Dec 12, 2018, at 5:12 AM, Stein Rørvik <[hidden email]> wrote:
>>
>> I want to run Analyze Particles on a stack, but only on specific slices.
>> I want the results (which particles were analyzed or not) to be shown as an overlay.
>> If I say yes to process all slices, the results are as expected:
>> There is an individual overlay for each slice.
>>
>> But if I want to analyze a single slice, the result overlay is "global"; that is, one overlay for the entire stack. So when I process another slice, the previous result overlay is lost. I think the overlay should have been applied to a single slice position in this case as well.
>>
>> Am I missing an option somewhere? Or is this a bug?
>
> It’s a bug that is fixed in the daily build (1.52j26). The following example runs the particle analyzer on two slices of a stack and set the overlay color to red.
>
> -wayne
>
>  run("T1 Head (2.4M, 16-bits)");
>  setThreshold(150, 65535);
>  setSlice(60);
>  run("Analyze Particles...", "size=400 show=Overlay slice");  
> setThreshold(250, 65535);  setSlice(62);  run("Analyze Particles...",
> "size=400 show=Overlay slice");  resetThreshold;  for (i=0;
> i<Overlay.size; i++) {
>     Overlay.activateSelection(i);
>     Roi.setStrokeColor("red");
>     Roi.setStrokeWidth(1);
>  }
>  Roi.remove;
>  Overlay.setFontSize(18);
>  run("In [+]"); run("In [+]”);
>
>
>> Also, I cannot figure out where in the preferences/options to set the result overlay colors (outline color and label color), nor how to do this in a macro.
>>
>> Demo macro, illustrating what I want to do:
>> ------------------------------
>>
>> //analyze entire stack
>> run("T1 Head (2.4M, 16-bits)");
>> setThreshold(350, 65535);
>> run("Analyze Particles...", "size=10-Infinity pixel show=Overlay
>> stack"); setSlice(nSlices/2); //results are as expected; an
>> individual overlay for each slice
>>
>> //analyze slice 30 and 60
>> run("T1 Head (2.4M, 16-bits)");
>> setThreshold(350, 65535);
>> setSlice(30);
>> run("Analyze Particles...", "size=10-Infinity pixel show=Overlay
>> slice"); setSlice(60); run("Analyze Particles...", "size=10-Infinity
>> pixel show=Overlay slice");
>>
>> setSlice(30);
>> //problem: overlay is per stack, not per slice, so the result overlay
>> for slice 30 was lost
>>
>> run("Tile");
>>
>> ------------------------------
>>
>> I am using daily build ImageJ 1.52j with Java 1.6 on Windows 7/64-bit.
>>
>>
>> Stein

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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Analyze Particles Overlay problems

Wayne Rasband-2
> On Dec 14, 2018, at 3:39 AM, Straatman, Kees (Dr.) <[hidden email]> wrote:
>
> I am not sure this problem is related to recent changes with overlays but when I add the overlays to the ROI manager with 'Associate "Show All" ROIs with slices' selected and change the 'Stroke color' under ROI Manager > properties... all ROIs are shown on the first slice and the association with slice number is lost. This is only happening when done manually. When run in a macro all seems fine.

The latest daily build (1.52j32) fixes a bug that caused slice positions to be lost after using the ROI Manager’s “Properties” button to change the stroke color, stroke width or fill color of a range of ROIs.

-wayne

> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Wayne Rasband
> Sent: 14 December 2018 07:25
> To: [hidden email]
> Subject: Re: Analyze Particles Overlay problems
>
>> On Dec 13, 2018, at 5:01 AM, Stein Rørvik <[hidden email]> wrote:
>>
>> Thanks, this works great!
>>
>> Overlay.setFontSize is not mentioned in the macro documentation.
>>
>> How can I change the label color as well?
>> A corresponding Overlay.setFontColor function could be useful.
>
> The latest daily build adds an Overlay.setLabelColor() function. There are two versions, one that sets the label color and another that sets both the label and background color. This function, and other new functions, are in the macro documentation at
>
>   http://wsr.imagej.net/developer/macro/functions.html
>
> Here is an updated version of the example macro:
>
>  run("T1 Head (2.4M, 16-bits)");
>  setThreshold(150, 65535);
>  setSlice(60);
>  run("Analyze Particles...", "size=400 show=Overlay slice");
>  setThreshold(250, 65535);
>  setSlice(62);
>  run("Analyze Particles...", "size=400 show=Overlay slice");
>  resetThreshold;
>  Roi.remove;
>  Overlay.setStrokeColor("red");
>  Overlay.setStrokeWidth(1);
>  Overlay.setLabelFontSize(12, "bold scale");
>  Overlay.setLabelColor("cyan","black");
>  run("In [+]"); run("In [+]”);
>
> -wayne
>
>> -----Original Message-----
>> From: ImageJ Interest Group <[hidden email]> On Behalf Of Wayne
>> Rasband
>> Sent: 13. desember 2018 03:39
>> To: [hidden email]
>> Subject: Re: Analyze Particles Overlay problems
>>
>>> On Dec 12, 2018, at 5:12 AM, Stein Rørvik <[hidden email]> wrote:
>>>
>>> I want to run Analyze Particles on a stack, but only on specific slices.
>>> I want the results (which particles were analyzed or not) to be shown as an overlay.
>>> If I say yes to process all slices, the results are as expected:
>>> There is an individual overlay for each slice.
>>>
>>> But if I want to analyze a single slice, the result overlay is "global"; that is, one overlay for the entire stack. So when I process another slice, the previous result overlay is lost. I think the overlay should have been applied to a single slice position in this case as well.
>>>
>>> Am I missing an option somewhere? Or is this a bug?
>>
>> It’s a bug that is fixed in the daily build (1.52j26). The following example runs the particle analyzer on two slices of a stack and set the overlay color to red.
>>
>> -wayne
>>
>> run("T1 Head (2.4M, 16-bits)");
>> setThreshold(150, 65535);
>> setSlice(60);
>> run("Analyze Particles...", "size=400 show=Overlay slice");  
>> setThreshold(250, 65535);  setSlice(62);  run("Analyze Particles...",
>> "size=400 show=Overlay slice");  resetThreshold;  for (i=0;
>> i<Overlay.size; i++) {
>>    Overlay.activateSelection(i);
>>    Roi.setStrokeColor("red");
>>    Roi.setStrokeWidth(1);
>> }
>> Roi.remove;
>> Overlay.setFontSize(18);
>> run("In [+]"); run("In [+]”);
>>
>>
>>> Also, I cannot figure out where in the preferences/options to set the result overlay colors (outline color and label color), nor how to do this in a macro.
>>>
>>> Demo macro, illustrating what I want to do:
>>> ------------------------------
>>>
>>> //analyze entire stack
>>> run("T1 Head (2.4M, 16-bits)");
>>> setThreshold(350, 65535);
>>> run("Analyze Particles...", "size=10-Infinity pixel show=Overlay
>>> stack"); setSlice(nSlices/2); //results are as expected; an
>>> individual overlay for each slice
>>>
>>> //analyze slice 30 and 60
>>> run("T1 Head (2.4M, 16-bits)");
>>> setThreshold(350, 65535);
>>> setSlice(30);
>>> run("Analyze Particles...", "size=10-Infinity pixel show=Overlay
>>> slice"); setSlice(60); run("Analyze Particles...", "size=10-Infinity
>>> pixel show=Overlay slice");
>>>
>>> setSlice(30);
>>> //problem: overlay is per stack, not per slice, so the result overlay
>>> for slice 30 was lost
>>>
>>> run("Tile");
>>>
>>> ------------------------------
>>>
>>> I am using daily build ImageJ 1.52j with Java 1.6 on Windows 7/64-bit.
>>>
>>>
>>> Stein

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