Fixing the bug of MaximumFinder

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

Fixing the bug of MaximumFinder

grimper
Hello all,

I am writing a plugin and I want to use the findMaxima method in class MaximumFinder. However when the method finMaxima was called with outputType equaled List or Count. There was nothing appeared on the result table.
Here is a example code:

public class demo_findmax implements PlugIn {

        public void run(String arg) {
                ByteProcessor bp = new ByteProcessor(10,10);
                bp.putPixel(3, 4, 255);
                bp.putPixel(7, 8, 255);
                new ImagePlus("test", bp).show();
               
                MaximumFinder fd=new MaximumFinder();
                       
                ByteProcessor fdB = fd.findMaxima(bp, 50, ImageProcessor.NO_THRESHOLD, 4, false, false);
               
        }

}

So I tried to look into the source code of MaximumFinder.java and did some modification to fix the problem. I am wondering if this modified MaximumFinder would be usable for the future ImageJ build.
If so how should I do it ? Should I post the code here or upload it to somewhere ?

Cheers,

Zong
Reply | Threaded
Open this post in threaded view
|

Re: Fixing the bug of MaximumFinder

Nico Stuurman-4
> I am writing a plugin and I want to use the findMaxima method in class
> MaximumFinder. However when the method finMaxima was called with outputType
> equaled List or Count. There was nothing appeared on the result table.

I just run into the same problem.  Not sure why this happens as the MaximumFinder tries to get hold of the ResultsTable through the static method

                ResultsTable rt = ResultsTable.getResultsTable();

which calls the static method

                Analyzer.getResultsTable();


However, as a  work around, you can run the MaximumFinder as follows:

                IJ.run("Find Maxima...", "noise=50 output=List");


> Here is a example code:
>
> public class demo_findmax implements PlugIn {
>
> public void run(String arg) {
> ByteProcessor bp = new ByteProcessor(10,10);
> bp.putPixel(3, 4, 255);
> bp.putPixel(7, 8, 255);
> new ImagePlus("test", bp).show();
>
> MaximumFinder fd=new MaximumFinder();
>
>               ByteProcessor fdB = fd.findMaxima(bp, 50,
> ImageProcessor.NO_THRESHOLD, 4, false, false);
>
> }
>
> }
>
> So I tried to look into the source code of MaximumFinder.java and did some
> modification to fix the problem. I am wondering if this modified
> MaximumFinder would be usable for the future ImageJ build.
> If so how should I do it ? Should I post the code here or upload it to
> somewhere ?

Curious what you found.  Can you post the relevant snippets?

Best,

Nico
Reply | Threaded
Open this post in threaded view
|

Re: Fixing the bug of MaximumFinder

Rasband, Wayne (NIH/NIMH) [E]
On Sep 8, 2010, at 8:33 PM, Nico Stuurman wrote:

>> I am writing a plugin and I want to use the findMaxima method in class
>> MaximumFinder. However when the method finMaxima was called with outputType
>> equaled List or Count. There was nothing appeared on the result table.
>
> I just run into the same problem.  Not sure why this happens as the MaximumFinder tries to get hold of the ResultsTable through the static method
>
> ResultsTable rt = ResultsTable.getResultsTable();
>
> which calls the static method
>
> Analyzer.getResultsTable();
>
>
> However, as a  work around, you can run the MaximumFinder as follows:
>
> IJ.run("Find Maxima...", "noise=50 output=List");
>
>
>> Here is a example code:
>>
>> public class demo_findmax implements PlugIn {
>>
>> public void run(String arg) {
>> ByteProcessor bp = new ByteProcessor(10,10);
>> bp.putPixel(3, 4, 255);
>> bp.putPixel(7, 8, 255);
>> new ImagePlus("test", bp).show();
>>
>> MaximumFinder fd=new MaximumFinder();
>>
>>              ByteProcessor fdB = fd.findMaxima(bp, 50,
>> ImageProcessor.NO_THRESHOLD, 4, false, false);
>>
>> }
>>
>> }
>>
>> So I tried to look into the source code of MaximumFinder.java and did some
>> modification to fix the problem. I am wondering if this modified
>> MaximumFinder would be usable for the future ImageJ build.
>> If so how should I do it ? Should I post the code here or upload it to
>> somewhere ?
>
> Curious what you found.  Can you post the relevant snippets?

This bug fix is in the v1.44g9 daily build. You can view the changes on the Git repository at

     http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=imagej.git

-wayne