Finding top 10 or 50 etc maximum intensities in ROI

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

Finding top 10 or 50 etc maximum intensities in ROI

Yaseen Ladak
Dear All,

Can someone please help me for a  plugin or a way to give me top 10 or 50
or top x maximum intensity values in  selection area.

Thank you in advance.

Best wishes,
Yaseen

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

Re: Finding top 10 or 50 etc maximum intensities in ROI

vischer
Hi Yaseen,
> Can someone please help me for a  plugin or a way to give me top 10 or 50
> or top x maximum intensity values in  selection area.

the output of the MaximumFinder is already sorted.
Here is an example to find the 5 strongest dots. Because we have
constant background, the absolute mean values have similar rank as relative dot maxima.

If you un-comment the "Measure" command, you'll get the output below.
Strange enough, the Measure command destructively paints the pixels-
is  this a bug?


run("Clear Results");
run("Close All");
run("Dot Blot (7K)");
run("Find Maxima...", "noise=20 output=[Point Selection] light");
getSelectionCoordinates(xx, yy);
xx = Array.trim(xx, 5);
yy = Array.trim(yy, 5);
makeSelection("point",xx, yy);
run("Set Measurements...", " mean");
//run("Measure");


output:
=======
  Mean X Y
1 57 192 251
2 61 260 178
3 75 119 255
4 88 119 184
5 95 193 182


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

Re: Finding top 10 or 50 etc maximum intensities in ROI

vischer
In reply to this post by Yaseen Ladak
Hi Yaseen,
> Can someone please help me for a  plugin or a way to give me top 10 or 50
> or top x maximum intensity values in  selection area.

Are you talking about distictly separated maxima?
The output of the MaximumFinder is already sorted.
Here is an example to find the 5 strongest dots (similar rank as the absolute max values).

If you un-comment the "Measure" command, you'll get the output below.
Strange enough, the Measure command destructively paints the pixels-
Is this a bug?


run("Clear Results");
run("Close All");
run("Dot Blot (7K)");
run("Find Maxima...", "noise=20 output=[Point Selection] light");
getSelectionCoordinates(xx, yy);
xx = Array.trim(xx, 5);
yy = Array.trim(yy, 5);
makeSelection("point",xx, yy);
run("Set Measurements...", " mean");
//run("Measure");


output:
=======
        Mean X Y
1 57 192 251
2 61 260 178
3 75 119 255
4 88 119 184
5 95 193 182


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

Re: Finding top 10 or 50 etc maximum intensities in ROI

Yaseen Ladak
Hi Norbert,

Thank you very much.  It looks more or less right. I will have to try it
and get back to you tomorrow morning. However,

1. I am new to imageJ and I am using Mac OS 10.7. How can i uncomment and
where would the file be for the changes which needs to be done? or the code
at the bottom of you email is a macro which needs to be saved? Sorry I am a
bit confused on this part.

2. Instead of "Mean" I should be using "Max" and

3.the trim which is set to 5 can be changed to 10 or 50 etc depending on
the amount of values i need?

I look forward to hear from you.

Many thanks,
Yaseen

On 19 September 2012 22:09, Norbert Vischer <[hidden email]> wrote:

> Hi Yaseen,
> > Can someone please help me for a  plugin or a way to give me top 10 or 50
> > or top x maximum intensity values in  selection area.
>
> Are you talking about distictly separated maxima?
> The output of the MaximumFinder is already sorted.
> Here is an example to find the 5 strongest dots (similar rank as the
> absolute max values).
>
> If you un-comment the "Measure" command, you'll get the output below.
> Strange enough, the Measure command destructively paints the pixels-
> Is this a bug?
>
>
> run("Clear Results");
> run("Close All");
> run("Dot Blot (7K)");
> run("Find Maxima...", "noise=20 output=[Point Selection] light");
> getSelectionCoordinates(xx, yy);
> xx = Array.trim(xx, 5);
> yy = Array.trim(yy, 5);
> makeSelection("point",xx, yy);
> run("Set Measurements...", " mean");
> //run("Measure");
>
>
> output:
> =======
>         Mean    X       Y
> 1       57      192     251
> 2       61      260     178
> 3       75      119     255
> 4       88      119     184
> 5       95      193     182
>
>
> Norbert Vischer
> --
> 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: Finding top 10 or 50 etc maximum intensities in ROI

