Git Product home page Git Product logo

Comments (8)

ChucklesOnGitHub avatar ChucklesOnGitHub commented on August 16, 2024 1

Dear @blaingvt, it might be helpful to know that the MiniCAM is supported in Bonsai, including the Sync Out and Trigger In functionality, thanks to the work of Jon Newman who developed the nodes for Miniscopes and MiniCAMs: https://github.com/open-ephys/OpenEphys.Bonsai.Miniscope

from miniscope-daq-qt-software.

sneakers-the-rat avatar sneakers-the-rat commented on August 16, 2024

Related to: #57 , but it seems like this is is for starting and stopping a recording with an external trigger, rather than emitting a pulse for every frame acquired?

We still need to set up issue templates to prompt for this, but what version of miniscope are you using? (ordinarily i would ask what version of the software too, but i think there is only one version?)

@fnsangiul confirms this is a bug in this software, not the DAQ or miniscope firmware.

From what I can tell, it works like this:

  • The toggle is created in the qml here:
    Switch {
    id: switchExtTrigger
    objectName: "switchExtTrigger"
    text: qsTr("Triggerable")
    checked: false
    enabled: true
    onToggled: {
    if (checked) {
    bRecord.text = qsTr("Record [Ext. Trig. Enabled]");
    bStop.text = qsTr("Stop [Ext. Trig. Enabled]");
    // bRecord.enabled = false;
    // bStop.enabled = false;
    }
    else {
    bRecord.text = qsTr("Record");
    bStop.text = qsTr("Stop");
    // if (root.recording == false) {
    // bRecord.enabled = true;
    // }
    // else {
    // bStop.enabled = true;
    // }
    }
    root.extTriggerSwitchToggled(switchExtTrigger.checked);
    }
    }
  • That should emit an event from the extTriggerSwitchToggled signal
  • The ControlPanel connects the signal to extTriggerSwitchToggled2 on initialization here:
    QObject::connect(rootObject,
    SIGNAL(extTriggerSwitchToggled(bool)),
    this,
    SLOT(extTriggerSwitchToggled2(bool)));
  • the extTriggerSwitchToggled2 slot then:
  • ControlPanel::setExtTriggerTrackingState is connected to Miniscope::setExtTriggerTrackingState here:
    QObject::connect(controlPanel, &ControlPanel::setExtTriggerTrackingState, miniscope[i], &Miniscope::setExtTriggerTrackingState);
  • Miniscope is an instance of VideoDevice
  • VideoDevice::setExtTriggerTrackingState is connected to
  • VideoDevice::handleSetExtTriggerTrackingState seems to just toggle an LED:
    void VideoDevice::handleSetExtTriggerTrackingState(bool state)
    {
    m_extTriggerTrackingState = state;
    if (m_extTriggerTrackingState == true) {
    // Let's turn off the led0
    QQuickItem *controlItem; // Pointer to VideoPropertyControl in qml for each objectName
    controlItem = rootObject->findChild<QQuickItem*>("led0");
    controlItem->setProperty("startValue", 0);
    }
    else {
    // Let's turn led0 back on
    QQuickItem *controlItem; // Pointer to VideoPropertyControl in qml for each objectName
    controlItem = rootObject->findChild<QQuickItem*>("led0");
    controlItem->setProperty("startValue", m_lastLED0Value);
    }
    }
    void VideoDevice::handleRecordStart()
  • VideoStreamOCV::setExtTriggerTrackingState sets m_trackExtTrigger.state -
    void VideoStreamOCV::setExtTriggerTrackingState(bool state)
  • m_trackExtTrigger is used here, which reads from the CAP_PROP_GAMMA property and emits an extTriggered signal:
    if (m_trackExtTrigger) {
    if (extTriggerLast == -1) {
    // first time grabbing trigger state.
    extTriggerLast = cam->get(cv::CAP_PROP_GAMMA);
    }
    else {
    extTrigger = cam->get(cv::CAP_PROP_GAMMA);
    if (extTriggerLast != extTrigger) {
    // State change
    if (extTriggerLast == 0) {
    // Went from 0 to 1
    emit extTriggered(true);
    }
    else {
    // Went from 1 to 0
    emit extTriggered(false);
    }
    }
    extTriggerLast = extTrigger;
    }
    }
  • it's a little unclear to me at this point which objects are being connected here, so there seems to be a little magic and just by a smell test i imagine this might be where the signal is dropped? That signal is also only emitted when the stream is already running, so that might be another problem?
  • MiniScope:extTriggered is connected to ControlPanel::extTriggerTriggered here:
    QObject::connect(miniscope[i], &Miniscope::extTriggered, controlPanel, &ControlPanel::extTriggerTriggered);
  • ControlPanel::extTriggerTriggered calls onRecordActivated or onStopActivated here, but rather than using them like slots it calls them like methods? idk if you can do that with Qt slots:
    void ControlPanel::extTriggerTriggered(bool state)
    {
    if (state == true) {
    receiveMessage("Trigger: HIGH");
    onRecordActivated();
    }
    else {
    receiveMessage("Trigger: LOW");
    onStopActivated();
    }
    }

From there we're back into the main flow of starting and stopping recordings.

I can't actually debug this since we can't compile the software at the moment, but hopefully that's some information for the next person who comes by to debug until we can do the Qt6 update, and hopefully another lab member who knows more about the software than I do hops in here!

