Standard Deviations Histogram/Color Profiler

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Standard Deviations Histogram/Color Profiler

Lee Berndt
Hello....I use ImageJ to analyze RGB color images....when I run Analyze/Histogram I get a window with data including count, mean and standard deviation etc. for R, G, B channels....if I run Analyze/Tools/Color Profiler I also get data for R, G, B channels including mean and standard deviation but the standard deviations as reported as dis-similar....for example using Histogram I get (R) mean of 91.714 with SD = 57.168.....using Color Profiler I get (R) mean 91.71 with SD = 9.03....can someone tell me how these standard deviations are being calculated?  Thank you in advance....

William L. Berndt, Ph.D.  7133 Penner Lane. Apt. #40Fort Myers, FL 33907@Dr_Lee_Berndt239.246.0396     

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

Re: Standard Deviations Histogram/Color Profiler

Gabriel Landini
Hi William,
That is because the color profiler and the histogram are not computing the
same feature.
Please read here to understand what is a profile:
https://imagej.nih.gov/ij/docs/guide/146-30.html#toc-Subsection-30.11 
The SD of a profile over the whole image is not the same as the SD of the
image.

Cheers

Gabriel

On Monday, 18 May 2020 15:28:24 BST you wrote:

> Hello....I use ImageJ to analyze RGB color images....when I run
> Analyze/Histogram I get a window with data including count, mean and
> standard deviation etc. for R, G, B channels....if I run
> Analyze/Tools/Color Profiler I also get data for R, G, B channels including
> mean and standard deviation but the standard deviations as reported as
> dis-similar....for example using Histogram I get (R) mean of 91.714 with SD
> = 57.168.....using Color Profiler I get (R) mean 91.71 with SD =
> 9.03....can someone tell me how these standard deviations are being
> calculated?  Thank you in advance....
>
> William L. Berndt, Ph.D.  7133 Penner Lane. Apt. #40Fort Myers, FL
> 33907@Dr_Lee_Berndt239.246.0396    
>
> --
> 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: Standard Deviations Histogram/Color Profiler

Lee Berndt
Hello and thank you for responding Gabriel …. I understand what you said and it has been helpful …. is there any way you could point me to the code used to calculate these standard deviations so that I might better understand how they are calculated?  
Also, another question if I might …. to describe differences between two images I have computed delta E, delta L, delta H, etc. and understand distance metrics …. but is there a way to use a t-test or anova (F test) or another statistical procedure so as to generate a probability (p-value) of significant difference between colors of two RGB images?  would it legitimate to, for example, to run a factorial anova for 2 or more images using image and RGB channel as the factors?  how are image specialists determining significant differences?
any help would be greatly appreciated ….
Thank you and have a blessed day!
William L. Berndt, Ph.D.  7133 Penner Lane. Apt. #40Fort Myers, FL 33907
@Dr_Lee_Berndt
239.246.0396     

-----Original Message-----
From: Gabriel Landini <[hidden email]>
To: [hidden email]
Sent: Mon, May 18, 2020 10:43 am
Subject: Re: Standard Deviations Histogram/Color Profiler

Hi William,
That is because the color profiler and the histogram are not computing the
same feature.
Please read here to understand what is a profile:
https://imagej.nih.gov/ij/docs/guide/146-30.html#toc-Subsection-30.11 
The SD of a profile over the whole image is not the same as the SD of the
image.

Cheers

Gabriel

On Monday, 18 May 2020 15:28:24 BST you wrote:

> Hello....I use ImageJ to analyze RGB color images....when I run
> Analyze/Histogram I get a window with data including count, mean and
> standard deviation etc. for R, G, B channels....if I run
> Analyze/Tools/Color Profiler I also get data for R, G, B channels including
> mean and standard deviation but the standard deviations as reported as
> dis-similar....for example using Histogram I get (R) mean of 91.714 with SD
> = 57.168.....using Color Profiler I get (R) mean 91.71 with SD =
> 9.03....can someone tell me how these standard deviations are being
> calculated?  Thank you in advance....
>
> William L. Berndt, Ph.D.  7133 Penner Lane. Apt. #40Fort Myers, FL
> 33907@Dr_Lee_Berndt239.246.0396   
>
> --
> 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: Standard Deviations Histogram/Color Profiler

Gabriel Landini
On Tuesday, 19 May 2020 11:50:48 BST [hidden email] wrote:
> is there any way you could point me to the code used
> to calculate these standard deviations so that I might better understand
> how they are calculated?  
If you launch the Command Finder (Ctr+L) then you can call the command you
wish and that will show you the menu path, the class and the file where the
command resides.
You will need to look in those files.
The histogram code is in ij.plugin.Histogram
The color profiler command points to the Color_Profiler.jar, have a look in
the ProfileColorPlot.java file, calculateStatistics method.
You can see there that the sd is that of  the *columns* in the profile
selection, not from the image, which is a different thing than the sd of the
whole image.

I am not sure about your other question.  Hopefully somebody here with more
insight will be able to help.

Cheers

Gabriel

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

Re: Standard Deviations Histogram/Color Profiler

Gabriel Landini
Oops I meant:

> You can see there that the sd is that of  the *columns* in the profile
> selection, not from the image, which is a different thing.

Cheers

Gabriel

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

Make Background Transparent

Lee Berndt
Hello Gabriel …. thank you for helping me …. if I might I have another question …. if I take an RGB image and threshold it to remove certain areas below a certain brightness by selecting those areas and then using EDIT/CLEAR I'm left with a background color in the cleared areas (i.e., white) …. if I run color profiler on the entire image the background color contributes to and confounds the measurements …. is there a way to make the background transparent so that results of the color profiler focus on only the ROI?   Any help would be appreciated …. thank you  

William L. Berndt, Ph.D.  7133 Penner Lane. Apt. #40Fort Myers, FL 33907@Dr_Lee_Berndt239.246.0396     

-----Original Message-----
From: Gabriel Landini <[hidden email]>
To: [hidden email]
Sent: Tue, May 19, 2020 7:38 am
Subject: Re: Standard Deviations Histogram/Color Profiler

Oops I meant:

> You can see there that the sd is that of  the *columns* in the profile
> selection, not from the image, which is a different thing.

Cheers

Gabriel

--
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
|

Consecutive Selections in ROI Manager

Lee Berndt
In reply to this post by Gabriel Landini
Hello Gabriel and List Group …. hypothetically I have five ( 5) selections added to ROI manager …. can someone steer me to code that will select 0, let me analyze it, then select the next one (i.e., 1) and let me analyze that, then select the next one (i.e., 2) and analyze that …. I don't want to select all at once just one at a time ….. any help would be appreciated … thank you 

