Difference between ImageJ plugin and Micromanager Plugin - How the Java code and libraries differ

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Difference between ImageJ plugin and Micromanager Plugin - How the Java code and libraries differ

SaralaT

Hi All,


I am just trying to investigate if I can simply put a Java plugin written in ImageJ into the MMPlugins folder on MM 1.4, and then run it on Micromanager (being that both the ImageJ and Micromanager run on same Java version). But how ever, I find that my simple Helloworld program which works on ImageJ, does not seem to work on the Micromanager. 


The Plugin uses the following imports;

import ij.plugin.PlugIn;
import ij.IJ;

In micromanager is it not possible to use these imports? Is the structure of the program going to change for the MM version? I used the following imports for a Helloworld version which runs on Micromanager. In this the methods and libraries used is quite different from that of the ImageJ version;

package org.micromanager.helloworld;
import javax.swing.JOptionPane;
import mmcorej.CMMCore;
import org.micromanager.api.MMPlugin;
import org.micromanager.api.ScriptInterface;

Basically I am trying to understand which classes and libraries I am allowed to use if I am to write plugin on Micromanager, as opposed to that of when I write plugin on ImageJ. Can I still use import ij.plugin.PlugIn; and import ij.IJ; ??


Would be great if some one could shed some light!


Thanks a lot!



Best Regards,

Sarala


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Difference between ImageJ plugin and Micromanager Plugin - How the Java code and libraries differ

SaralaT

Hi All,


Furthering my previous email, The following is the plugin for Helloworld which works fine on ImageJ. How would I convert this to suite Micromanager? Just trying to understand the concept by a simple example. Thanks a lot!! 


import ij.plugin.PlugIn;
import ij.IJ;


public class a_helloworld implements PlugIn{

public void run(String arg) {
// This plugin just prints out the "Hello World!" message
IJ.showMessage("Hello World!");
}

}



Best Regards,

Sarala


From: Sarala Neomi Tantirimudalige
Sent: Tuesday, October 3, 2017 10:17:07 AM
To: [hidden email]
Subject: Difference between ImageJ plugin and Micromanager Plugin - How the Java code and libraries differ
 

Hi All,


I am just trying to investigate if I can simply put a Java plugin written in ImageJ into the MMPlugins folder on MM 1.4, and then run it on Micromanager (being that both the ImageJ and Micromanager run on same Java version). But how ever, I find that my simple Helloworld program which works on ImageJ, does not seem to work on the Micromanager. 


The Plugin uses the following imports;

import ij.plugin.PlugIn;
import ij.IJ;

In micromanager is it not possible to use these imports? Is the structure of the program going to change for the MM version? I used the following imports for a Helloworld version which runs on Micromanager. In this the methods and libraries used is quite different from that of the ImageJ version;

package org.micromanager.helloworld;
import javax.swing.JOptionPane;
import mmcorej.CMMCore;
import org.micromanager.api.MMPlugin;
import org.micromanager.api.ScriptInterface;

Basically I am trying to understand which classes and libraries I am allowed to use if I am to write plugin on Micromanager, as opposed to that of when I write plugin on ImageJ. Can I still use import ij.plugin.PlugIn; and import ij.IJ; ??


Would be great if some one could shed some light!


Thanks a lot!



Best Regards,

Sarala


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Difference between ImageJ plugin and Micromanager Plugin - How the Java code and libraries differ

Nico Stuurman-2
In reply to this post by SaralaT
Hi Sarala,

On 10/2/2017 7:17 PM, Sarala Neomi Tantirimudalige wrote:
I am just trying to investigate if I can simply put a Java plugin written in ImageJ into the MMPlugins folder on MM 1.4, and then run it on Micromanager (being that both the ImageJ and Micromanager run on same Java version). But how ever, I find that my simple Helloworld program which works on ImageJ, does not seem to work on the Micromanager. 

Look at https://micro-manager.org/wiki/Writing_plugins_for_Micro-Manager.  Note that you have to implement the MMPlugin interface.  The source code to an example plugin can be found here: https://valelab4.ucsf.edu/svn/micromanager2/trunk/plugins/Example/src/

Best,

Nico



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Difference between ImageJ plugin and Micromanager Plugin - How the Java code and libraries differ

SaralaT
In reply to this post by SaralaT

Hi Nico,


I am a bit hazy as to how I can do this MMPlugin interface. Could you please help me by showing me how to convert the simple Helloworld plugin I have sent in my previous email, into a MMPlugin? By using the MMPlugin interface? I am so sorry for being so knowledgeable regarding the matter! 


My first guess was to do as below But this actually compiles on netbeans. But once I paste it inside the mmplugin folder in MM 1.4, though I see the plugin on the plugin dropdown list, when i click it, nothing happens. Would be great if you could point out what I am doing wrong here! I'm quite lost!;


package HelloWorldTW;

//import ij.plugin.PlugIn;
import ij.IJ;
import org.micromanager.api.MMPlugin;
import org.micromanager.api.ScriptInterface;

public class HelloWorldTW implements MMPlugin{

public void run(String arg) {
// This plugin just prints out the "Hello World!" message
IJ.showMessage("Hello World TW!");
}

    @Override
    public void dispose() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void setApp(ScriptInterface si) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void show() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public String getDescription() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public String getInfo() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public String getVersion() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public String getCopyright() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
}



  

