GUI and ThorCam questions

100 views
Skip to first unread message

Michael Graupner

unread,
Jun 24, 2016, 8:52:12 AM6/24/16
to ac...@googlegroups.com
Hello, 

I have two questions and would appreciate and help : 

1. In the central Manager interface, it is possible to click and draw some of the device interfaces on top of each other to get a stacked view. However, this is not possible with others of the device interfaces (e.g. DAQGeneric and Laser). What needs to be changed to get a consistent behavior? 

2. I have added a Thorlabs DCU223C camera to ACQ4 using the MicroManager device class. Configuration was pretty straight forward. However, when launching the Imager interface, the following error occurs which seems to related to the roi initialization. Is this possibly a bug in the MMCorePy class? 


===== 2016.06.24 14:06:19 =====
Traceback (most recent call last):
  File "acq4\devices\Camera\CameraInterface.py", line 197, in regionWidgetChanged
    self.updateRegion()
  File "acq4\devices\Camera\CameraInterface.py", line 205, in updateRegion
    self.cam.setParam('region', self.region, autoRestart=autoRestart)
  File "acq4\devices\MicroManagerCamera\mmcamera.py", line 248, in setParam
    return self.setParams({param: value}, autoCorrect=autoCorrect, autoRestart=autoRestart)
  File "acq4\devices\MicroManagerCamera\mmcamera.py", line 232, in setParams
    self._setParam(k, v, autoCorrect=autoCorrect)
  File "acq4\devices\MicroManagerCamera\mmcamera.py", line 254, in _setParam
    self.mmc.setROI(*value)
  File "C:\Program Files\Micro-Manager-1.4\MMCorePy.py", line 4639, in setROI
    return _MMCorePy.CMMCore_setROI(self, *args)
MMCorePy.CMMError: Error in device "ThorCam": Unsupported device command (11)

My camera configuration looks as follows : 

ThorCam:
    driver: 'MicroManagerCamera'
    mmAdapterName: 'ThorlabsUSBCamera'
    mmDeviceName: 'ThorCam'
    parentDevice: 'Microscope'
    transform:
        #position: (100*mm, 108*mm, 0)
        scale: (-4*1.5523*um/px, 4*1.5523*um/px)  
        angle: 90
    defaults:
         exposure: 50*ms

Thanks,
Michael


Luke Campagnola

unread,
Jun 30, 2016, 1:01:57 AM6/30/16
to acq4
On Fri, Jun 24, 2016 at 5:51 AM, Michael Graupner <graupner...@gmail.com> wrote:
Hello, 

I have two questions and would appreciate and help : 

1. In the central Manager interface, it is possible to click and draw some of the device interfaces on top of each other to get a stacked view. However, this is not possible with others of the device interfaces (e.g. DAQGeneric and Laser). What needs to be changed to get a consistent behavior? 

All docks are stackable, but Qt won't let you use an arrangement that would require more space than the window allows. Try expanding the window before you move the docks around.

 
2. I have added a Thorlabs DCU223C camera to ACQ4 using the MicroManager device class. Configuration was pretty straight forward. However, when launching the Imager interface, the following error occurs which seems to related to the roi initialization. Is this possibly a bug in the MMCorePy class? 


===== 2016.06.24 14:06:19 =====
Traceback (most recent call last):
  File "acq4\devices\Camera\CameraInterface.py", line 197, in regionWidgetChanged
    self.updateRegion()
  File "acq4\devices\Camera\CameraInterface.py", line 205, in updateRegion
    self.cam.setParam('region', self.region, autoRestart=autoRestart)
  File "acq4\devices\MicroManagerCamera\mmcamera.py", line 248, in setParam
    return self.setParams({param: value}, autoCorrect=autoCorrect, autoRestart=autoRestart)
  File "acq4\devices\MicroManagerCamera\mmcamera.py", line 232, in setParams
    self._setParam(k, v, autoCorrect=autoCorrect)
  File "acq4\devices\MicroManagerCamera\mmcamera.py", line 254, in _setParam
    self.mmc.setROI(*value)
  File "C:\Program Files\Micro-Manager-1.4\MMCorePy.py", line 4639, in setROI
    return _MMCorePy.CMMCore_setROI(self, *args)
MMCorePy.CMMError: Error in device "ThorCam": Unsupported device command (11)

My first thought was that this camera just doesn't have ROI support, and so ACQ4 should be corrected to check for this and avoid the request in the first place.
However, it does appear that your camera has a configurable ROI, so in that case either (1) ACQ4 is using the setROI function incorrectly, or (2) the MicroManager driver does not support this function.
I would suggest exploring (1) first by seeing whether you can make setROI work from the console:

    dev = man.getDevice('ThorCam')
    dev.mmc.setROI(...)  # try a variety of arguments here

If that fails, then the easiest fix is probably to wrap the call to setROI in a try/except block, and if it fails, the set a flag that indicates the camera does not support ROIs.
Otherwise, either the bug needs to be fixed in micromanager, or a new camera driver needs to be written in ACQ4.


Luke

Michael Graupner

unread,
Dec 15, 2016, 9:37:38 AM12/15/16
to ac...@googlegroups.com
I am coming back to this issue after a long time. 

It seems as if the setRoi function is not supported by the "ThorlabsUSBCamera" : 
- Trying  dev.mmc.setROI(...) in the console of ACQ4 with all kinds of values does not fix the problem. 
- The MicroManager website on ThorlabsUSBCamera says that : "Hardware ROI function currently not supported." 

It is easy to call the setROI function in a try/except block. What else needs to be implemented then? 

