Filters Public API

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

Filters Public API

kostas-2
Hello,
we are trying to embed imagej to our application, but most of the filters don't have a public api that can be used outside imagej. The only way to access them is only through IJ.run("Filter....", "args"), having to set the current image everytime. The latter is also dangerous in a multithreaded environment.
If there is another way to apply a filter to a speceific image please let me know.

I could make the methods public myself, but I would like to ask if it will be in the main distribution.

Thanx in advance

Kostas
Reply | Threaded
Open this post in threaded view
|

Re: Filters Public API

Christian Moll
>If there is another way to apply a filter to a speceific image please let
me
>know.

You should take a look to the RankFilter, GaussianBlur and Convolver
Classes.

Greetings

Christian Moll



-----------------------------------------------------------------
Christian Moll  -  Ingenieur de Recherche
[hidden email]
-----------------------------------------------------------------
CRP Henri Tudor  -  http://santec.tudor.lu
2A, rue Kalchesbrück
L-1852 Luxembourg
-----------------------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Filters Public API

kostas-2
Yes these filters have public api, but others like FFTFilter do not. Also others in the ij.plugins.filter package do not. Is this because the functionality is somewhere else? Excuse me, but I am new to imagej.

Best regards,
Kostas


Christian Moll wrote
>If there is another way to apply a filter to a speceific image please let
me
>know.

You should take a look to the RankFilter, GaussianBlur and Convolver
Classes.

Greetings

Christian Moll



-----------------------------------------------------------------
Christian Moll  -  Ingenieur de Recherche
christian.moll@tudor.lu
-----------------------------------------------------------------
CRP Henri Tudor  -  http://santec.tudor.lu
2A, rue Kalchesbrück
L-1852 Luxembourg
-----------------------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

Volocity software question?

Liu, Dongfang (NIH/NIAID) [F]
Dear Friends,

I am curious about the price of Volocity software in NIH. Do you guys use Volocity software in NIH? People told me you can get a specific discount when you buy second Volocity or recommend other group to buy Volocity. Is that true? I am wondering whether lab is using Volocity software and gives us some suggestions.

Thank you very much!

Best regards,
Dongfang


 
Reply | Threaded
Open this post in threaded view
|

Re: Filters Public API

Sami Badawi-2
In reply to this post by kostas-2
Hi Kostas,

This is how I run unit tests for plugins that I have written in
ImageJ, without starting the GUI. I run them either from Eclipse,
NetBeans or from command line using Maven.

public ImageProcessor runPluginFilterOnImage(String fileName,
PlugInFilter plugInFilter, String arg) {
        Opener opener = new Opener();
        ImagePlus image = opener.openImage(fileName);
        ImageProcessor ip = image.getProcessor();
        plugInFilter.setup(arg, image);
        plugInFilter.run(ip);
        return ip;
}

This works if you have written the PlugInFilter. If you want to use
this method for other people's PlugInFilter, what ImageJ is doing is
just have the class loader load the PlugInFilter, by class name. You
can do the same.
PlugInFilter pif = (PlugInFilter) Class.forName("PlugInFilterName").
This should give you better thread safety.
It will only work with plugins that do not have a GUI part, so it
would not work FFTFilter, which has an input dialog.

-Sami Badawi
http://www.shapelogic.org
Reply | Threaded
Open this post in threaded view
|

PLug In Development support

Wayne Brown-3
We recently posted a question to the list:  Would embedded camera support be
desirable?  The response we got was an overwhelming YES.  We are seeking a
developer who could assist us on a consulting basis in developing an ImageJ
plug in for support of Apogee cameras.  If you or anyone you could recommend
help up with this, please contact me off list at [hidden email].

Regards,

Wayne Brown
Apogee Instruments Inc
www.ccd.com
Reply | Threaded
Open this post in threaded view
|

Antwort: PLug In Development support

Joachim Wesner
Hi Wayne,

I´m not sure how "embedded" the support is you are planning, I think the
best option
would be no to specifically aim towards ImageJ but get in contact with the
Micromanager people who are working on a general Java (and later also
Python/Matlab) API for camera interfacing (but with ImageJ as the prime
app)

I´m personally planning/working on integrating Matrox MIL into Micromanager
which
would mean that a variety of analog/Firewire or Cameralink cameras should
work with
ImageJ (and other Java aps).

Joachim

ImageJ Interest Group <[hidden email]> schrieb am 13.06.2008 09:24:55:

> We recently posted a question to the list:  Would embedded camera support
be
> desirable?  The response we got was an overwhelming YES.  We are seeking
a
> developer who could assist us on a consulting basis in developing an
ImageJ
> plug in for support of Apogee cameras.  If you or anyone you could
recommend
> help up with this, please contact me off list at [hidden email].
>
> Regards,
>
> Wayne Brown
> Apogee Instruments Inc
> www.ccd.com


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Filters Public API

