Small question: how to hide the ResultsTable?

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

Small question: how to hide the ResultsTable?

verified.human
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Small question: how to hide the ResultsTable?

Rasband, Wayne (NIH/NIMH) [E]
On Nov 12, 2011, at 12:33 AM, Wayne Rasband wrote:

> Hello all,
>
> I have just a quick question. For my project I am using the MaximumFinder
> class in combination with a ResultsTable.
> Now everytime I use the MaximumFinder.findMaxima() method, a results table
> pops up. Is there a way to hide this table, but still use the statistics
> from it?
>
> Code: http://pastebin.com/TkaMfYRh
>
> Thanks in advance for the solution!
>
> Tom

The ImageJ 1.46a daily build adds a MaximumFinder.getMaxima() method that returns the image maxima as a Polygon. Here is a JavaScript example:

  tolerance = 50;
  excludeOnEdges = false;
  imp = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif");
  ip = imp.getProcessor();
  mf = new MaximumFinder();
  maxima = mf.getMaxima(ip, tolerance, excludeOnEdges);
  print("count="+maxima.npoints);

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: Small question: how to hide the ResultsTable?

verified.human
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Small question: how to hide the ResultsTable?

lechristophe
In reply to this post by Rasband, Wayne (NIH/NIMH) [E]
Hi Wayne,

Would it by any chance be possible to take advantage of the new sub-pixel ROIs by adding an option to the Find Maxima function, so that maxima are detected with sub-pixels resolution? In my test IJ 1.46a Find Maxima finds whole-pixels maxima, but maybe it is already possible?

Thanks,

Christophe  


Le samedi 12 novembre 2011 à 06:41, Rasband, Wayne (NIH/NIMH) [E] a écrit :

> On Nov 12, 2011, at 12:33 AM, Wayne Rasband wrote:
>  
> > Hello all,  
> >  
> > I have just a quick question. For my project I am using the MaximumFinder  
> > class in combination with a ResultsTable.  
> > Now everytime I use the MaximumFinder.findMaxima() method, a results table  
> > pops up. Is there a way to hide this table, but still use the statistics  
> > from it?  
> >  
> > Code: http://pastebin.com/TkaMfYRh
> >  
> > Thanks in advance for the solution!  
> >  
> > Tom  
>  
> The ImageJ 1.46a daily build adds a MaximumFinder.getMaxima() method that returns the image maxima as a Polygon. Here is a JavaScript example:
>  
> tolerance = 50;  
> excludeOnEdges = false;
> imp = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif");
> ip = imp.getProcessor();
> mf = new MaximumFinder();
> maxima = mf.getMaxima(ip, tolerance, excludeOnEdges);
> print("count="+maxima.npoints);
>  
> -wayne  
Reply | Threaded
Open this post in threaded view
|

Find Maxima subpixel resolution (was: Re: Small question: how to hide the ResultsTable?)

Michael Schmid
Hi Christophe,

what is your idea about subpixel resolution for 'Find maxima'?

(1) Currently, if the maximum is a single pixel, 'Find maxima' simply  
reports the position of that pixel.
One could, in principle, fit a 2nd-order polynomial through the 3x3  
pixels around the maximum and report the position of that maximum,  
but this would not be a good solution.  Imagine the maximum being a  
narrow ridge passing at an angle between two pixels, but the pixels  
next to the maximum are on the steep slopes at the sides of the  
ridge.  Then, the pixel with the true maximum value would be where  
the ridge happens to meet a pixel center.  This could be quite far  
from the interpolated 'true' maximum.
In other words, this would mean that 'Find maxima' could report  
positions rather far from that of the brightest pixel, which is not  
desirable.

I have implemented such a 3x3 interpolation in my 'Feature Finder'  
pattern matching plugin; if the maximum of the (3x3) neighborhood is  
offset by more than 1/2 a pixel I examine the fit to the adjacent  
(3x3) neighborhood in that direction, until I find the (3x3) area  
where the interpolated polynomial gives the highest maximum (or  
actually lowest minimum, because I search for minima there).  There  
it works because the extrema are guaranteed to be nice smooth  
functions, not arbitrary image data.  Also, it turned out necessary  
to interpolate not the values but some nonlinear function of the  
pixel values for best results. For an arbitrary image, it would be  
unknown whether one should interpolate the pixel values, log of the  
pixel (which would work with positive values only) values, or some  
other function.

(2) If there are several pixels of equal value within one maximum,  
'Find maxima' reports the pixel closest to the geometric center that  
is among these maximum pixels.  The geometric center (which might be  
reported with subpixel accuracy) may be outside a maximum pixel, even  
far from the particle (e.g. consider a crescent-shaped particle).  I  
consider it important, however, that 'Find maxima' always gives  
positions that are really maximum pixels.

To summarize, currently I see no good concept for subpixel resolution  
in 'Find Maxima'.
If I need better resolution, I usually enlarge the image with bicubic  
interpolation - but of course, this is an option for rather small  
images only.

Michael
________________________________________________________________

On 16 Nov 2011, at 10:16, Christophe Leterrier wrote:

