Help Please

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

Help Please

Lee Berndt

Greetings:
 
I've written a macro to help determine the area of injury to turfgrass (putting greens)....the macro works great except for the very end....what I need to do is to get the number of pixels in an image corresponding to count 0 of 256 (black)....I can get the total number of pixels in the image but need the value for count 0 to create a percentage of black to all other pixels.....how do I get that value?  Any help is greatly appreciated....thank you.
 
 

William L. Berndt, Ph.D.
239.246.0396
 
 


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

Re: Help Please

Straub, Volko A. (Dr.)
Hi William,

If you have a binary image (e.g. an image that you have previously
thresholded), use 'Create Selection' from the Edit->Selection menu
(macro command: run("Create Selection");) to select all pixels with a
value of 255. Follow this by 'Make Inverse' from the Edit->Selection
menu (macro command: run("Make Inverse");) to select all pixels with a
value of 0. Then simply use the Measure command to get the area of the
selection.

Hope this helps,
Volko


On 30/08/2014 22:44, Lee Berndt wrote:

> Greetings:
>  
> I've written a macro to help determine the area of injury to turfgrass (putting greens)....the macro works great except for the very end....what I need to do is to get the number of pixels in an image corresponding to count 0 of 256 (black)....I can get the total number of pixels in the image but need the value for count 0 to create a percentage of black to all other pixels.....how do I get that value?  Any help is greatly appreciated....thank you.
>  
>  
>
> William L. Berndt, Ph.D.
> 239.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: Help Please

Lee Berndt

Hi Volko....thanks for your response....I solved my problem late last night using the following code:
 
    m = (getResult("Count",0));
    getStatistics(nPixels);
    n = nPixels;
    x = ((m/n)*100);
    print("Total Number of Pixels =",n);
    print("Number of Black Pixels =",m);
    print("Injury Area in cm2 =",x);
 
Thanks again for your help....
 
 

William L. Berndt, Ph.D.
239.246.0396
 
 

 
 
-----Original Message-----
From: Volko Straub <[hidden email]>
To: IMAGEJ <[hidden email]>
Sent: Sun, Aug 31, 2014 1:59 am
Subject: Re: Help Please


Hi William,

If you have a binary image (e.g. an image that you have previously
thresholded), use 'Create Selection' from the Edit->Selection menu
(macro command: run("Create Selection");) to select all pixels with a
value of 255. Follow this by 'Make Inverse' from the Edit->Selection
menu (macro command: run("Make Inverse");) to select all pixels with a
value of 0. Then simply use the Measure command to get the area of the
selection.

Hope this helps,
Volko


On 30/08/2014 22:44, Lee Berndt wrote:
> Greetings:
>  
> I've written a macro to help determine the area of injury to turfgrass
(putting greens)....the macro works great except for the very end....what I need
to do is to get the number of pixels in an image corresponding to count 0 of 256
(black)....I can get the total number of pixels in the image but need the value
for count 0 to create a percentage of black to all other pixels.....how do I get
that value?  Any help is greatly appreciated....thank you.

>  
>  
>
> William L. Berndt, Ph.D.
> 239.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: Help Please

Gregory James
In reply to this post by Lee Berndt
Hi,

I would use the 'getHistogram' macro function...

getHistogram(values, counts, nBins[, histMin, histMax])

Then the number of zero pixels is given by 'counts[0]'.

Greg.


________________________________________
From: ImageJ Interest Group [[hidden email]] On Behalf Of Lee Berndt [[hidden email]]
Sent: 30 August 2014 22:44
To: [hidden email]
Subject: Help Please

Greetings:

I've written a macro to help determine the area of injury to turfgrass (putting greens)....the macro works great except for the very end....what I need to do is to get the number of pixels in an image corresponding to count 0 of 256 (black)....I can get the total number of pixels in the image but need the value for count 0 to create a percentage of black to all other pixels.....how do I get that value?  Any help is greatly appreciated....thank you.



William L. Berndt, Ph.D.
239.246.0396




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

********************************************************************************************************************

This message may contain confidential information. If you are not the intended recipient please inform the
sender that you have received the message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or take any action in reliance on its contents:
to do so is strictly prohibited and may be unlawful.

Thank you for your co-operation.

