[ome-devel] c++ API questions
Josh Moore
josh at glencoesoftware.com
Thu Apr 12 14:06:45 BST 2018
On Wed, Apr 11, 2018 at 9:01 PM, Renato Araujo <renato.araujo at kdab.com> wrote:
> Hi Guys,
Hi Renato,
> I started to work on a project and we want to integrate it with OMERO.
>
> The project is Qt based and we intend to make use of C++ OMERO API. I have
> already the basics working very well but while working on it some questions
> appeared, and I could not find answers on the documentation for that.
>
> 1 - When using "getRoiService()->findByImage(...)" it says that IROI is
> marked as deprecated, but I could not find any replacement for it. What
> should I use instead?
The deprecation was an early warning that this interface, though
in-used is not completely fit for purpose and is slotted to be
replaced. See https://github.com/openmicroscopy/openmicroscopy/pull/4261
You can safely use the service, but once a replacement is in place,
you will need to migrate. The alternative would be to use the IQuery
service and write HQL queries yourself, but I imagine as a new client
using IRoi and migrating will actually be easier.
> 2 - I understand the concept of "unload" objects and that some objects will
> not contain all fields set:
> 2.1 - But how do I fill the missing fields? Looks like that java has an
> "IObject.retrieve" method that I can use to retrieve individual fields. But
> I could not find the same method in C++.
I'll warn you upfront, C++ is far and away the least used of any of
our languages. We're very happy to help and would be excited to have
someone using it in anger, but it's not unlikely that you will noticed
features that were added to Java and Python and which were never
ported to poor C++.
That being said, the retrieve method only exists on the `ome.model`
(server-internal) objects. You should compare to the `omero.model`
classes, in either Java or Python. Regardless, I think there isn't
currently a method for resurrecting a model object as you wish. Not
even toggleCollectionsLoaded will get you completely what you want,
since it will overwrite the _loaded_ sequences. I think new setters
are called for.
> 3 - Is the omero client code available? That will be a great base of example
> code. I am curious to see how it avoid blocking the ui while executing omero
> commands.
Are you referring to client.cpp[1]? Or the Java client? In that case,
it's under: components/insight[2]
> Does it create a thread internally for the omero commands? (like
> connect to the server, retrieve images), or that uses some async API.
The Java client creates threads itself (keeping long-running calls off
the main GUI thread). The web client is largely single-threaded
leaving nginx/apache to handle the threading. The underlying library
that OMERO uses (Ice from ZeroC) _does_ provide an async API if you'd
like to try it out.
All the best,
~Josh
[1] https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroCpp/src/omero/client.cpp
[2] https://github.com/openmicroscopy/openmicroscopy/tree/develop/components/insight/SRC/org/openmicroscopy/shoola
More information about the ome-devel
mailing list