Hook image from the camera

classic Classic list List threaded Threaded
4 messages Options
d0x
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Hook image from the camera

d0x
Hello everyone,

I'm facing a problem and wondering if there really is a solution...

Context : I'm using MM1.4 and I've created a Qt plugin in C++. In this plugin, I would like to either:

  - Display the image retrieved from the Camera (an Orca 4.0 for instance) in my plugin (duplicate the one displayed by MM). Unfortunately, as the camera is already initialized by MM, it seems that I can't interact with it... Is there still a way to capture the images from the camera ?
 
  - Or, another solution would be to be able to intercept the image from the camera and send it back to MM as if it was the original... I saw that some plugins already do that using MMStudio. Unfortunately, MMStudio is a Java only class and I can't use its functionnality from C++. Looking at MMCore and MMDevice, I didn't see anything that looks like what I'm searching.

To give a concrete example of what I'm trying to do : I would like to do something like the "Pattern Overlay" plugin BUT with a C++ plugin instead of a Java one. ^^

If you have any solution/advice/links to useful information, please let me know. I've been searching for quite a while already and still stuck.

Thanks by advance, :)

d!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Hook image from the camera

JonD
Administrator
d0x wrote
Context : I'm using MM1.4 and I've created a Qt plugin in C++. In this plugin, I would like to either:

  - Display the image retrieved from the Camera (an Orca 4.0 for instance) in my plugin (duplicate the one displayed by MM). Unfortunately, as the camera is already initialized by MM, it seems that I can't interact with it... Is there still a way to capture the images from the camera ?
 
  - Or, another solution would be to be able to intercept the image from the camera and send it back to MM as if it was the original... I saw that some plugins already do that using MMStudio. Unfortunately, MMStudio is a Java only class and I can't use its functionnality from C++. Looking at MMCore and MMDevice, I didn't see anything that looks like what I'm searching.

To give a concrete example of what I'm trying to do : I would like to do something like the "Pattern Overlay" plugin BUT with a C++ plugin instead of a Java one. ^^
It seems you are asking how to run your Qt code within MM, or else automatically pass the images that MM acquires to your Qt code which would be running separately.  Is that a fair summary?

I know of no way to run Qt code within MM.  It seems that having Qt code running separately could be done by e.g. saving the images to disk using a MM plugin that intercepts the images and saves them to a directory where your Qt code is constantly polling for new images.  If Qt needs to pass information back into MM it would get more complicated.

It may be possible to write a MM device adapter (C++) for your camera that would provide add relevant functionality.  The natural starting point would be the existing device adapter for your camera, which is unfortunately one of the "secret" device adapters where the source code is not public.

Or maybe you would like to undertake writing some sort of interface to allow Qt plugins to be called by MM and possibly even share data; I imagine that is possible but it also doesn't seem trivial.  In some ways that is the relationship between MMCore (C++, with device adapters being sort of like plugins also written in C++) and the MM GUI "MMStudio" (Java, which has its own set of plugins written in Java).

There are others on this list can provide better ideas or correct any inaccuracies in what I wrote, but hopefully that helps crystallize the issues at hand.

Jon

-------------------------------------------
Jon Daniels
Applied Scientific Instrumentation
29391 West Enid Rd, Eugene, OR 97402
Phone: (541) 461-8181 x118
-------------------------------------------
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Hook image from the camera

Christian Carsten Sachs
In reply to this post by d0x
Hello,

two ways of addressing this come to mind:

- You could implement an ImageProcessor in C++ with Qt; it could just pass-through the image to MMCore unaltered and use a copy for your desired processing, however it'd tie the program closely to MMCore, and having Qt's event loop running there might take some twiddling with multithreading, or you might need to pass it from there to your program via IPC …
or
- If you only want to control the camera, but don't need any other GUI features of Micro-Manager, just instantiate MMCore directly from your application, instantiate the camera and snap images. While you give up MM's GUI and have to reproduce some features, you have full control at this point. If you link against distributed MM .DLLs, you can use the pre-compiled, secret device adapters as well.

Best regards,
Christian
________________________________________
Von: d0x <[hidden email]>
Gesendet: Mittwoch, 15. Februar 2017 16:39
An: [hidden email]
Betreff: [micro-manager-general] Hook image from the camera

Hello everyone,

I'm facing a problem and wondering if there really is a solution...

Context : I'm using MM1.4 and I've created a Qt plugin in C++. In this
plugin, I would like to either:

  - Display the image retrieved from the Camera (an Orca 4.0 for instance)
in my plugin (duplicate the one displayed by MM). Unfortunately, as the
camera is already initialized by MM, it seems that I can't interact with
it... Is there still a way to capture the images from the camera ?

  - Or, another solution would be to be able to intercept the image from the
camera and send it back to MM as if it was the original... I saw that some
plugins already do that using MMStudio. Unfortunately, MMStudio is a Java
only class and I can't use its functionnality from C++. Looking at MMCore
and MMDevice, I didn't see anything that looks like what I'm searching.

To give a concrete example of what I'm trying to do : I would like to do
something like the "Pattern Overlay" plugin BUT with a C++ plugin instead of
a Java one. ^^

If you have any solution/advice/links to useful information, please let me
know. I've been searching for quite a while already and still stuck.

Thanks by advance, :)

d!



--
View this message in context: http://micro-manager.3463995.n2.nabble.com/Hook-image-from-the-camera-tp7588110.html
Sent from the Micro-Manager mailing list archive at Nabble.com.

------------------------------------------------------------------------------
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


------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------


------------------------------------------------------------------------------
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
d0x
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Hook image from the camera

d0x
Hello,

First of all, thank you both for your answers.

The solution closest to what I already implemented would be the second you mentioned Christian. Indeed, I already have a fully coded class to manage the micromanager camera using MMCore. The remaining issue is that the call to loadSystemConfiguration() seems to inhibit MM. In other words, I'm already able to control the camera only in MM, I'm able to control the camera only in my plugin. But as soon as one of them instantiate and initialize (I guess) the MMCore, no access is allowed to another part of the code.

A solution that comes to my mind right now would be to let MM create the MMCore and load the configuration and send a pointer to MMCore to my plugin. Would that work ? Not sure... Not even sure that MMCore is thread-safe ?

d!
Loading...