NHSmail is the secure email and directory service available for all NHS staff in England and Scotland
NHSmail is approved for exchanging patient data and other sensitive information with NHSmail and GSi recipients
NHSmail provides an email address for your career in the NHS and can be accessed anywhere

********************************************************************************************************************

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

Re: Help Please

Lee Berndt

Hi Greg....thank you for your reply.....I made my problem go away by using the following code:
 
 getHistogram(values, counts, nBins);
   for (i=0; i<nBins; i++) {
      setResult("Value", row, values[i]);
      setResult("Count", row, counts[i]);
      row++;
   }
  updateResults();
 
    m = (getResult("Count",0));
 
thanks again.....Lee
 

William L. Berndt, Ph.D.
239.246.0396
 
 

 
 
-----Original Message-----
From: James gregory (SANDWELL AND WEST BIRMINGHAM HOSPITALS NHS TRUST) <[hidden email]>
To: IMAGEJ <[hidden email]>
Sent: Mon, Sep 1, 2014 5:13 am
Subject: Re: Help Please


Hi,

I would use the 'getHistogram' macro function...

getHistogram(values, counts, nBins[, histMin, histMax])

Then the number of zero pixels is given by 'counts[0]'.

Greg.


________________________________________
From: ImageJ Interest Group [[hidden email]] On Behalf Of Lee Berndt
[[hidden email]]
Sent: 30 August 2014 22:44
To: [hidden email]
Subject: Help Please

Greetings:

I've written a macro to help determine the area of injury to turfgrass (putting
greens)....the macro works great except for the very end....what I need to do is
to get the number of pixels in an image corresponding to count 0 of 256
(black)....I can get the total number of pixels in the image but need the value
for count 0 to create a percentage of black to all other pixels.....how do I get
that value?  Any help is greatly appreciated....thank you.



William L. Berndt, Ph.D.
239.246.0396




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

********************************************************************************************************************

This message may contain confidential information. If you are not the intended
recipient please inform the
sender that you have received the message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or take
any action in reliance on its contents:
to do so is strictly prohibited and may be unlawful.

Thank you for your co-operation.

NHSmail is the secure email and directory service available for all NHS staff in
England and Scotland
NHSmail is approved for exchanging patient data and other sensitive information
with NHSmail and GSi recipients
NHSmail provides an email address for your career in the NHS and can be accessed
anywhere

********************************************************************************************************************

--
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: Help Please

Lee Berndt
In reply to this post by Gregory James

Greeting from Florida:
 
I'm have a bit of trouble and was wondering about a solution.  When I run color threshold on an open RBG image the threshold window pops up and settings (i.e., min hue, etc.) can be manually configured (i.e., min hue, max hue, etc.)....my question is that since I have numerous images to do this on is there macro language that would allow me to simply set the configurations instead of having to do it manually via adjusting the sliders every time?....when I click the macro button on the threshold window with the correct setting it generates a lot of code that is not applicable to my need and I'm having a heck of a time modifying the code....in other words is there a way to, for example, set maxHue or minHue via a macro?....any suggestions would be of great help....

I need to have the following settings:

min hue = 40
max hue = 255
min sat = 0
max sat = 255
min bri = 0
max bri = 255
band.pass = false (unchecked)
band.pass1 =true (checked)
band.pass2=true (checked)
method = default
threshold color = Red
color space = HSB
and dark background (checked)


thanks in advance for any suggestions....

 

William L. Berndt, Ph.D.
239.246.0396
 
 

 

 

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

Re: Help Please

Gabriel Landini
On Monday 01 Sep 2014 10:22:42 Lee Berndt wrote:

> I'm have a bit of trouble and was wondering about a solution.  When I run
> color threshold on an open RBG image the threshold window pops up and
> settings (i.e., min hue, etc.) can be manually configured (i.e., min hue,
> max hue, etc.)....my question is that since I have numerous images to do
> this on is there macro language that would allow me to simply set the
> configurations instead of having to do it manually via adjusting the
> sliders every time?....when I click the macro button on the threshold
> window with the correct setting it generates a lot of code that is not
> applicable to my need and I'm having a heck of a time modifying the
> code....in other words is there a way to, for example, set maxHue or minHue
> via a macro?....any suggestions would be of great help....

You can use the "Macro" button to generate a macro that corresponds to the
current settings of the dialog.

Regards

Gabriel
 

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