> Hi Wayne,
>
> Would it by any chance be possible to take advantage of the new sub-
> pixel ROIs by adding an option to the Find Maxima function, so that  
> maxima are detected with sub-pixels resolution? In my test IJ 1.46a  
> Find Maxima finds whole-pixels maxima, but maybe it is already  
> possible?
>
> Thanks,
>
> Christophe
>
>
> Le samedi 12 novembre 2011 à 06:41, Rasband, Wayne (NIH/NIMH) [E] a  
> écrit :
>
>> On Nov 12, 2011, at 12:33 AM, Wayne Rasband wrote:
>>
>>> Hello all,
>>>
>>> I have just a quick question. For my project I am using the  
>>> MaximumFinder
>>> class in combination with a ResultsTable.
>>> Now everytime I use the MaximumFinder.findMaxima() method, a  
>>> results table
>>> pops up. Is there a way to hide this table, but still use the  
>>> statistics
>>> from it?
>>>
>>> Code: http://pastebin.com/TkaMfYRh
>>>
>>> Thanks in advance for the solution!
>>>
>>> Tom
>>
>> The ImageJ 1.46a daily build adds a MaximumFinder.getMaxima()  
>> method that returns the image maxima as a Polygon. Here is a  
>> JavaScript example:
>>
>> tolerance = 50;
>> excludeOnEdges = false;
>> imp = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif");
>> ip = imp.getProcessor();
>> mf = new MaximumFinder();
>> maxima = mf.getMaxima(ip, tolerance, excludeOnEdges);
>> print("count="+maxima.npoints);
>>
>> -wayne
Reply | Threaded
Open this post in threaded view
|

Re: Find Maxima subpixel resolution (was: Re: Small question: how to hide the ResultsTable?)

lechristophe
Hi Michael,

You're right that I didn't think this through, because I was only considering detecting punctate objects (such as sub-resolution beads). I totally agree that it is not straightforward to define what a good "subpixel" maximum detection is for arbitrary images. I'll definitely have a look at your "Feature Finder" plugin and see if I can use it for small, punctate objects.

Thanks for your reply and detailled explanations,

Christophe  


Le jeudi 17 novembre 2011 à 10:04, Michael Schmid a écrit :

> Hi Christophe,
>  
> what is your idea about subpixel resolution for 'Find maxima'?
>  
> (1) Currently, if the maximum is a single pixel, 'Find maxima' simply  
> reports the position of that pixel.
> One could, in principle, fit a 2nd-order polynomial through the 3x3  
> pixels around the maximum and report the position of that maximum,  
> but this would not be a good solution. Imagine the maximum being a  
> narrow ridge passing at an angle between two pixels, but the pixels  
> next to the maximum are on the steep slopes at the sides of the  
> ridge. Then, the pixel with the true maximum value would be where  
> the ridge happens to meet a pixel center. This could be quite far  
> from the interpolated 'true' maximum.
> In other words, this would mean that 'Find maxima' could report  
> positions rather far from that of the brightest pixel, which is not  
> desirable.
>  
> I have implemented such a 3x3 interpolation in my 'Feature Finder'  
> pattern matching plugin; if the maximum of the (3x3) neighborhood is  
> offset by more than 1/2 a pixel I examine the fit to the adjacent  
> (3x3) neighborhood in that direction, until I find the (3x3) area  
> where the interpolated polynomial gives the highest maximum (or  
> actually lowest minimum, because I search for minima there). There  
> it works because the extrema are guaranteed to be nice smooth  
> functions, not arbitrary image data. Also, it turned out necessary  
> to interpolate not the values but some nonlinear function of the  
> pixel values for best results. For an arbitrary image, it would be  
> unknown whether one should interpolate the pixel values, log of the  
> pixel (which would work with positive values only) values, or some  
> other function.
>  
> (2) If there are several pixels of equal value within one maximum,  
> 'Find maxima' reports the pixel closest to the geometric center that  
> is among these maximum pixels. The geometric center (which might be  
> reported with subpixel accuracy) may be outside a maximum pixel, even  
> far from the particle (e.g. consider a crescent-shaped particle). I  
> consider it important, however, that 'Find maxima' always gives  
> positions that are really maximum pixels.
>  
> To summarize, currently I see no good concept for subpixel resolution  
> in 'Find Maxima'.
> If I need better resolution, I usually enlarge the image with bicubic  
> interpolation - but of course, this is an option for rather small  
> images only.
>  
> Michael
> ________________________________________________________________
>  
> On 16 Nov 2011, at 10:16, Christophe Leterrier wrote:
>  
> > Hi Wayne,
> >  
> > Would it by any chance be possible to take advantage of the new sub-  
> > pixel ROIs by adding an option to the Find Maxima function, so that  
> > maxima are detected with sub-pixels resolution? In my test IJ 1.46a  
> > Find Maxima finds whole-pixels maxima, but maybe it is already  
> > possible?
> >  
> > Thanks,
> >  
> > Christophe
> >  
> >  
> > Le samedi 12 novembre 2011 à 06:41, Rasband, Wayne (NIH/NIMH) [E] a  
> > écrit :
> >  
> > > On Nov 12, 2011, at 12:33 AM, Wayne Rasband wrote:
> > >  
> > > > Hello all,
> > > >  
> > > > I have just a quick question. For my project I am using the  
> > > > MaximumFinder
> > > > class in combination with a ResultsTable.
> > > > Now everytime I use the MaximumFinder.findMaxima() method, a  
> > > > results table
> > > > pops up. Is there a way to hide this table, but still use the  
> > > > statistics
> > > > from it?
> > > >  
> > > > Code: http://pastebin.com/TkaMfYRh
> > > >  
> > > > Thanks in advance for the solution!
> > > >  
> > > > Tom
> > >  
> > > The ImageJ 1.46a daily build adds a MaximumFinder.getMaxima()  
> > > method that returns the image maxima as a Polygon. Here is a  
> > > JavaScript example:
> > >  
> > > tolerance = 50;
> > > excludeOnEdges = false;
> > > imp = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif");
> > > ip = imp.getProcessor();
> > > mf = new MaximumFinder();
> > > maxima = mf.getMaxima(ip, tolerance, excludeOnEdges);
> > > print("count="+maxima.npoints);
> > >  
> > > -wayne