Yaseen Ladak
In reply to this post by vischer
Hi Nobert and all ,

I have attached a screen shot image with this email of what i am trying to
achieve

In image labelled as "Screen shot"  you can see I have drawn  an selection
box and I want to find the top 10 or 50 maximum intensity values. However
when I go to set measurements and select to give me maximum and mimimum it
just gives me 1 maximum and 1 minimum.

This 1 maximum or minimum may be a hotspot. So I want to find 10 top most
or 50 top most maximum values in the selection box.


I can send the actual image if someone needs it?

Many thanks.

Best wishes,
Yaseen

On 19 September 2012 22:09, Norbert Vischer <[hidden email]> wrote:

> Hi Yaseen,
> > Can someone please help me for a  plugin or a way to give me top 10 or 50
> > or top x maximum intensity values in  selection area.
>
> Are you talking about distictly separated maxima?
> The output of the MaximumFinder is already sorted.
> Here is an example to find the 5 strongest dots (similar rank as the
> absolute max values).
>
> If you un-comment the "Measure" command, you'll get the output below.
> Strange enough, the Measure command destructively paints the pixels-
> Is this a bug?
>
>
> run("Clear Results");
> run("Close All");
> run("Dot Blot (7K)");
> run("Find Maxima...", "noise=20 output=[Point Selection] light");
> getSelectionCoordinates(xx, yy);
> xx = Array.trim(xx, 5);
> yy = Array.trim(yy, 5);
> makeSelection("point",xx, yy);
> run("Set Measurements...", " mean");
> //run("Measure");
>
>
> output:
> =======
>         Mean    X       Y
> 1       57      192     251
> 2       61      260     178
> 3       75      119     255
> 4       88      119     184
> 5       95      193     182
>
>
> Norbert Vischer
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Screen shot.jpg (67K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Finding top 10 or 50 etc maximum intensities in ROI

Michael Schmid
Hi Yaseen,

You should run the macro. Copy it from the mailer, and type Command-shift-V in ImageJ. This creates a new text window with the macro. Then, with this text window in the foreground, select Macro>Run Macro from the menu.
Then after 'Set Measurements', the 'mean' column actually contains your maxima. You could also run "Set Measurements..." with min&max, but that won't change anything, both min and max will show the same values again. That's because the selection has been set to include the maxima only.

Probably you should also use the Preview functionality of "Find Maxima" to select a suitable noise tolerance (the number after "noise=" in the macro).
If the noise tolerance is too high, it reports only one maximum or a few. You can set the noise tolerance to 0, then it reports all maxima.

Looking at your image, I have the impression that you should not use a noise tolerance of 0, you would get a lot of noise peaks.

Michael
________________________________________________________________
On Sep 20, 2012, at 11:20, Yaseen Ladak wrote:

> Hi Nobert and all ,
>
> I have attached a screen shot image with this email of what i am trying to
> achieve
>
> In image labelled as "Screen shot"  you can see I have drawn  an selection
> box and I want to find the top 10 or 50 maximum intensity values. However
> when I go to set measurements and select to give me maximum and mimimum it
> just gives me 1 maximum and 1 minimum.
>
> This 1 maximum or minimum may be a hotspot. So I want to find 10 top most
> or 50 top most maximum values in the selection box.
>
>
> I can send the actual image if someone needs it?
>
> Many thanks.
>
> Best wishes,
> Yaseen
>
> On 19 September 2012 22:09, Norbert Vischer <[hidden email]> wrote:
>
>> Hi Yaseen,
>>> Can someone please help me for a  plugin or a way to give me top 10 or 50
>>> or top x maximum intensity values in  selection area.
>>
>> Are you talking about distictly separated maxima?
>> The output of the MaximumFinder is already sorted.
>> Here is an example to find the 5 strongest dots (similar rank as the
>> absolute max values).
>>
>> If you un-comment the "Measure" command, you'll get the output below.
>> Strange enough, the Measure command destructively paints the pixels-
>> Is this a bug?
>>
>>
>> run("Clear Results");
>> run("Close All");
>> run("Dot Blot (7K)");
>> run("Find Maxima...", "noise=20 output=[Point Selection] light");
>> getSelectionCoordinates(xx, yy);
>> xx = Array.trim(xx, 5);
>> yy = Array.trim(yy, 5);
>> makeSelection("point",xx, yy);
>> run("Set Measurements...", " mean");
>> //run("Measure");
>>
>>
>> output:
>> =======
>>        Mean    X       Y
>> 1       57      192     251
>> 2       61      260     178
>> 3       75      119     255
>> 4       88      119     184
>> 5       95      193     182
>>
>>
>> Norbert Vischer
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> <Screen shot.jpg>

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

Re: Finding top 10 or 50 etc maximum intensities in ROI

Yaseen Ladak
Hi Michael,

It just gives me a dot plot with some values not really relevant. More over
this is just one slice from the Z stack I have.

Is is possible I can send this 16 bit image at your end just to have a look
if things work at your end on what i am trying to achieve? I am unable to
send this image via this list as the size is approx 410 KB, unless there is
a seperate email address I can send you on?

On 20 September 2012 10:40, Michael Schmid <[hidden email]> wrote:

> Hi Yaseen,
>
> You should run the macro. Copy it from the mailer, and type
> Command-shift-V in ImageJ. This creates a new text window with the macro.
> Then, with this text window in the foreground, select Macro>Run Macro from
> the menu.
> Then after 'Set Measurements', the 'mean' column actually contains your
> maxima. You could also run "Set Measurements..." with min&max, but that
> won't change anything, both min and max will show the same values again.
> That's because the selection has been set to include the maxima only.
>
> Probably you should also use the Preview functionality of "Find Maxima" to
> select a suitable noise tolerance (the number after "noise=" in the macro).
> If the noise tolerance is too high, it reports only one maximum or a few.
> You can set the noise tolerance to 0, then it reports all maxima.
>
> Looking at your image, I have the impression that you should not use a
> noise tolerance of 0, you would get a lot of noise peaks.
>
> Michael
> ________________________________________________________________
> On Sep 20, 2012, at 11:20, Yaseen Ladak wrote:
>
> > Hi Nobert and all ,
> >
> > I have attached a screen shot image with this email of what i am trying
> to
> > achieve
> >
> > In image labelled as "Screen shot"  you can see I have drawn  an
> selection
> > box and I want to find the top 10 or 50 maximum intensity values. However
> > when I go to set measurements and select to give me maximum and mimimum
> it
> > just gives me 1 maximum and 1 minimum.
> >
> > This 1 maximum or minimum may be a hotspot. So I want to find 10 top most
> > or 50 top most maximum values in the selection box.
> >
> >
> > I can send the actual image if someone needs it?
> >
> > Many thanks.
> >
> > Best wishes,
> > Yaseen
> >
> > On 19 September 2012 22:09, Norbert Vischer <[hidden email]>
> wrote:
> >
> >> Hi Yaseen,
> >>> Can someone please help me for a  plugin or a way to give me top 10 or
> 50
> >>> or top x maximum intensity values in  selection area.
> >>
> >> Are you talking about distictly separated maxima?
> >> The output of the MaximumFinder is already sorted.
> >> Here is an example to find the 5 strongest dots (similar rank as the
> >> absolute max values).
> >>
> >> If you un-comment the "Measure" command, you'll get the output below.
> >> Strange enough, the Measure command destructively paints the pixels-
> >> Is this a bug?
> >>
> >>
> >> run("Clear Results");
> >> run("Close All");
> >> run("Dot Blot (7K)");
> >> run("Find Maxima...", "noise=20 output=[Point Selection] light");
> >> getSelectionCoordinates(xx, yy);
> >> xx = Array.trim(xx, 5);
> >> yy = Array.trim(yy, 5);
> >> makeSelection("point",xx, yy);
> >> run("Set Measurements...", " mean");
> >> //run("Measure");
> >>
> >>
> >> output:
> >> =======
> >>        Mean    X       Y
> >> 1       57      192     251
> >> 2       61      260     178
> >> 3       75      119     255
> >> 4       88      119     184
> >> 5       95      193     182
> >>
> >>
> >> Norbert Vischer
> >> --
> >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >>
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> > <Screen shot.jpg>
>
> --
> 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: Finding top 10 or 50 etc maximum intensities in ROI

vischer
In reply to this post by Michael Schmid
Hi Yaseen,

below is a modified macro for nMaxima=10 and dark background.
It also makes measurement non-destructive by setting pointtool mark=0 (thanks, Wayne).
The output is the *single* pixel value of the maximum (i.e. mean min and max are the same)

On 20. Sep 2012, at 10:57, Yaseen Ladak wrote:

> In image labelled as "Screen shot"  you can see I have drawn  an selection box and I want to find the top 10 or 50 maximum intensity values. However when I go to set measurements and select to give me maximum and mimimum it just gives me 1 maximum and 1 minimum.
>


nMaxima = 10;
run("Point Tool...", "mark=0 label selection=blue");
run("Clear Results");
run("Find Maxima...", "noise=1 output=[Point Selection]");
getSelectionCoordinates(xx, yy);
xx = Array.trim(xx, nMaxima);
yy = Array.trim(yy, nMaxima);
makeSelection("point",xx, yy);
run("Set Measurements...", " mean");
run("Measure");


output:
========
        Mean X Y
1 464 236 162
2 452 235 164
3 442 209 183
4 439 219 184
5 437 211 168
6 435 220 166
7 430 218 163
8 428 203 184
9 427 218 179
10 425 226 167

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

Re: Finding top 10 or 50 etc maximum intensities in ROI

Yaseen Ladak
Hi Nobert,

It seems to work fine for now. Thank you so much.

@Michale: Thank you for your help.

This forum is excellent and all of you'll indeed you very helpful and kind
to a novice like me.


Kind regards,
Yaseen


On 20 September 2012 11:10, Norbert Vischer <[hidden email]> wrote:

> Hi Yaseen,
>
> below is a modified macro for nMaxima=10 and dark background.
> It also makes measurement non-destructive by setting pointtool mark=0
> (thanks, Wayne).
> The output is the *single* pixel value of the maximum (i.e. mean min and
> max are the same)
>
> On 20. Sep 2012, at 10:57, Yaseen Ladak wrote:
>
> > In image labelled as "Screen shot"  you can see I have drawn  an
> selection box and I want to find the top 10 or 50 maximum intensity values.
> However when I go to set measurements and select to give me maximum and
> mimimum it just gives me 1 maximum and 1 minimum.
> >
>
>
> nMaxima = 10;
> run("Point Tool...", "mark=0 label selection=blue");
> run("Clear Results");
> run("Find Maxima...", "noise=1 output=[Point Selection]");
> getSelectionCoordinates(xx, yy);
> xx = Array.trim(xx, nMaxima);
> yy = Array.trim(yy, nMaxima);
> makeSelection("point",xx, yy);
> run("Set Measurements...", " mean");
> run("Measure");
>
>
> output:
> ========
>         Mean    X       Y
> 1       464     236     162
> 2       452     235     164
> 3       442     209     183
> 4       439     219     184
> 5       437     211     168
> 6       435     220     166
> 7       430     218     163
> 8       428     203     184
> 9       427     218     179
> 10      425     226     167
>
> regards,
> Norbert Vischer
> --
> 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: Finding top 10 or 50 etc maximum intensities in ROI

Yaseen Ladak
Hi Nobert and others,

Apologies I have one more question:

Is it possible to have a button which can be pressed to run this macro.
Also can this macro be automatically be installed at start up?

If yes that would be perfect.

It works brilliantly for now and gives me the results I want.



On 20 September 2012 11:22, Yaseen Ladak <[hidden email]> wrote:

> Hi Nobert,
>
> It seems to work fine for now. Thank you so much.
>
> @Michale: Thank you for your help.
>
> This forum is excellent and all of you'll indeed you very helpful and kind
> to a novice like me.
>
>
> Kind regards,
> Yaseen
>
>
> On 20 September 2012 11:10, Norbert Vischer <[hidden email]>wrote:
>
>> Hi Yaseen,
>>
>> below is a modified macro for nMaxima=10 and dark background.
>> It also makes measurement non-destructive by setting pointtool mark=0
>> (thanks, Wayne).
>> The output is the *single* pixel value of the maximum (i.e. mean min and
>> max are the same)
>>
>> On 20. Sep 2012, at 10:57, Yaseen Ladak wrote:
>>
>> > In image labelled as "Screen shot"  you can see I have drawn  an
>> selection box and I want to find the top 10 or 50 maximum intensity values.
>> However when I go to set measurements and select to give me maximum and
>> mimimum it just gives me 1 maximum and 1 minimum.
>> >
>>
>>
>> nMaxima = 10;
>> run("Point Tool...", "mark=0 label selection=blue");
>> run("Clear Results");
>> run("Find Maxima...", "noise=1 output=[Point Selection]");
>> getSelectionCoordinates(xx, yy);
>> xx = Array.trim(xx, nMaxima);
>> yy = Array.trim(yy, nMaxima);
>> makeSelection("point",xx, yy);
>> run("Set Measurements...", " mean");
>> run("Measure");
>>
>>
>> output:
>> ========
>>         Mean    X       Y
>> 1       464     236     162
>> 2       452     235     164
>> 3       442     209     183
>> 4       439     219     184
>> 5       437     211     168
>> 6       435     220     166
>> 7       430     218     163
>> 8       428     203     184
>> 9       427     218     179
>> 10      425     226     167
>>
>> regards,
>> Norbert Vischer
>> --
>> 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: Finding top 10 or 50 etc maximum intensities in ROI

Yaseen Ladak
In reply to this post by vischer
Hi Nobert and others,

Apologies I have sent a lot of emails to this forum just incase if someone
people feel disturbed. I am just trying to get used and learn Image J

I managed to make a button and edited the StartupMacros.txt file and now it
loads up every time I start Image J.

However, is it possible to amend the macro to further give mean an
additional column with the *average of these top 10 maximum intensity *

Thank you in advance.

Kind regards,
Yaseen





On 20 September 2012 11:00, Norbert Vischer <[hidden email]> wrote:

> Hi Yaseen,
>
> below is a modified macro for nMaxima=10 and dark background.
> It also makes measurement non-destructive by setting pointtool mark=0
> (thanks, Wayne).
> The output is the *single* pixel value of the maximum (i.e. mean min and
> max are the same)
>
> On 20. Sep 2012, at 10:57, Yaseen Ladak wrote:
>
> > In image labelled as "Screen shot"  you can see I have drawn  an
> selection box and I want to find the top 10 or 50 maximum intensity values.
> However when I go to set measurements and select to give me maximum and
> mimimum it just gives me 1 maximum and 1 minimum.
> >
>
>
> nMaxima = 10;
> run("Point Tool...", "mark=0 label selection=blue");
> run("Clear Results");
> run("Find Maxima...", "noise=1 output=[Point Selection]");
> getSelectionCoordinates(xx, yy);
> xx = Array.trim(xx, nMaxima);
> yy = Array.trim(yy, nMaxima);
> makeSelection("point",xx, yy);
> run("Set Measurements...", " mean");
> run("Measure");
>
>
> output:
> ========
>         Mean    X       Y
> 1       464     236     162
> 2       452     235     164
> 3       442     209     183
> 4       439     219     184
> 5       437     211     168
> 6       435     220     166
> 7       430     218     163
> 8       428     203     184
> 9       427     218     179
> 10      425     226     167
>
> regards,
> Norbert Vischer

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