We're Hiring!

Omero ImageJ Plugin source code

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

Re: Omero ImageJ Plugin source code

Postby FiReTiTi » Thu Feb 13, 2014 2:00 am

Thank you!
Unfortunately, I have an exception at the line: IJ.runPlugIn("loci.plugins.LociImporter", buffer.toString());
The exception is:
-! 12/02/14 17:53:23:649 warning: AWT-EventQueue-0: null - createSession retry: 1
-! 12/02/14 17:53:28:651 warning: AWT-EventQueue-0: null - createSession retry: 2
Exception :-(
omero.ClientError: Obtained null object proxy
at omero.client.createSession(client.java:698)
at loci.ome.io.OmeroReader.initFile(OmeroReader.java:250)
at loci.formats.FormatReader.setId(FormatReader.java:1244)
at loci.plugins.in.ImportProcess.initializeFile(ImportProcess.java:482)
at loci.plugins.in.ImportProcess.execute(ImportProcess.java:146)
at loci.plugins.in.Importer.showDialogs(Importer.java:141)
at loci.plugins.in.Importer.run(Importer.java:79)
at loci.plugins.LociImporter.run(LociImporter.java:81)
at ij.IJ.runUserPlugIn(IJ.java:195)
at ij.IJ.runPlugIn(IJ.java:160)
at ij.IJ.runPlugIn(IJ.java:149)
at omerotests.OmeroIJ_Plugin$2.actionPerformed(OmeroIJ_Plugin.java:192)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6414)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3275)
at java.awt.Component.processEvent(Component.java:6179)
at java.awt.Container.processEvent(Container.java:2084)
at java.awt.Component.dispatchEventImpl(Component.java:4776)
at java.awt.Container.dispatchEventImpl(Container.java:2142)
at java.awt.Component.dispatchEvent(Component.java:4604)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4618)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4279)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4209)
at java.awt.Container.dispatchEventImpl(Container.java:2128)
at java.awt.Window.dispatchEventImpl(Window.java:2492)
at java.awt.Component.dispatchEvent(Component.java:4604)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:717)
at java.awt.EventQueue.access$400(EventQueue.java:82)
at java.awt.EventQueue$2.run(EventQueue.java:676)
at java.awt.EventQueue$2.run(EventQueue.java:674)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:690)
at java.awt.EventQueue$3.run(EventQueue.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:687)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


It seems to be a connection issue, but I don't know why :-(

Just to be sure:
- lc.getHostName() is the server address
- lc.getUserName() is the login
- lc.getPassword() is obviously the password
- ctx.getGroupID() is the group ID that I can alse get with the command imdata.getGroupId()
- id it the ImageData ID, so I can get it with the command imdata.getId()

This is the code I use:
Code: Select all
try {
            client cline = new client("omero.ohsu.edu", 4065)) ;
            ServiceFactoryPrx entry = clien.createSession("mylogin", "my password") ;
            System.out.println("Session opened.") ;

            client unsecureClient = clien.createClient(false) ;
            ServiceFactoryPrx entryUnencrypted = unsecureClient.getSession() ;

            long userId = entryUnencrypted.getAdminService().getEventContext().userId ;
            long groupId = entryUnencrypted.getAdminService().getEventContext().groupId ;
            IContainerPrx proxy = entryUnencrypted.getContainerService() ;
            ParametersI param = new ParametersI() ;
            param.exp(omero.rtypes.rlong(userId)) ;
            param.leaves() ; //indicate to load the images
            RenderingEnginePrx renderproxy = entryUnencrypted.createRenderingEngine();
            List<IObject> projects = proxy.loadContainerHierarchy(Project.class.getName(), new ArrayList<Long>(13), param) ;
            Iterator<IObject> projectiter = projects.iterator() ;
            while ( projectiter.hasNext() )
               {
               ProjectData project = new ProjectData( (Project) projectiter.next()) ;
               Set<DatasetData> datasets = project.getDatasets();
               Iterator<DatasetData> datasetiter = datasets.iterator();
               while ( datasetiter.hasNext() )
                  {
                  DatasetData dataset = datasetiter.next() ;
                  Set<ImageData> images = dataset.getImages() ;
                  Iterator<ImageData> imiter = images.iterator() ;
                  while ( imiter.hasNext() )
                     {
                     ImageData imdata = imiter.next() ;
                     StringBuffer buffer = new StringBuffer() ;
                     buffer.append("location=[OMERO] open=[omero:server=") ;
                     buffer.append("omero.ohsu.edu") ;
                     buffer.append("\nuser=");
                     buffer.append("mylogin");
                     buffer.append("\nport=");
                     buffer.append(4065);
                     buffer.append("\npass=");
                     buffer.append("mypassword");
                     buffer.append("\ngroupID=");
                     buffer.append(imdata.getGroupId()) ;
                     buffer.append("\niid=");
                     buffer.append(imdata.getId()) ;
                     buffer.append("]");
                     LociImporter locin = new LociImporter() ;
                     locin.run(buffer.toString()) ;
                     //IJ.runPlugIn("loci.plugins.LociImporter", buffer.toString());
                     }
                  }
               }
            
            renderproxy.close() ;
            clien.closeSession() ;
            System.out.println("\nSession closed.") ;
            if ( unsecureClient != null )
               {
               unsecureClient.closeSession() ;
               System.out.println("Unsecure Client Session closed.") ;
               }
            System.exit(0) ;
            }
         catch (Exception ex)
            {
            System.err.println("Exception :-(") ;
            ex.printStackTrace() ;
            System.exit(0) ;
            }