kostas-2
In reply to this post by Sami Badawi-2
Hello,
A ok.
However I don't see a reason for this methods to be private, except if it is the willing of the author

Best Regards,
Kostas

Sami Badawi-2 wrote
Hi Kostas,

This is how I run unit tests for plugins that I have written in
ImageJ, without starting the GUI. I run them either from Eclipse,
NetBeans or from command line using Maven.

public ImageProcessor runPluginFilterOnImage(String fileName,
PlugInFilter plugInFilter, String arg) {
        Opener opener = new Opener();
        ImagePlus image = opener.openImage(fileName);
        ImageProcessor ip = image.getProcessor();
        plugInFilter.setup(arg, image);
        plugInFilter.run(ip);
        return ip;
}

This works if you have written the PlugInFilter. If you want to use
this method for other people's PlugInFilter, what ImageJ is doing is
just have the class loader load the PlugInFilter, by class name. You
can do the same.
PlugInFilter pif = (PlugInFilter) Class.forName("PlugInFilterName").
This should give you better thread safety.
It will only work with plugins that do not have a GUI part, so it
would not work FFTFilter, which has an input dialog.

-Sami Badawi
http://www.shapelogic.org
Reply | Threaded
Open this post in threaded view
|

Re: Filters Public API

Sami Badawi-2
Hi again Kostas,

Since ImageJ is open source you can take the source code for ImageJ
and go in and change the access modifiers for the methods you want to
be public. Then repackage it to a ij.jar file, and use that instead.

-Sami Badawi
http://www.shapelogic.org
Reply | Threaded
Open this post in threaded view
|

Re: Filters Public API

kostas-2
Hello Sami,
Would imagej team be interested in such changes?

Best regards

Sami Badawi-2 wrote
Hi again Kostas,

Since ImageJ is open source you can take the source code for ImageJ
and go in and change the access modifiers for the methods you want to
be public. Then repackage it to a ij.jar file, and use that instead.

-Sami Badawi
http://www.shapelogic.org
Reply | Threaded
Open this post in threaded view
|

Re: Filters Public API

Wayne Rasband
In reply to this post by kostas-2
> Hello,
> we are trying to embed imagej to our application, but most of the  
> filters
> don't have a public api that can be used outside imagej. The only  
> way to
> access them is only through IJ.run("Filter....", "args"), having to  
> set the
> current image everytime. The latter is also dangerous in a  
> multithreaded
> environment.
> If there is another way to apply a filter to a speceific image  
> please let me
> know.
>
> I could make the methods public myself, but I would like to ask if  
> it will
> be in the main distribution.

The 1.41f daily build adds versions of the IJ.run(), IJ.save() and  
IJ.saveAs() that take an ImagePlus as the first argument. This  
example uses these new methods to open an image, process it, save it,  
then reopen and display the processed image:

    if (IJ.getVersion()<"1.41f")
        IJ.error("This script requires v1.41f or later");
    dir = IJ.getDirectory("home");
    img = IJ.openImage(dir+"test.jpg");
    IJ.run(img, "Unsharp Mask...", "radius=3 mask=0.6");
    IJ.run(img, "Flip Horizontally");
    IJ.run(img, "8-bit Color", "number=256");
    IJ.save(img, dir+"test.png");
    img = IJ.openImage(dir+"test.png");
    img.show();

You can run this example by pasting it into a text window and  
pressing ctrl-j (Macros>Evaluate JavaScript).

ImageJ uses a hash table with thread objects as keys and option  
strings as values to make the passing of the run() options thread  
safe, a technique suggested by Albert Cardona.

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

Re: Filters Public API

kostas-2
That's very good. I'll try it.
Thanx a lot

Rasband Wayne wrote
The 1.41f daily build adds versions of the IJ.run(), IJ.save() and  
IJ.saveAs() that take an ImagePlus as the first argument. This  
example uses these new methods to open an image, process it, save it,  
then reopen and display the processed image:

    if (IJ.getVersion()<"1.41f")
        IJ.error("This script requires v1.41f or later");
    dir = IJ.getDirectory("home");
    img = IJ.openImage(dir+"test.jpg");
    IJ.run(img, "Unsharp Mask...", "radius=3 mask=0.6");
    IJ.run(img, "Flip Horizontally");
    IJ.run(img, "8-bit Color", "number=256");
    IJ.save(img, dir+"test.png");
    img = IJ.openImage(dir+"test.png");
    img.show();

You can run this example by pasting it into a text window and  
pressing ctrl-j (Macros>Evaluate JavaScript).

ImageJ uses a hash table with thread objects as keys and option  
strings as values to make the passing of the run() options thread  
safe, a technique suggested by Albert Cardona.

-wayne