William L. Berndt, Ph.D.  7133 Penner Lane. Apt. #40Fort Myers, FL 33907@Dr_Lee_Berndt239.246.0396     

-----Original Message-----
From: Gabriel Landini <[hidden email]>
To: [hidden email]
Sent: Tue, May 19, 2020 7:38 am
Subject: Re: Standard Deviations Histogram/Color Profiler

Oops I meant:

> You can see there that the sd is that of  the *columns* in the profile
> selection, not from the image, which is a different thing.

Cheers

Gabriel

--
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: Consecutive Selections in ROI Manager

Herbie
Good day Lee,

does the following example ImageJ-macro code help?

//
Table.reset("Results");
close("ROI Manager");
run("Blobs");
doWand(133, 197, 20.0, "Legacy");
roiManager("Add");
doWand(132, 56, 20.0, "Legacy");
roiManager("Add");
doWand(226, 96, 20.0, "Legacy");
roiManager("Add");
doWand(75, 44, 20.0, "Legacy");
roiManager("Add");
doWand(215, 170, 20.0, "Legacy");
roiManager("Add");
cnt = roiManager( "count" );
for ( i=0; i<cnt; i++ ) {
    roiManager("select", i);
    run("Measure");
}
exit();
//

Paste the above macro code to an empty macro window (Plugins >> New >>
Macro) and run it.
(You need an open internet connection to load the demo image.)

Regards

Herbie

::::::::::::::::::::::::::::::::::::::::
Am 22.05.20 um 15:38 schrieb Lee Berndt:

> Hello Gabriel and List Group …. hypothetically I have five ( 5) selections added to ROI manager …. can someone steer me to code that will select 0, let me analyze it, then select the next one (i.e., 1) and let me analyze that, then select the next one (i.e., 2) and analyze that …. I don't want to select all at once just one at a time ….. any help would be appreciated … thank you
>
> William L. Berndt, Ph.D.  7133 Penner Lane. Apt. #40Fort Myers, FL 33907@Dr_Lee_Berndt239.246.0396
>
> -----Original Message-----
> From: Gabriel Landini <[hidden email]>
> To: [hidden email]
> Sent: Tue, May 19, 2020 7:38 am
> Subject: Re: Standard Deviations Histogram/Color Profiler
>
> Oops I meant:
>
>> You can see there that the sd is that of  the *columns* in the profile
>> selection, not from the image, which is a different thing.
>
> Cheers
>
> Gabriel
>
> --
> 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: Consecutive Selections in ROI Manager

Herbie
Sorry Lee,

my macro selects one RoI after the other in the "for"-loop!

My macro creates 5 sample selections and measures one after the other
and writes the measurement-results to the Results-table one after the other.

Instead of using

run("Measure");

you can of course do what you need, i.e.

run("Color Profiler");

but don't close the image in the loop!

HTH

Herbie

::::::::::::::::::::::::::::::::::::::::
Am 22.05.20 um 16:16 schrieb Lee Berndt:

> Hi thank you for responding …. no I've already tried that and it selects
> all of the ROI's at one time....please see this simple code which does
> what I want ….  there are five ROIs of an image 0,1,2,3,4 that are
> already added to ROi manager
>
> roiManager("Select", 0);
> run("Color Profiler");
> imageTitle=getTitle();
>      selectWindow(imageTitle);
>      run("Close");
> String.copyResults();
> //paste results to Excel
> //go to next ROI
>
> running this code gives me what I need for ROI 0 …. how do I loop this
> to run the same code for ROI 1, then ROI 2 etc ?  In all I'll have about
> 50 or so ROIs to analyze pasting the results into Excel ….. Any thoughts
> would be appreciated ….. thank you
>
> William L. Berndt, Ph.D.
> 7133 Penner Lane. Apt. #40
> Fort Myers, FL 33907
> @Dr_Lee_Berndt
> 239.246.0396
>
>
> -----Original Message-----
> From: Herbie <[hidden email]>
> To: [hidden email]
> Sent: Fri, May 22, 2020 10:06 am
> Subject: Re: Consecutive Selections in ROI Manager
>
> Good day Lee,
>
> does the following example ImageJ-macro code help?
>
> //
> Table.reset("Results");
> close("ROI Manager");
> run("Blobs");
> doWand(133, 197, 20.0, "Legacy");
> roiManager("Add");
> doWand(132, 56, 20.0, "Legacy");
> roiManager("Add");
> doWand(226, 96, 20.0, "Legacy");
> roiManager("Add");
> doWand(75, 44, 20.0, "Legacy");
> roiManager("Add");
> doWand(215, 170, 20.0, "Legacy");
> roiManager("Add");
> cnt = roiManager( "count" );
> for ( i=0; i<cnt; i++ ) {
>      roiManager("select", i);
>      run("Measure");
> }
> exit();
> //
>
> Paste the above macro code to an empty macro window (Plugins >> New >>
> Macro) and run it.
> (You need an open internet connection to load the demo image.)
>
> Regards
>
> Herbie
>
> ::::::::::::::::::::::::::::::::::::::::
> Am 22.05.20 um 15:38 schrieb Lee Berndt:
>  > Hello Gabriel and List Group …. hypothetically I have five ( 5)
> selections added to ROI manager …. can someone steer me to code that
> will select 0, let me analyze it, then select the next one (i.e., 1) and
> let me analyze that, then select the next one (i.e., 2) and analyze that
> …. I don't want to select all at once just one at a time ….. any help
> would be appreciated … thank you
>  >
>  > William L. Berndt, Ph.D.  7133 Penner Lane. Apt. #40Fort Myers, FL
> 33907@Dr_Lee_Berndt239.246.0396 <mailto:33907@Dr_Lee_Berndt239.246.0396>
>  >
>  > -----Original Message-----
>  > From: Gabriel Landini <[hidden email]
> <mailto:[hidden email]>>
>  > To: [hidden email] <mailto:[hidden email]>
>  > Sent: Tue, May 19, 2020 7:38 am
>  > Subject: Re: Standard Deviations Histogram/Color Profiler
>  >
>  > Oops I meant:
>  >
>  >> You can see there that the sd is that of  the *columns* in the profile
>  >> selection, not from the image, which is a different thing.
>  >
>  > Cheers
>  >
>  > Gabriel
>  >
>  > --
>  > 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

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

Re: Consecutive Selections in ROI Manager

Herbie
Well Lee,

it appears as if the Results table created by "Color Profiler" isn't a
ImageJ-standard Results-table which makes the processing at least
complicated perhaps even impossible.

We shall see...

Regards