from miniscope-daq-qt-software.

TsungChihTsai avatar TsungChihTsai commented on August 16, 2024

I appreciate your response and the information you provided regarding the debugging constraints at the moment. I understand the challenges associated with the Qt6 update.

Given that you are currently unable to compile the software, does it mean there is no opportunity to address this issue? I would greatly appreciate it if you could.

At this moment, I would like to attempt resolving this issue using an alternative approach. The version I am currently using is Miniscope-DAQ-Software_build_v1_11.

My strategy is to seek your guidance on the specific folders where I should copy the files - "backend.cpp," "controlpanel.cpp," "ControlPanel.qml," "videodevice.cpp," and "videostreamocv.cpp" - within the Miniscope-DAQ-Software_build_v1_11 directory.

Could you please advise me on which specific folders I should copy these files to?

The folders under the Miniscope-DAQ-Software_build_v1_11 folder as below:

bearer
deviceConfigs
iconengines
imageformats
platforminputcontexts
platforms
qmltooling
Qt
QtGraphicalEffects
QtQml
QtQuick
QtQuick.2
scenegraph
Scripts
styles
translations
userConfigs
virtualkeyboard
pycache

I sincerely thank you for your invaluable assistance for all of us.

Best,

Tsung-Chih

from miniscope-daq-qt-software.

sneakers-the-rat avatar sneakers-the-rat commented on August 16, 2024

unfortunately I can't be of much further help at the moment - I didn't write the software and am mostly trying to steward it into retirement in order to replace it. It is technically possible to compile it as-is, but you will need some very specific versions of Qt and OpenCV, you can see more in the qt project file here:

win32 {
# Path to your openCV .lib file(s)
LIBS += -LC:/opencv-4.4.0/build/lib/Release -lopencv_world440
# LIBS += -LC:/opencv-4.4.0/build/lib/Debug -lopencv_world440d
# Path to openCV header files
INCLUDEPATH += C:/opencv-4.4.0/build/install/include
# Do we need DEPENDPATH ????
# #DEPENDPATH +=
# For libusb
# LIBS += -LC:/libusb-1.0.24/VS2017/MS64/dll/ -llibusb-1.0
# INCLUDEPATH += C:/libusb-1.0.24/include/libusb-1.0
# LIBS += -LC:/libusb-1.0.23/MS64/dll/ -llibusb-1.0
# INCLUDEPATH += C:/libusb-1.0.23/include/libusb-1.0
# For Python
# INCLUDEPATH += C:/Python38/include
# LIBS += -LC:/Python38/libs -lpython38
INCLUDEPATH += C:/Users/dbaha/.conda/envs/basepy37/include
LIBS += -LC:/Users/dbaha/.conda/envs/basepy37/libs -lpython37
# For numpy
INCLUDEPATH += C:/Users/dbaha/.conda/envs/basepy37/Lib/site-packages/numpy/core/include
} else {
CONFIG += link_pkgconfig
PKGCONFIG += opencv4
}

so if you get ahold of those versions of things and modify those paths you might be able to compile it from the source folder using Qt Creator (for Qt5).

The other path would be to push through the Qt6 upgrade, which is almost completed, there was just one breaking change having to do with one of the qml classes that was removed in Qt6 without clear replacement. Further info is in this issue: #61 and in the feature-repro-build branch

from miniscope-daq-qt-software.

blaingvt avatar blaingvt commented on August 16, 2024

I have a miniscope v4.4, which does trigger properly. This minicam does not trigger. Helpful to know that it is not firmware.

Is there any rough estimate of Qt6 upgrade release date? I plan to use alternative cameras/software until then but hope in the long run I will be able to use these minicams.

Best,
Brenton

from miniscope-daq-qt-software.

sneakers-the-rat avatar sneakers-the-rat commented on August 16, 2024

AHA! OK that clarifies things a lot - i'm new-ish in this lab and thought you were just referring to your miniscope as a minicam (it is a miniature camera!), my mistake.

This issue has a clear solution then - currently the control panel's switch is only connected to Miniscope devices:

QObject::connect(controlPanel, &ControlPanel::setExtTriggerTrackingState, miniscope[i], &Miniscope::setExtTriggerTrackingState);

So we need that to also iterate through behavior cameras and connect the signal. Ideally the way this would work would be that each camera has its own control panel, and the "main" control panel sends a given command to all the connected devices, that way you could both have all devices work in sync as well as have some of them behave differently. For now though we can just add the behavior cams to the things that receive that signal.

Is there any rough estimate of Qt6 upgrade release date?

I don't really have one, no :. The team(s) that would be making this are currently in the midst of a (very cool) new hardware cycle, and so once they freeze some designs there I imagine they will be returning to the software side. The Qt6 transition is really almost done on https://github.com/Aharoni-Lab/Miniscope-DAQ-QT-Software/tree/feature-repro-build , the last remaining thing is to fix the changes in TreeView from Qt5 vs TreeView from Qt6 in the TreeViewerJSON model, I just don't personally have time at the moment to handle it

from miniscope-daq-qt-software.

blaingvt avatar blaingvt commented on August 16, 2024

from miniscope-daq-qt-software.

blaingvt avatar blaingvt commented on August 16, 2024

from miniscope-daq-qt-software.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.