FiReTiTi
 
Posts: 26
Joined: Tue Feb 04, 2014 7:30 am
Location: Portland, OR, USA

Re: Omero ImageJ Plugin source code

Postby jmoore » Fri Feb 14, 2014 12:10 pm

Is there anything else in the log you could show us? Could there be a proxy or firewall involved?

Usually these null proxy exceptions relate to a server not being reachable? Can you login to the same server with the webclient?

Any other info you might have would be appreciated.
Cheers,
~Josh
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Omero ImageJ Plugin source code

Postby FiReTiTi » Fri Feb 14, 2014 5:45 pm

Hi,
I can reach the server using both the omero_ij plugin and the web client from my library (first part of the code I shared).

Maybe this exception is because of the parameters I use for the connection.
FiReTiTi
 
Posts: 26
Joined: Tue Feb 04, 2014 7:30 am
Location: Portland, OR, USA

Re: Omero ImageJ Plugin source code

Postby jmoore » Fri Feb 14, 2014 8:20 pm

Reading your code (more carefully this time!) I see the problem: it's port 4064 rather than 4065. Sorry for not having seen that sooner. Let us know if that helps.

Cheers,
~Josh

P.S. There's a constant you can use if you'd like: omero.constants.GLACIER2PORT.value
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany

Re: Omero ImageJ Plugin source code

Postby FiReTiTi » Fri Feb 14, 2014 10:09 pm

No, I AM SORRY for such a stupid mistake, I should had seen it.
FiReTiTi
 
Posts: 26
Joined: Tue Feb 04, 2014 7:30 am
Location: Portland, OR, USA

Re: Omero ImageJ Plugin source code

Postby FiReTiTi » Thu Feb 27, 2014 10:56 am

It seems that "from home", I can only read one image using this code :-(
The first image is correctly read, I have the panel asking me the parameters for the second image, but after nothing happens.
But it works perfectly if I do that from "my office".
Would you know why?
I have tested using "IJ.runPlugIn("loci.plugins.LociImporter", buffer.toString());" too, and it is the same issue.
FiReTiTi
 
Posts: 26
Joined: Tue Feb 04, 2014 7:30 am
Location: Portland, OR, USA

Re: Omero ImageJ Plugin source code

Postby jburel » Sun Mar 02, 2014 7:37 pm

From the office, you have view images displayed one after the other.
due to the speed of the network, I guess it takes time to load the second images and "you get blocked"
Did you try to wait between each image request to see if you can see them while working from home.

Thanks
Jmarie
User avatar
jburel
Team Member
 
Posts: 348
Joined: Thu May 21, 2009 6:38 pm
Location: dundee

Re: Omero ImageJ Plugin source code

Postby FiReTiTi » Mon Mar 03, 2014 7:39 am

Thank you for your answer.
I am gonna test.
FiReTiTi
 
Posts: 26
Joined: Tue Feb 04, 2014 7:30 am
Location: Portland, OR, USA

Previous

Return to Developer Discussion

Who is online

Users browsing this forum: Google [Bot] and 1 guest