Thanks a whole load in advance! 




Best Regards,

Sarala












On 10/2/2017 7:17 PM, Sarala Neomi Tantirimudalige wrote:
I am just trying to investigate if I can simply put a Java plugin written in ImageJ into the MMPlugins folder on MM 1.4, and then run it on Micromanager (being that both the ImageJ and Micromanager run on same Java version). But how ever, I find that my simple Helloworld program which works on ImageJ, does not seem to work on the Micromanager. 

Look at https://micro-manager.org/wiki/Writing_plugins_for_Micro-Manager.  Note that you have to implement the MMPlugin interface.  The source code to an example plugin can be found here: https://valelab4.ucsf.edu/svn/micromanager2/trunk/plugins/Example/src/

Best,

Nico


From: Sarala Neomi Tantirimudalige
Sent: Tuesday, October 3, 2017 10:17:07 AM
To: [hidden email]
Subject: Difference between ImageJ plugin and Micromanager Plugin - How the Java code and libraries differ
 

Hi All,


I am just trying to investigate if I can simply put a Java plugin written in ImageJ into the MMPlugins folder on MM 1.4, and then run it on Micromanager (being that both the ImageJ and Micromanager run on same Java version). But how ever, I find that my simple Helloworld program which works on ImageJ, does not seem to work on the Micromanager. 


The Plugin uses the following imports;

import ij.plugin.PlugIn;
import ij.IJ;

In micromanager is it not possible to use these imports? Is the structure of the program going to change for the MM version? I used the following imports for a Helloworld version which runs on Micromanager. In this the methods and libraries used is quite different from that of the ImageJ version;

package org.micromanager.helloworld;
import javax.swing.JOptionPane;
import mmcorej.CMMCore;
import org.micromanager.api.MMPlugin;
import org.micromanager.api.ScriptInterface;

Basically I am trying to understand which classes and libraries I am allowed to use if I am to write plugin on Micromanager, as opposed to that of when I write plugin on ImageJ. Can I still use import ij.plugin.PlugIn; and import ij.IJ; ??


Would be great if some one could shed some light!


Thanks a lot!



Best Regards,

Sarala


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Difference between ImageJ plugin and Micromanager Plugin - How the Java code and libraries differ

Nico Stuurman-2
In reply to this post by SaralaT
Just to summarize this thread:

From: Nico Stuurman [hidden email]


On 10/2/17 10:34 PM, Sarala Neomi Tantirimudalige wrote:
>
> Hi Nico,
>
>
> I am a bit hazy as to how I can do this MMPlugin interface. Could you
> please help me by showing me how to convert the simple Helloworld
> plugin I have sent in my previous email, into a MMPlugin? By using
> the MMPlugin interface? I am so sorry for being so knowledgeable
> regarding the matter!
>
>
> My first guess was to do as below But this actually compiles on
> netbeans. But once I paste it inside the mmplugin folder in MM 1.4,
> though I see the plugin on the plugin dropdown list, when i click it,
> nothing happens. Would be great if you could point out what I am doing
> wrong here! I'm quite lost!;
>

When you select your plugin in the plugin menu, your plugin's "setApp" 
function is called, so put whatever you would like to be done in that
function.  Note that it gives you the ScriptInterface, which gives you
access to MMCore as well.  There is no need for a "fun" function.  There
are many, many examples in the repository, so look at those for inspiration.

Best,

Nico

From: Sarala Neomi Tantirimudalige [hidden email]
To: Nico Stuurman [hidden email]


Hi Nico,


Thanks a whole load for the reply! Now I got the program to function! 


Thanks!


Best Regards,

Sarala


>
> package HelloWorldTW;
>
> //import ij.plugin.PlugIn;
> import ij.IJ;
> import org.micromanager.api.MMPlugin;
> import org.micromanager.api.ScriptInterface;
>
> public class HelloWorldTW implements MMPlugin{
>
> public void run(String arg) {
> // This plugin just prints out the "Hello World!" message
> IJ.showMessage("Hello World TW!");
> }
>
>     @Override
>     public void dispose() {
>         throw new UnsupportedOperationException("Not supported yet.");
> //To change body of generated methods, choose Tools | Templates.
>     }
>
>     @Override
>     public void setApp(ScriptInterface si) {
>         throw new UnsupportedOperationException("Not supported yet.");
> //To change body of generated methods, choose Tools | Templates.
>     }
>
>     @Override
>     public void show() {
>         throw new UnsupportedOperationException("Not supported yet.");
> //To change body of generated methods, choose Tools | Templates.
>     }
>
>     @Override
>     public String getDescription() {
>         throw new UnsupportedOperationException("Not supported yet.");
> //To change body of generated methods, choose Tools | Templates.
>     }
>
>     @Override
>     public String getInfo() {
>         throw new UnsupportedOperationException("Not supported yet.");
> //To change body of generated methods, choose Tools | Templates.
>     }
>
>     @Override
>     public String getVersion() {
>         throw new UnsupportedOperationException("Not supported yet.");
> //To change body of generated methods, choose Tools | Templates.
>     }
>
>     @Override
>     public String getCopyright() {
>         throw new UnsupportedOperationException("Not supported yet.");
> //To change body of generated methods, choose Tools | Templates.
>     }
> }
>
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general