Herbie

Am 22.05.20 um 16:48 schrieb Lee Berndt:

> Hi Herbie …. yes your code works very well and I see exactly what it
> does with the for loop …. but when I try that with run("color profiler")
> it doesn't work so well because color profiler overwrites each ROI
> result …. it doesn't put all results into the table like run("measure")
> does
>
> is there a way to pause between loops?  thank you for your help …..Lee
>
>
>
> William L. Berndt, Ph.D.
> 7133 Penner Lane. Apt. #40
> Fort Myers, FL 33907
> @Dr_Lee_Berndt
> 239.246.0396
>
>
> -----Original Message-----
> From: Herbie <[hidden email]>
> To: [hidden email]
> Sent: Fri, May 22, 2020 10:23 am
> Subject: Re: Consecutive Selections in ROI Manager
>
> Sorry Lee,
>
> my macro selects one RoI after the other in the "for"-loop!
>
> My macro creates 5 sample selections and measures one after the other
> and writes the measurement-results to the Results-table one after the other.
>
> Instead of using
>
> run("Measure");
>
> you can of course do what you need, i.e.
>
> run("Color Profiler");
>
> but don't close the image in the loop!
>
> HTH
>
> Herbie
>
> ::::::::::::::::::::::::::::::::::::::::
> Am 22.05.20 um 16:16 schrieb Lee Berndt:
>  > Hi thank you for responding …. no I've already tried that and it selects
>  > all of the ROI's at one time....please see this simple code which does
>  > what I want ….  there are five ROIs of an image 0,1,2,3,4 that are
>  > already added to ROi manager
>  >
>  > roiManager("Select", 0);
>  > run("Color Profiler");
>  > imageTitle=getTitle();
>  >      selectWindow(imageTitle);
>  >      run("Close");
>  > String.copyResults();
>  > //paste results to Excel
>  > //go to next ROI
>  >
>  > running this code gives me what I need for ROI 0 …. how do I loop this
>  > to run the same code for ROI 1, then ROI 2 etc ?  In all I'll have about
>  > 50 or so ROIs to analyze pasting the results into Excel ….. Any thoughts
>  > would be appreciated ….. thank you
>  >
>  > William L. Berndt, Ph.D.
>  > 7133 Penner Lane. Apt. #40
>  > Fort Myers, FL 33907
>  > @Dr_Lee_Berndt
>  > 239.246.0396
>  >
>  >
>  > -----Original Message-----
>  > From: Herbie <[hidden email] <mailto:[hidden email]>>
>  > To: [hidden email] <mailto:[hidden email]>
>  > Sent: Fri, May 22, 2020 10:06 am
>  > Subject: Re: Consecutive Selections in ROI Manager
>  >
>  > Good day Lee,
>  >
>  > does the following example ImageJ-macro code help?
>  >
>  > //
>  > Table.reset("Results");
>  > close("ROI Manager");
>  > run("Blobs");
>  > doWand(133, 197, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(132, 56, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(226, 96, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(75, 44, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(215, 170, 20.0, "Legacy");
>  > roiManager("Add");
>  > cnt = roiManager( "count" );
>  > for ( i=0; i<cnt; i++ ) {
>  >      roiManager("select", i);
>  >      run("Measure");
>  > }
>  > exit();
>  > //
>  >
>  > Paste the above macro code to an empty macro window (Plugins >> New >>
>  > Macro) and run it.
>  > (You need an open internet connection to load the demo image.)
>  >
>  > Regards
>  >
>  > Herbie
>  >
>  > ::::::::::::::::::::::::::::::::::::::::
>  > Am 22.05.20 um 15:38 schrieb Lee Berndt:
>  >  > Hello Gabriel and List Group …. hypothetically I have five ( 5)
>  > selections added to ROI manager …. can someone steer me to code that
>  > will select 0, let me analyze it, then select the next one (i.e., 1) and
>  > let me analyze that, then select the next one (i.e., 2) and analyze that
>  > …. I don't want to select all at once just one at a time ….. any help
>  > would be appreciated … thank you
>  >  >
>  >  > William L. Berndt, Ph.D.  7133 Penner Lane. Apt. #40Fort Myers, FL
>  > 33907@Dr_Lee_Berndt239.246.0396
> <mailto:33907@Dr_Lee_Berndt239.246.0396>
> <mailto:33907@Dr_Lee_Berndt239.246.0396
> <mailto:33907@Dr_Lee_Berndt239.246.0396>>
>  >  >
>  >  > -----Original Message-----
>  >  > From: Gabriel Landini <[hidden email]
> <mailto:[hidden email]>
>  > <mailto:[hidden email] <mailto:[hidden email]>>>
>  >  > To: [hidden email] <mailto:[hidden email]>
> <mailto:[hidden email] <mailto:[hidden email]>>
>  >  > Sent: Tue, May 19, 2020 7:38 am
>  >  > Subject: Re: Standard Deviations Histogram/Color Profiler
>  >  >
>  >  > Oops I meant:
>  >  >
>  >  >> You can see there that the sd is that of  the *columns* in the
> profile
>  >  >> selection, not from the image, which is a different thing.
>  >  >
>  >  > Cheers
>  >  >
>  >  > Gabriel
>  >  >
>  >  > --
>  >  > 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
>
> --
> 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: Consecutive Selections in ROI Manager

Herbie
In reply to this post by Herbie
Dear Lee,

although I'm not perfectly happy with my code, it should do...

// here we create 5 line-RoIs in the Clown-image
close("ROI Manager");
run("Clown");
makeRectangle(0,20,320,1);
roiManager("Add");
makeRectangle(0,60,320,1);
roiManager("Add");
makeRectangle(0,100,320,1);
roiManager("Add");
makeRectangle(0,140,320,1);
roiManager("Add");
makeRectangle(0,180,320,1);
roiManager("Add");
// here starts the code for getting the data
setBatchMode(true);
run("Set Measurements...", "decimal=2");
img = getTitle;
plot = "Plot of "+woSuffix(img);
path = getDirectory("downloads")+"Results.tsv";
f = File.open(path);
print( f, makeHeadings() );
cnt = roiManager( "count" );
for ( i=0; i<cnt; i++ ) {
    selectImage(img);
    roiManager("select", i);
    run("Color Profiler");
    String.copyResults;
    print( f, String.paste );
    close(plot);
}
//Table.open(path);
setBatchMode(false);
exit();
function makeHeadings() {
    return "mean\tstd.dev.\tP5%\tP95%\tred\tgreen\tblue"
}
function woSuffix( str ) {
    return substring( str, 0, lastIndexOf(str,"."));
}
//

Remarks:
1.
The data from the RoIs is written to file named "Results.tsv" in your
download folder.
2.
Sorry, but the "color"-column is missing
3.
You can drag the file too the ImageJ main window and it opens as
standard Results-table.
4. You may import the data to Excel as well, although my Excel version
mis-interprets some entries as dates. (I love Microsoft.)

Originally I wanted to automatically open the file in ImageJ but wasn't
successful.

Please tell me of the above works for you.

Regards

Herbie

::::::::::::::::::::::::::::::::::::::::
Am 22.05.20 um 16:48 schrieb Lee Berndt:

> Hi Herbie …. yes your code works very well and I see exactly what it
> does with the for loop …. but when I try that with run("color profiler")
> it doesn't work so well because color profiler overwrites each ROI
> result …. it doesn't put all results into the table like run("measure")
> does
>
> is there a way to pause between loops?  thank you for your help …..Lee
>
>
>
> William L. Berndt, Ph.D.
> 7133 Penner Lane. Apt. #40
> Fort Myers, FL 33907
> @Dr_Lee_Berndt
> 239.246.0396
>
>
> -----Original Message-----
> From: Herbie <[hidden email]>
> To: [hidden email]
> Sent: Fri, May 22, 2020 10:23 am
> Subject: Re: Consecutive Selections in ROI Manager
>
> Sorry Lee,
>
> my macro selects one RoI after the other in the "for"-loop!
>
> My macro creates 5 sample selections and measures one after the other
> and writes the measurement-results to the Results-table one after the other.
>
> Instead of using
>
> run("Measure");
>
> you can of course do what you need, i.e.
>
> run("Color Profiler");
>
> but don't close the image in the loop!
>
> HTH
>
> Herbie
>
> ::::::::::::::::::::::::::::::::::::::::
> Am 22.05.20 um 16:16 schrieb Lee Berndt:
>  > Hi thank you for responding …. no I've already tried that and it selects
>  > all of the ROI's at one time....please see this simple code which does
>  > what I want ….  there are five ROIs of an image 0,1,2,3,4 that are
>  > already added to ROi manager
>  >
>  > roiManager("Select", 0);
>  > run("Color Profiler");
>  > imageTitle=getTitle();
>  >      selectWindow(imageTitle);
>  >      run("Close");
>  > String.copyResults();
>  > //paste results to Excel
>  > //go to next ROI
>  >
>  > running this code gives me what I need for ROI 0 …. how do I loop this
>  > to run the same code for ROI 1, then ROI 2 etc ?  In all I'll have about
>  > 50 or so ROIs to analyze pasting the results into Excel ….. Any thoughts
>  > would be appreciated ….. thank you
>  >
>  > William L. Berndt, Ph.D.
>  > 7133 Penner Lane. Apt. #40
>  > Fort Myers, FL 33907
>  > @Dr_Lee_Berndt
>  > 239.246.0396
>  >
>  >
>  > -----Original Message-----
>  > From: Herbie <[hidden email] <mailto:[hidden email]>>
>  > To: [hidden email] <mailto:[hidden email]>
>  > Sent: Fri, May 22, 2020 10:06 am
>  > Subject: Re: Consecutive Selections in ROI Manager
>  >
>  > Good day Lee,
>  >
>  > does the following example ImageJ-macro code help?
>  >
>  > //
>  > Table.reset("Results");
>  > close("ROI Manager");
>  > run("Blobs");
>  > doWand(133, 197, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(132, 56, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(226, 96, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(75, 44, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(215, 170, 20.0, "Legacy");
>  > roiManager("Add");
>  > cnt = roiManager( "count" );
>  > for ( i=0; i<cnt; i++ ) {
>  >      roiManager("select", i);
>  >      run("Measure");
>  > }
>  > exit();
>  > //
>  >
>  > Paste the above macro code to an empty macro window (Plugins >> New >>
>  > Macro) and run it.
>  > (You need an open internet connection to load the demo image.)
>  >
>  > Regards
>  >
>  > Herbie
>  >
>  > ::::::::::::::::::::::::::::::::::::::::
>  > Am 22.05.20 um 15:38 schrieb Lee Berndt:
>  >  > Hello Gabriel and List Group …. hypothetically I have five ( 5)
>  > selections added to ROI manager …. can someone steer me to code that
>  > will select 0, let me analyze it, then select the next one (i.e., 1) and
>  > let me analyze that, then select the next one (i.e., 2) and analyze that
>  > …. I don't want to select all at once just one at a time ….. any help
>  > would be appreciated … thank you
>  >  >
>  >  > William L. Berndt, Ph.D.  7133 Penner Lane. Apt. #40Fort Myers, FL
>  > 33907@Dr_Lee_Berndt239.246.0396
> <mailto:33907@Dr_Lee_Berndt239.246.0396>
> <mailto:33907@Dr_Lee_Berndt239.246.0396
> <mailto:33907@Dr_Lee_Berndt239.246.0396>>
>  >  >
>  >  > -----Original Message-----
>  >  > From: Gabriel Landini <[hidden email]
> <mailto:[hidden email]>
>  > <mailto:[hidden email] <mailto:[hidden email]>>>
>  >  > To: [hidden email] <mailto:[hidden email]>
> <mailto:[hidden email] <mailto:[hidden email]>>
>  >  > Sent: Tue, May 19, 2020 7:38 am
>  >  > Subject: Re: Standard Deviations Histogram/Color Profiler
>  >  >
>  >  > Oops I meant:
>  >  >
>  >  >> You can see there that the sd is that of  the *columns* in the
> profile
>  >  >> selection, not from the image, which is a different thing.
>  >  >
>  >  > Cheers
>  >  >
>  >  > Gabriel
>  >  >
>  >  > --
>  >  > 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
>
> --
> 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: Consecutive Selections in ROI Manager

Herbie
In reply to this post by Herbie
Dear Lee,

here is a better macro version (results re-opened):

// here we create 5 line-RoIs in the Clown-image
close("ROI Manager");
run("Clown");
makeRectangle(0,20,320,1);
roiManager("Add");
makeRectangle(0,60,320,1);
roiManager("Add");
makeRectangle(0,100,320,1);
roiManager("Add");
makeRectangle(0,140,320,1);
roiManager("Add");
makeRectangle(0,180,320,1);
roiManager("Add");
// here starts the code for getting the data
setBatchMode(true);
run("Set Measurements...", "decimal=2");
img = getTitle;
plot = "Plot of "+woSuffix(img);
path = getDirectory("downloads")+"Results.tsv";
f = File.open(path);
print( f, makeHeadings() );
cnt = roiManager( "count" );
for ( i=0; i<cnt; i++ ) {
    selectImage(img);
    roiManager("select", i);
    run("Color Profiler");
    String.copyResults;
    print( f, String.paste );
    close(plot);
}
//Table.open(path);
setBatchMode(false);
exit();
function makeHeadings() {
    return "mean\tstd.dev.\tP5%\tP95%\tred\tgreen\tblue"
}
function woSuffix( str ) {
    return substring( str, 0, lastIndexOf(str,"."));
}
//

Regards

Herbie

::::::::::::::::::::::::::::::::::::::::
Dear Lee,

although I'm not perfectly happy with my code, it should do...

// here we create 5 line-RoIs in the Clown-image
close("ROI Manager");
run("Clown");
makeRectangle(0,20,320,1);
roiManager("Add");
makeRectangle(0,60,320,1);
roiManager("Add");
makeRectangle(0,100,320,1);
roiManager("Add");
makeRectangle(0,140,320,1);
roiManager("Add");
makeRectangle(0,180,320,1);
roiManager("Add");
// here starts the code for getting the data
setBatchMode(true);
run("Set Measurements...", "decimal=2");
img = getTitle;
plot = "Plot of "+woSuffix(img);
path = getDirectory("downloads")+"Results.tsv";
f = File.open(path);
print( f, makeHeadings() );
cnt = roiManager( "count" );
for ( i=0; i<cnt; i++ ) {
    selectImage(img);
    roiManager("select", i);
    run("Color Profiler");
    String.copyResults;
    print( f, String.paste );
    close(plot);
}
//Table.open(path);
setBatchMode(false);
exit();
function makeHeadings() {
    return "mean\tstd.dev.\tP5%\tP95%\tred\tgreen\tblue"
}
function woSuffix( str ) {
    return substring( str, 0, lastIndexOf(str,"."));
}
//

Remarks:
1.
The data from the RoIs is written to file named "Results.tsv" in your
download folder.
2.
Sorry, but the "color"-column is missing
3.
You can drag the file too the ImageJ main window and it opens as
standard Results-table.
4. You may import the data to Excel as well, although my Excel version
mis-interprets some entries as dates. (I love Microsoft.)

Originally I wanted to automatically open the file in ImageJ but wasn't
successful.

Please tell me of the above works for you.

Regards

Herbie

::::::::::::::::::::::::::::::::::::::::
Am 22.05.20 um 16:48 schrieb Lee Berndt:

> Hi Herbie …. yes your code works very well and I see exactly what it
> does with the for loop …. but when I try that with run("color profiler")
> it doesn't work so well because color profiler overwrites each ROI
> result …. it doesn't put all results into the table like run("measure")
> does
>
> is there a way to pause between loops?  thank you for your help …..Lee
>
>
>
> William L. Berndt, Ph.D.
> 7133 Penner Lane. Apt. #40
> Fort Myers, FL 33907
> @Dr_Lee_Berndt
> 239.246.0396
>
>
> -----Original Message-----
> From: Herbie <[hidden email]>
> To: [hidden email]
> Sent: Fri, May 22, 2020 10:23 am
> Subject: Re: Consecutive Selections in ROI Manager
>
> Sorry Lee,
>
> my macro selects one RoI after the other in the "for"-loop!
>
> My macro creates 5 sample selections and measures one after the other
> and writes the measurement-results to the Results-table one after the other.
>
> Instead of using
>
> run("Measure");
>
> you can of course do what you need, i.e.
>
> run("Color Profiler");
>
> but don't close the image in the loop!
>
> HTH
>
> Herbie
>
> ::::::::::::::::::::::::::::::::::::::::
> Am 22.05.20 um 16:16 schrieb Lee Berndt:
>  > Hi thank you for responding …. no I've already tried that and it selects
>  > all of the ROI's at one time....please see this simple code which does
>  > what I want ….  there are five ROIs of an image 0,1,2,3,4 that are
>  > already added to ROi manager
>  >
>  > roiManager("Select", 0);
>  > run("Color Profiler");
>  > imageTitle=getTitle();
>  >      selectWindow(imageTitle);
>  >      run("Close");
>  > String.copyResults();
>  > //paste results to Excel
>  > //go to next ROI
>  >
>  > running this code gives me what I need for ROI 0 …. how do I loop this
>  > to run the same code for ROI 1, then ROI 2 etc ?  In all I'll have about
>  > 50 or so ROIs to analyze pasting the results into Excel ….. Any thoughts
>  > would be appreciated ….. thank you
>  >
>  > William L. Berndt, Ph.D.
>  > 7133 Penner Lane. Apt. #40
>  > Fort Myers, FL 33907
>  > @Dr_Lee_Berndt
>  > 239.246.0396
>  >
>  >
>  > -----Original Message-----
>  > From: Herbie <[hidden email] <mailto:[hidden email]>>
>  > To: [hidden email] <mailto:[hidden email]>
>  > Sent: Fri, May 22, 2020 10:06 am
>  > Subject: Re: Consecutive Selections in ROI Manager
>  >
>  > Good day Lee,
>  >
>  > does the following example ImageJ-macro code help?
>  >
>  > //
>  > Table.reset("Results");
>  > close("ROI Manager");
>  > run("Blobs");
>  > doWand(133, 197, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(132, 56, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(226, 96, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(75, 44, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(215, 170, 20.0, "Legacy");
>  > roiManager("Add");
>  > cnt = roiManager( "count" );
>  > for ( i=0; i<cnt; i++ ) {
>  >      roiManager("select", i);
>  >      run("Measure");
>  > }
>  > exit();
>  > //
>  >
>  > Paste the above macro code to an empty macro window (Plugins >> New >>
>  > Macro) and run it.
>  > (You need an open internet connection to load the demo image.)
>  >
>  > Regards
>  >
>  > Herbie
>  >
>  > ::::::::::::::::::::::::::::::::::::::::
>  > Am 22.05.20 um 15:38 schrieb Lee Berndt:
>  >  > Hello Gabriel and List Group …. hypothetically I have five ( 5)
>  > selections added to ROI manager …. can someone steer me to code that
>  > will select 0, let me analyze it, then select the next one (i.e., 1) and
>  > let me analyze that, then select the next one (i.e., 2) and analyze that
>  > …. I don't want to select all at once just one at a time ….. any help
>  > would be appreciated … thank you
>  >  >
>  >  > William L. Berndt, Ph.D.  7133 Penner Lane. Apt. #40Fort Myers, FL
>  > 33907@Dr_Lee_Berndt239.246.0396
> <mailto:33907@Dr_Lee_Berndt239.246.0396>
> <mailto:33907@Dr_Lee_Berndt239.246.0396
> <mailto:33907@Dr_Lee_Berndt239.246.0396>>
>  >  >
>  >  > -----Original Message-----
>  >  > From: Gabriel Landini <[hidden email]
> <mailto:[hidden email]>
>  > <mailto:[hidden email] <mailto:[hidden email]>>>
>  >  > To: [hidden email] <mailto:[hidden email]>
> <mailto:[hidden email] <mailto:[hidden email]>>
>  >  > Sent: Tue, May 19, 2020 7:38 am
>  >  > Subject: Re: Standard Deviations Histogram/Color Profiler
>  >  >
>  >  > Oops I meant:
>  >  >
>  >  >> You can see there that the sd is that of  the *columns* in the
> profile
>  >  >> selection, not from the image, which is a different thing.
>  >  >
>  >  > Cheers
>  >  >
>  >  > Gabriel
>  >  >
>  >  > --
>  >  > 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
>
> --
> 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: Consecutive Selections in ROI Manager

Herbie
In reply to this post by Herbie
Sorry, before was a copy of the previous.
Here is the better version:

// here we create 5 line-RoIs in the Clown-image
close("ROI Manager");
run("Clown");
makeRectangle(0,20,320,1);
roiManager("Add");
makeRectangle(0,60,320,1);
roiManager("Add");
makeRectangle(0,100,320,1);
roiManager("Add");
makeRectangle(0,140,320,1);
roiManager("Add");
makeRectangle(0,180,320,1);
roiManager("Add");
// here starts the code for getting the data
setBatchMode(true);
run("Set Measurements...", "decimal=2");
img = getTitle;
plot = "Plot of "+woSuffix(img);
path = getDirectory("downloads")+"Results.tsv";
f = File.open(path);
print( f, makeHeadings() );
cnt = roiManager( "count" );
for ( i=0; i<cnt; i++ ) {
    selectImage(img);
    roiManager("select", i);
    run("Color Profiler");
    String.copyResults;
    print( f, String.paste );
    close(plot);
}
File.close(f)
//close(img);
close("Results");
open( path );
setBatchMode(false);
exit();
function makeHeadings() {
    return "mean\tstd.dev.\tP5%\tP95%\tred\tgreen\tblue"
}
function woSuffix( str ) {
    return substring( str, 0, lastIndexOf(str,"."));
}
//


Regards

Herbie

::::::::::::::::::::::::::::::::::::::::
Dear Lee,

here is a better macro version (results re-opened):

// here we create 5 line-RoIs in the Clown-image
close("ROI Manager");
run("Clown");
makeRectangle(0,20,320,1);
roiManager("Add");
makeRectangle(0,60,320,1);
roiManager("Add");
makeRectangle(0,100,320,1);
roiManager("Add");
makeRectangle(0,140,320,1);
roiManager("Add");
makeRectangle(0,180,320,1);
roiManager("Add");
// here starts the code for getting the data
setBatchMode(true);
run("Set Measurements...", "decimal=2");
img = getTitle;
plot = "Plot of "+woSuffix(img);
path = getDirectory("downloads")+"Results.tsv";
f = File.open(path);
print( f, makeHeadings() );
cnt = roiManager( "count" );
for ( i=0; i<cnt; i++ ) {
    selectImage(img);
    roiManager("select", i);
    run("Color Profiler");
    String.copyResults;
    print( f, String.paste );
    close(plot);
}
//Table.open(path);
setBatchMode(false);
exit();
function makeHeadings() {
    return "mean\tstd.dev.\tP5%\tP95%\tred\tgreen\tblue"
}
function woSuffix( str ) {
    return substring( str, 0, lastIndexOf(str,"."));
}
//

Regards

Herbie

::::::::::::::::::::::::::::::::::::::::
Dear Lee,

although I'm not perfectly happy with my code, it should do...

// here we create 5 line-RoIs in the Clown-image
close("ROI Manager");
run("Clown");
makeRectangle(0,20,320,1);
roiManager("Add");
makeRectangle(0,60,320,1);
roiManager("Add");
makeRectangle(0,100,320,1);
roiManager("Add");
makeRectangle(0,140,320,1);
roiManager("Add");
makeRectangle(0,180,320,1);
roiManager("Add");
// here starts the code for getting the data
setBatchMode(true);
run("Set Measurements...", "decimal=2");
img = getTitle;
plot = "Plot of "+woSuffix(img);
path = getDirectory("downloads")+"Results.tsv";
f = File.open(path);
print( f, makeHeadings() );
cnt = roiManager( "count" );
for ( i=0; i<cnt; i++ ) {
    selectImage(img);
    roiManager("select", i);
    run("Color Profiler");
    String.copyResults;
    print( f, String.paste );
    close(plot);
}
//Table.open(path);
setBatchMode(false);
exit();
function makeHeadings() {
    return "mean\tstd.dev.\tP5%\tP95%\tred\tgreen\tblue"
}
function woSuffix( str ) {
    return substring( str, 0, lastIndexOf(str,"."));
}
//

Remarks:
1.
The data from the RoIs is written to file named "Results.tsv" in your
download folder.
2.
Sorry, but the "color"-column is missing
3.
You can drag the file too the ImageJ main window and it opens as
standard Results-table.
4. You may import the data to Excel as well, although my Excel version
mis-interprets some entries as dates. (I love Microsoft.)

Originally I wanted to automatically open the file in ImageJ but wasn't
successful.

Please tell me of the above works for you.

Regards

Herbie

::::::::::::::::::::::::::::::::::::::::
Am 22.05.20 um 16:48 schrieb Lee Berndt:

> Hi Herbie …. yes your code works very well and I see exactly what it
> does with the for loop …. but when I try that with run("color profiler")
> it doesn't work so well because color profiler overwrites each ROI
> result …. it doesn't put all results into the table like run("measure")
> does
>
> is there a way to pause between loops?  thank you for your help …..Lee
>
>
>
> William L. Berndt, Ph.D.
> 7133 Penner Lane. Apt. #40
> Fort Myers, FL 33907
> @Dr_Lee_Berndt
> 239.246.0396
>
>
> -----Original Message-----
> From: Herbie <[hidden email]>
> To: [hidden email]
> Sent: Fri, May 22, 2020 10:23 am
> Subject: Re: Consecutive Selections in ROI Manager
>
> Sorry Lee,
>
> my macro selects one RoI after the other in the "for"-loop!
>
> My macro creates 5 sample selections and measures one after the other
> and writes the measurement-results to the Results-table one after the other.
>
> Instead of using
>
> run("Measure");
>
> you can of course do what you need, i.e.
>
> run("Color Profiler");
>
> but don't close the image in the loop!
>
> HTH
>
> Herbie
>
> ::::::::::::::::::::::::::::::::::::::::
> Am 22.05.20 um 16:16 schrieb Lee Berndt:
>  > Hi thank you for responding …. no I've already tried that and it selects
>  > all of the ROI's at one time....please see this simple code which does
>  > what I want ….  there are five ROIs of an image 0,1,2,3,4 that are
>  > already added to ROi manager
>  >
>  > roiManager("Select", 0);
>  > run("Color Profiler");
>  > imageTitle=getTitle();
>  >      selectWindow(imageTitle);
>  >      run("Close");
>  > String.copyResults();
>  > //paste results to Excel
>  > //go to next ROI
>  >
>  > running this code gives me what I need for ROI 0 …. how do I loop this
>  > to run the same code for ROI 1, then ROI 2 etc ?  In all I'll have about
>  > 50 or so ROIs to analyze pasting the results into Excel ….. Any thoughts
>  > would be appreciated ….. thank you
>  >
>  > William L. Berndt, Ph.D.
>  > 7133 Penner Lane. Apt. #40
>  > Fort Myers, FL 33907
>  > @Dr_Lee_Berndt
>  > 239.246.0396
>  >
>  >
>  > -----Original Message-----
>  > From: Herbie <[hidden email] <mailto:[hidden email]>>
>  > To: [hidden email] <mailto:[hidden email]>
>  > Sent: Fri, May 22, 2020 10:06 am
>  > Subject: Re: Consecutive Selections in ROI Manager
>  >
>  > Good day Lee,
>  >
>  > does the following example ImageJ-macro code help?
>  >
>  > //
>  > Table.reset("Results");
>  > close("ROI Manager");
>  > run("Blobs");
>  > doWand(133, 197, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(132, 56, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(226, 96, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(75, 44, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(215, 170, 20.0, "Legacy");
>  > roiManager("Add");
>  > cnt = roiManager( "count" );
>  > for ( i=0; i<cnt; i++ ) {
>  >      roiManager("select", i);
>  >      run("Measure");
>  > }
>  > exit();
>  > //
>  >
>  > Paste the above macro code to an empty macro window (Plugins >> New >>
>  > Macro) and run it.
>  > (You need an open internet connection to load the demo image.)
>  >
>  > Regards
>  >
>  > Herbie
>  >
>  > ::::::::::::::::::::::::::::::::::::::::
>  > Am 22.05.20 um 15:38 schrieb Lee Berndt:
>  >  > Hello Gabriel and List Group …. hypothetically I have five ( 5)
>  > selections added to ROI manager …. can someone steer me to code that
>  > will select 0, let me analyze it, then select the next one (i.e., 1) and
>  > let me analyze that, then select the next one (i.e., 2) and analyze that
>  > …. I don't want to select all at once just one at a time ….. any help
>  > would be appreciated … thank you
>  >  >
>  >  > William L. Berndt, Ph.D.  7133 Penner Lane. Apt. #40Fort Myers, FL
>  > 33907@Dr_Lee_Berndt239.246.0396
> <mailto:33907@Dr_Lee_Berndt239.246.0396>
> <mailto:33907@Dr_Lee_Berndt239.246.0396
> <mailto:33907@Dr_Lee_Berndt239.246.0396>>
>  >  >
>  >  > -----Original Message-----
>  >  > From: Gabriel Landini <[hidden email]
> <mailto:[hidden email]>
>  > <mailto:[hidden email] <mailto:[hidden email]>>>
>  >  > To: [hidden email] <mailto:[hidden email]>
> <mailto:[hidden email] <mailto:[hidden email]>>
>  >  > Sent: Tue, May 19, 2020 7:38 am
>  >  > Subject: Re: Standard Deviations Histogram/Color Profiler
>  >  >
>  >  > Oops I meant:
>  >  >
>  >  >> You can see there that the sd is that of  the *columns* in the
> profile
>  >  >> selection, not from the image, which is a different thing.
>  >  >
>  >  > Cheers
>  >  >
>  >  > Gabriel
>  >  >
>  >  > --
>  >  > 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
>
> --
> 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

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

Re: Consecutive Selections in ROI Manager

Herbie
In reply to this post by Herbie
Dear Lee,

meanwhile Wayne has made some important changes regarding non-standard
results table. Now they can easily be changed to standard ones. This is
great news but doesn't solve all problems with what you like to obtain
with the "Color Profiler" results.

Below please find a further improved macro code that should do what you
want.
(You need to update ImageJ to the latest daily build, at least version
"1.53b".)

// here we create 5 line-RoIs in the Clown-image
close( "ROI Manager" );
run( "Clown" );
for ( i=0; i<5; i++ ) {
    makeRectangle( 0, i*40+20, 320, 1 );
    roiManager( "Add" );
}
// here starts the code for getting the results
requires( "1.53b" );
setBatchMode( true );
run( "Set Measurements...", "decimal=2" );
img = getTitle;
plot = "Plot of " + woSuffix( img );
path = getDirectory( "temp" ) + "Results.tsv";
f = File.open( path );
print( f, makeHeadings() );
cnt = roiManager( "count" );
label = newArray( cnt * 3 );
color = newArray( "_red", "_green", "_blue" );
for ( i=0; i<cnt; i++ ) {
    selectImage( img );
    roiManager( "select", i );
    makeLabels( i, label, color );
    run( "Color Profiler" );
    String.copyResults;
    print( f, String.paste );
    close( plot );
}
File.close( f );
open( path );
Table.setColumn( "RoI", label );
setBatchMode( false );
exit();
function makeHeadings() {
    return "mean\tstd.dev.\tP5%\tP95%\tred\tgreen\tblue";
}
function makeLabels( idx, lbl, clr ) {
    for ( k=0; k<3; k++ ) lbl[idx*3+k] = Roi.getName + clr[k];
}
function woSuffix( str ) {
    return substring( str, 0, lastIndexOf( str, "." ) );
}
//

Regards

Herbie

::::::::::::::::::::::::::::::::::::::::
Dear Lee,

although I'm not perfectly happy with my code, it should do...

// here we create 5 line-RoIs in the Clown-image
close("ROI Manager");
run("Clown");
makeRectangle(0,20,320,1);
roiManager("Add");
makeRectangle(0,60,320,1);
roiManager("Add");
makeRectangle(0,100,320,1);
roiManager("Add");
makeRectangle(0,140,320,1);
roiManager("Add");
makeRectangle(0,180,320,1);
roiManager("Add");
// here starts the code for getting the data
setBatchMode(true);
run("Set Measurements...", "decimal=2");
img = getTitle;
plot = "Plot of "+woSuffix(img);
path = getDirectory("downloads")+"Results.tsv";
f = File.open(path);
print( f, makeHeadings() );
cnt = roiManager( "count" );
for ( i=0; i<cnt; i++ ) {
    selectImage(img);
    roiManager("select", i);
    run("Color Profiler");
    String.copyResults;
    print( f, String.paste );
    close(plot);
}
//Table.open(path);
setBatchMode(false);
exit();
function makeHeadings() {
    return "mean\tstd.dev.\tP5%\tP95%\tred\tgreen\tblue"
}
function woSuffix( str ) {
    return substring( str, 0, lastIndexOf(str,"."));
}
//

Remarks:
1.
The data from the RoIs is written to file named "Results.tsv" in your
download folder.
2.
Sorry, but the "color"-column is missing
3.
You can drag the file too the ImageJ main window and it opens as
standard Results-table.
4. You may import the data to Excel as well, although my Excel version
mis-interprets some entries as dates. (I love Microsoft.)

Originally I wanted to automatically open the file in ImageJ but wasn't
successful.

Please tell me of the above works for you.

Regards

Herbie

::::::::::::::::::::::::::::::::::::::::
Am 22.05.20 um 16:48 schrieb Lee Berndt:

> Hi Herbie …. yes your code works very well and I see exactly what it
> does with the for loop …. but when I try that with run("color profiler")
> it doesn't work so well because color profiler overwrites each ROI
> result …. it doesn't put all results into the table like run("measure")
> does
>
> is there a way to pause between loops?  thank you for your help …..Lee
>
>
>
> William L. Berndt, Ph.D.
> 7133 Penner Lane. Apt. #40
> Fort Myers, FL 33907
> @Dr_Lee_Berndt
> 239.246.0396
>
>
> -----Original Message-----
> From: Herbie <[hidden email]>
> To: [hidden email]
> Sent: Fri, May 22, 2020 10:23 am
> Subject: Re: Consecutive Selections in ROI Manager
>
> Sorry Lee,
>
> my macro selects one RoI after the other in the "for"-loop!
>
> My macro creates 5 sample selections and measures one after the other
> and writes the measurement-results to the Results-table one after the other.
>
> Instead of using
>
> run("Measure");
>
> you can of course do what you need, i.e.
>
> run("Color Profiler");
>
> but don't close the image in the loop!
>
> HTH
>
> Herbie
>
> ::::::::::::::::::::::::::::::::::::::::
> Am 22.05.20 um 16:16 schrieb Lee Berndt:
>  > Hi thank you for responding …. no I've already tried that and it selects
>  > all of the ROI's at one time....please see this simple code which does
>  > what I want ….  there are five ROIs of an image 0,1,2,3,4 that are
>  > already added to ROi manager
>  >
>  > roiManager("Select", 0);
>  > run("Color Profiler");
>  > imageTitle=getTitle();
>  >      selectWindow(imageTitle);
>  >      run("Close");
>  > String.copyResults();
>  > //paste results to Excel
>  > //go to next ROI
>  >
>  > running this code gives me what I need for ROI 0 …. how do I loop this
>  > to run the same code for ROI 1, then ROI 2 etc ?  In all I'll have about
>  > 50 or so ROIs to analyze pasting the results into Excel ….. Any thoughts
>  > would be appreciated ….. thank you
>  >
>  > William L. Berndt, Ph.D.
>  > 7133 Penner Lane. Apt. #40
>  > Fort Myers, FL 33907
>  > @Dr_Lee_Berndt
>  > 239.246.0396
>  >
>  >
>  > -----Original Message-----
>  > From: Herbie <[hidden email] <mailto:[hidden email]>>
>  > To: [hidden email] <mailto:[hidden email]>
>  > Sent: Fri, May 22, 2020 10:06 am
>  > Subject: Re: Consecutive Selections in ROI Manager
>  >
>  > Good day Lee,
>  >
>  > does the following example ImageJ-macro code help?
>  >
>  > //
>  > Table.reset("Results");
>  > close("ROI Manager");
>  > run("Blobs");
>  > doWand(133, 197, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(132, 56, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(226, 96, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(75, 44, 20.0, "Legacy");
>  > roiManager("Add");
>  > doWand(215, 170, 20.0, "Legacy");
>  > roiManager("Add");
>  > cnt = roiManager( "count" );
>  > for ( i=0; i<cnt; i++ ) {
>  >      roiManager("select", i);
>  >      run("Measure");
>  > }
>  > exit();
>  > //
>  >
>  > Paste the above macro code to an empty macro window (Plugins >> New >>
>  > Macro) and run it.
>  > (You need an open internet connection to load the demo image.)
>  >
>  > Regards
>  >
>  > Herbie
>  >
>  > ::::::::::::::::::::::::::::::::::::::::
>  > Am 22.05.20 um 15:38 schrieb Lee Berndt:
>  >  > Hello Gabriel and List Group …. hypothetically I have five ( 5)
>  > selections added to ROI manager …. can someone steer me to code that
>  > will select 0, let me analyze it, then select the next one (i.e., 1) and
>  > let me analyze that, then select the next one (i.e., 2) and analyze that
>  > …. I don't want to select all at once just one at a time ….. any help
>  > would be appreciated … thank you
>  >  >
>  >  > William L. Berndt, Ph.D.  7133 Penner Lane. Apt. #40Fort Myers, FL
>  > 33907@Dr_Lee_Berndt239.246.0396
> <mailto:33907@Dr_Lee_Berndt239.246.0396>
> <mailto:33907@Dr_Lee_Berndt239.246.0396
> <mailto:33907@Dr_Lee_Berndt239.246.0396>>
>  >  >
>  >  > -----Original Message-----
>  >  > From: Gabriel Landini <[hidden email]
> <mailto:[hidden email]>
>  > <mailto:[hidden email] <mailto:[hidden email]>>>
>  >  > To: [hidden email] <mailto:[hidden email]>
> <mailto:[hidden email] <mailto:[hidden email]>>
>  >  > Sent: Tue, May 19, 2020 7:38 am
>  >  > Subject: Re: Standard Deviations Histogram/Color Profiler
>  >  >
>  >  > Oops I meant:
>  >  >
>  >  >> You can see there that the sd is that of  the *columns* in the
> profile
>  >  >> selection, not from the image, which is a different thing.
>  >  >
>  >  > Cheers
>  >  >
>  >  > Gabriel
>  >  >
>  >  > --
>  >  > 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
>
> --
> 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

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

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