This seems to be a different issue : When using two cameras, the view of the Camera module does not follow the ROIs anymore, when moving the state. The movement of the ROIs follows the stage, but the ROIs leave the field of view as the field of view is actually moving in the opposite direction! 
This does not happen when using either of the cameras individually. Then, everything works as expected (the ROI follows the stage and the field of view follows the ROI). 

Any idea? 


Thanks,
Michael 



Luke

--
You received this message because you are subscribed to the Google Groups "ACQ4" group.
To unsubscribe from this group and stop receiving emails from it, send an email to acq4+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/acq4/CACZXET_%2BAc8qU6hK01mCabmkzAqJv_D_nt_%2BiM1nr7QO6e7D1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Luke Campagnola

unread,
Dec 15, 2016, 2:55:37 PM12/15/16
to acq4
I verified this using two mock cameras. The problem is just that each camera is independently trying to adjust the view to keep itself stationary. We need a way for the camera module to select just one imaging device as the "active" device to be tracked.  (see devices/Camera/CameraInterface.py; globalTransformChanges and updateTransform)


Michael Graupner

unread,
Dec 15, 2016, 4:08:53 PM12/15/16
to ac...@googlegroups.com
OK. Thanks. 

I will look it that. 

Cheers,
Michael 

Michael Graupner

unread,
Dec 16, 2016, 5:57:05 AM12/16/16
to ac...@googlegroups.com
Hi Luke,

as you pointed out, when devices/Camera/CameraInterface.py: updateTransform is performed by only one of the two cameras, everything works fine. Moreover, the problem is independent of whether one, both or none of the cameras isRunning. 

I first thought of adding another parameter to the camera settings in devices.cfg. However, I think it does not matter which one of the two is used to update the view. Where would you suggest to check for two cameras (how could that be done?) and define the device to be used for the update? 

Thanks,
Michael



Luke Campagnola

unread,
Dec 16, 2016, 11:00:16 AM12/16/16
to acq4
I'm working on it right now.. there are many easy ways this could be easily fixed, but some of them have awkward consequences.
What you really want is for the view to only track one device at a time (perhaps the one that was most recently started).

Luke Campagnola

unread,
Dec 20, 2016, 2:35:58 AM12/20/16
to acq4
Michael,
Can you test this out?

Antonin Blot

unread,
Sep 11, 2018, 3:33:59 PM9/11/18
to ACQ4
Did you solve the ThorCam issue?

I ran in the same issue. I tried to merge PR52 (in develop, there were a few conflicts to fix, I did it very quickly), it postponed the error. Acq4 can now start with no problem but when I start my camera device I have this error:

CMMError: Error in device "ThorCam": Unsupported device command (11)
  File "C:\Users\Master\software\acq4\acq4\devices\Camera\CameraInterface.py", line 180, in regionWidgetChanged
    self.updateRegion()
  File "C:\Users\Master\software\acq4\acq4\devices\Camera\CameraInterface.py", line 188, in updateRegion
    self.cam.setParam('region', self.region, autoRestart=autoRestart)
  File "C:\Users\Master\software\acq4\acq4\devices\MicroManagerCamera\mmcamera.py", line 239, in setParam
    return self.setParams({param: value}, autoCorrect=autoCorrect, autoRestart=autoRestart)
  File "C:\Users\Master\software\acq4\acq4\devices\MicroManagerCamera\mmcamera.py", line 223, in setParams
    self._setParam(k, v, autoCorrect=autoCorrect)
  File "C:\Users\Master\software\acq4\acq4\devices\MicroManagerCamera\mmcamera.py", line 245, in _setParam
    self.mmc.setROI(*value)
  File "C:\Program Files\Micro-Manager-1.4\MMCorePy.py", line 4639, in setROI
    return _MMCorePy.CMMCore_setROI(self, *args)


Luke
To unsubscribe from this group and stop receiving emails from it, send an email to acq4+uns...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "ACQ4" group.
To unsubscribe from this group and stop receiving emails from it, send an email to acq4+uns...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "ACQ4" group.
To unsubscribe from this group and stop receiving emails from it, send an email to acq4+uns...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "ACQ4" group.
To unsubscribe from this group and stop receiving emails from it, send an email to acq4+uns...@googlegroups.com.

Antonin Blot

unread,
Sep 11, 2018, 3:59:33 PM9/11/18
to ACQ4
I tried the develop branch of Michael and that worked (after I added a small try catch to ignore an error caused in pyqtgraph). Is there a reason to favor/avoid the main acq4 branch?

Luke Campagnola

unread,
Sep 18, 2018, 6:41:36 PM9/18/18
to acq4
I think there are many reasons to favor/avoid the acq4 main branch, but only you can decide which ones are important to you :)
I have been doing a lot of development around multipatch and pipette automation; Michael has added a lot of new support around 2p imaging. Ideally we will find the time some day to join all this work together, but it's really difficult when we don't have similar hardware to test on. For now, I suggest using whichever branch works best for you. If you find that there are things you really want from both branches, then hopefully that serves as motivation for us to do some merging.


Michael Graupner

unread,
Sep 19, 2018, 3:13:22 AM9/19/18
to ac...@googlegroups.com
Dear Antonin, 

sorry for my late response. 

My develop branch is very specific for my setup. And it contains many parts of code which has not merged into the main branch of ACQ4, as Luke pointed out before. 

However, have you tried to merge my mmCamera branch ( https://github.com/mgraupe/acq4/commits/mmCamera ) into your version. I have addressed the issue that some camera models don't support the setRoi function in that branch. It looks like that this is the source of your error. 

Please let me know if that works. 

Cheers,
Michael



Reply all
Reply to author
Forward
0 new messages