Page 1 of 2

Omero ImageJ Plugin source code

PostPosted: Tue Feb 11, 2014 10:04 am
by FiReTiTi
Hi,
I would like the Omero ImageJ Plugin (OMERO.insight-ij-4.4.10-ice35-b112.zip) source code in order to develop a small and quick client.
Where can I find it?
Regards,

Re: Omero ImageJ Plugin source code

PostPosted: Tue Feb 11, 2014 11:26 am
by jmoore
The main class is available under components/insight: https://github.com/openmicroscopy/openmicroscopy/blob/v.4.4.10/components/insight/SRC/org/openmicroscopy/shoola/MainIJPlugin.java

The top-level target
Code: Select all
./build.py release-clients
generates the bundle that we release.

~Josh

Re: Omero ImageJ Plugin source code

PostPosted: Tue Feb 11, 2014 12:18 pm
by FiReTiTi
Thank you for your answer!
Ok for the main class, but I don't get the second part of your answer. Can I have some details please?

Re: Omero ImageJ Plugin source code

PostPosted: Tue Feb 11, 2014 8:23 pm
by jburel
We use the same code base for the general OMERO.insight desktop client and for the OMERO.insight imageJ plugin.
The class that Josh indicated is the class that is used to start the plugin-in.
When the user clicks on an image, by default a call is made to start the Bioformats plugin (required plugin)
The following code shows how the BF plugin is invoked
Code: Select all
StringBuffer buffer = new StringBuffer();
      try {
         buffer.append("location=[OMERO] open=[omero:server=");
         buffer.append(lc.getHostName());
         buffer.append("\nuser=");
         buffer.append(lc.getUserName());
         buffer.append("\nport=");
         buffer.append(lc.getPort());
         buffer.append("\npass=");
         buffer.append(lc.getPassword());
         buffer.append("\ngroupID=");
         buffer.append(ctx.getGroupID());
         buffer.append("\niid=");
         buffer.append(id);
         buffer.append("]");
         IJ.runPlugIn("loci.plugins.LociImporter", buffer.toString());
      } catch (Exception e) {
         LogMessage message = new LogMessage();
         message.println("Opening in image J");
         message.print(e);
         container.getRegistry().getLogger().debug(this, message);
         IJ.showMessage("An error occurred while loading the image.");
      }


If you wish to modify the OMERO code base and adjust the plugin you will have to use the build command indicated by Josh in his previous post

Hope it helps

Jmarie

Re: Omero ImageJ Plugin source code

PostPosted: Tue Feb 11, 2014 10:21 pm
by FiReTiTi
Thank you for your help.
I do know Java, so I understand the main class code, but I didn't get that that python command would download the code.

Unfortunately, macport fails to install ice on my laptop, so I cannot use this command line to get the source code.
Is there any other way to get it?

Regards,

Re: Omero ImageJ Plugin source code

PostPosted: Wed Feb 12, 2014 7:47 am
by jmoore
Sorry for the confusion. The build.py command I listed is how to compile the IJ plugin. What are you looking to do? Do you want to open the project in Eclipse? or are you more looking for, say, a zip of the appropriate classes?

Cheers,
~Josh

Re: Omero ImageJ Plugin source code

PostPosted: Wed Feb 12, 2014 8:40 am
by FiReTiTi
Yes, I want to open the whole plugin in NetBeans in order to take a look to the source code.
I want to do an automatic simple/fast client for biologists I work with, so I need to understand how to exactly read images (so how to correctly use bio-format).

Re: Omero ImageJ Plugin source code

PostPosted: Wed Feb 12, 2014 8:53 am
by jmoore
To get just the Java files you can use:
Code: Select all
git archive v.4.4.10 components/insight/SRC -o insight-src.zip

from insight of the git repository. Putting these into netbeans won't work without the addition of jars and similar.

If you wanted to have the whole code base in netbeans, we unfortunately don't have any examples but could help you get it all running in Eclipse if that would help. (That would require Ice though)

Cheers,
~Josh

Re: Omero ImageJ Plugin source code

PostPosted: Wed Feb 12, 2014 9:12 am
by FiReTiTi
Thank you so much!
I am interested by the methods called when you right clic on an image and select "View in ImageJ".
The only missing part (but not the least) in my client is the image reading with bio-format.

Re: Omero ImageJ Plugin source code

PostPosted: Wed Feb 12, 2014 9:28 am
by jburel
Hi

When you right-click and select "View in ImageJ". An event is posted (we heavily use the Publisher/Subscriber pattern).
The code handling the opening of the image in ImageJ using the Bio-Formats plugin can be found in TaskBarManager class.
https://github.com/openmicroscopy/openm ... nager.java

Code: Select all
private void runAsImageJ(long id, SecurityContext ctx)
   {
      UserCredentials lc = (UserCredentials) container.getRegistry().lookup(
            LookupNames.USER_CREDENTIALS);
      StringBuffer buffer = new StringBuffer();
      try {
         buffer.append("location=[OMERO] open=[omero:server=");
         buffer.append(lc.getHostName());
         buffer.append("\nuser=");
         buffer.append(lc.getUserName());
         buffer.append("\nport=");
         buffer.append(lc.getPort());
         buffer.append("\npass=");
         buffer.append(lc.getPassword());
         buffer.append("\ngroupID=");
         buffer.append(ctx.getGroupID());
         buffer.append("\niid=");
         buffer.append(id);
         buffer.append("]");
         IJ.runPlugIn("loci.plugins.LociImporter", buffer.toString());
      } catch (Exception e) {
         LogMessage message = new LogMessage();
         message.println("Opening in image J");
         message.print(e);
         container.getRegistry().getLogger().debug(this, message);
         IJ.showMessage("An error occurred while loading the image.");
      }
   }


Jmarie