diff --git a/source/_static/downloads/uclaminiscopev4-miniscopedaq-gui.bonsai b/source/_static/downloads/uclaminiscopev4-miniscopedaq-gui.bonsai new file mode 100644 index 0000000..7eb9a31 --- /dev/null +++ b/source/_static/downloads/uclaminiscopev4-miniscopedaq-gui.bonsai @@ -0,0 +1,1394 @@ + + + + + + + + + + + + + DataSource + + + + + + + + + + + + 1 + 0 + -17.2 + Low + Fps15 + false + + + + DataFrame + + + + + C:\Users\open-ephys\Downloads\unprocessed-miniscope-data\14_44_09\My_V4_Miniscope\2.avi + 0 + 0 + Frames + true + true + + + + + + + true + + + + + + + 0 + + + + + + + + + + + new ( + it.Item1 as Image, + it.Item2 as Trigger, + it.Item3 as Quaternion +) + + + + + DataFrame + + + + + + + + + + + + + + + + + + + + + + + + + SaveData + + + + ToggleButtonRecord + + + + 1 + + + + + + + + + + + + + + + + SaveDataToggle + + + + DataFrame + + + CheckBoxRecordDuration + + + + + + Source1 + + + + + + + + + + + + + + PT10S + + + + RecordingTimer + + + ToggleButtonRecordPublish + + + + + + Source1 + + + + + + + + + + + + + + + + + + Image + + + + + + + + + + ucla-miniscope-v4_image_.avi + FileCount + true + false + Y800 + 30 + + 0 + 0 + + NearestNeighbor + + + + + Trigger,Quaternion + + + + + + + + + + + ucla-miniscope-v4_io-quaternion_.csv + false + false + FileCount + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + TriggerToggleLow + + + TriggerToggleHigh + + + + + + + 1 + + + + SaveDataTriggerToggle + + + + DataFrame + + + + + + Source1 + + + Trigger + + + + + + + + + + + Trigger + + + + + + ToggleButtonTriggerRecordPublish + + + + + + + + + Source1 + + + + + + + + + + + + + + + Image + + + + + + + + + + ucla-miniscope-v4_image_.avi + FileCount + true + false + Y800 + 30 + + 0 + 0 + + NearestNeighbor + + + + + Trigger,Quaternion + + + + + + + + + + + ucla-miniscope-v4_io-quaternion_.csv + false + false + FileCount + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DataFrame + + + + + Quaternion + + + + + COM7 + true + true + + + + + + + + + + true + true + true + true + false + + + MiniscopeGui + + + + + + + + + Video + + + + DataFrame + + + Image + + + RadioButtonNone + + + RadioButtonSaturation + + + RadioButtonDff + + + + + + + + + NoProcessing + + + + Source1 + + + it.item2.item1 + + + Item1 + + + + + + + + + + + + Saturation + + + + Source1 + + + it.item2.item2 + + + Item1 + + + CalculateDisplaySaturation + + + + Source1 + + + + 192 + 255 + ToZero + + + + + + + Size + + + + + + + + + + 600 + 600 + + U8 + 3 + + 0 + 0 + 100 + 100 + + + + + + + + + + 1 + 0 + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DF/F + + + + Source1 + + + it.item2.item3 + + + Item1 + + + + + + + + + 100 + 14.3 + 3 + + + + Item2 + + + + + 0.25 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Source1 + + + + DataFrame + + + Image + + + + + + + true + true + 1 + 2 + + + + + + + VideoRadioButtons + + + + RadioButtonNone + true + true + None + true + + + RadioButtonNone + + + + RadioButtonSaturation + true + true + Saturation + false + + + RadioButtonSaturation + + + + RadioButtonDff + true + true + ΔF/F + false + + + RadioButtonDff + + + + true + true + 3 + 1 + + + + + + + + + + + + + + + + + + + + + + + TimerLabels + + + + + PT0S + PT1S + + + + "Acquiring: " & Convert.ToString(it) & " seconds" + + + + + + + + true + true + Acquiring: 28 seconds + + + + + PT0S + PT1S + + + + ToggleButtonRecord + + + DataFrame + + + Trigger + + + + false + + + + ToggleButtonTriggerRecord + + + + + + + + + + + + it.Item2 + + + Item1 + + + + + + Source1 + + + + + + + + + + TriggerToggleHigh + + + + + + + + + Source1 + + + + + + + + + + + + + + + + Source1 + + + + + + + + + + + + TriggerToggleLow + + + ToggleButtonRecord + + + + + + Source1 + + + + + + + + + + + + ToggleButtonTriggerRecord + + + + + + Source1 + + + + + + + + + + + + + + + + + + + + + "Recording: " & Convert.ToString(it) & " seconds" + + + + + + + + + + + + + + + + + + + + + true + true + + + + + true + true + 2 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IOGraphs + + + + DataFrame + + + Trigger + + + + + + + + + + + + CheckBoxes + + + + ToggleButtonRecord + + + ToggleButtonTriggerRecord + + + + + + + + + + + + CheckBoxRecordDuration + true + true + Stop recording when RecordingDuration has elapsed. + false + + + CheckBoxRecordDuration + + + + + + + + + + + + + + + + + Buttons + + + + ToggleButtonTriggerRecord + + + ToggleButtonRecord + + + RecordButton + + + + RecordingTimer + + + ToggleButtonRecord + + + it ? "Stop Recording" : "Record" + + + RecordingTimer + + + + Record + + + + + + + + + + + + + false + + + + RecordingTimer + + + + false + + + + + + + + + + + + + true + + + + ToggleButtonTriggerRecord + + + + + + + + + + + + ToggleButtonRecord + true + true + Record + false + + + ToggleButtonRecord + + + ToggleButtonRecordPublish + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RecordWhenTriggerButton + + + + ToggleButtonTriggerRecord + + + it ? "Stop Recording On Trigger" : "Record On Trigger" + + + RecordingTimer + + + + Record + + + + + + + + + + + + + false + + + + RecordingTimer + + + + false + + + + + + + + + + + + + true + + + + ToggleButtonRecord + + + + + + + + + + + + ToggleButtonTriggerRecord + true + true + Record On Trigger + false + + + ToggleButtonTriggerRecord + + + ToggleButtonTriggerRecordPublish + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + 2 + 1 + + + + + + + + + + + + + + + + + + MiniscopeGui + true + true + 2 + 4 + + + Absolute + 600 + + + 30 + + + + + Absolute + 600 + + + Absolute + 30 + + + Absolute + 200 + + + Absolute + 30 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/_static/images/uclaminiscopev4-miniscopedaq-gui.svg b/source/_static/images/uclaminiscopev4-miniscopedaq-gui.svg new file mode 100644 index 0000000..0363c92 --- /dev/null +++ b/source/_static/images/uclaminiscopev4-miniscopedaq-gui.svg @@ -0,0 +1,3 @@ + +]>DataSourceSaveDataAutoCommutatorMiniscopeGuiLedBrightness,Focus,SensorVideoFileName,VideoSuffix,VideoOvQuaternionSigma,BackgroundFrames,BackgrPropertyGridDataFrame \ No newline at end of file diff --git a/source/_static/images/uclaminiscopev4-miniscopedaq-gui_commutate-disable.svg b/source/_static/images/uclaminiscopev4-miniscopedaq-gui_commutate-disable.svg new file mode 100644 index 0000000..a8a2012 --- /dev/null +++ b/source/_static/images/uclaminiscopev4-miniscopedaq-gui_commutate-disable.svg @@ -0,0 +1,365 @@ + +AutoCommutatorQuaternionDataFrameAutoCommutatorQuaternionDataFrame diff --git a/source/ucla-miniscope-v4/index.rst b/source/ucla-miniscope-v4/index.rst index a98b51a..fdbf6ef 100644 --- a/source/ucla-miniscope-v4/index.rst +++ b/source/ucla-miniscope-v4/index.rst @@ -23,8 +23,6 @@ To learn how the UCLA Miniscope v4 works, refer to the :doc:`/ucla-miniscope-v4/ UCLA Miniscope v4 Features & Properties *************************************** -.. todo:: format this better - Mechanical Properties: * **Mass:** <3g diff --git a/source/ucla-miniscope-v4/quick/software.rst b/source/ucla-miniscope-v4/quick/software.rst index eee70a6..a219312 100644 --- a/source/ucla-miniscope-v4/quick/software.rst +++ b/source/ucla-miniscope-v4/quick/software.rst @@ -65,7 +65,8 @@ If you have not already done so, :align: center :height: 400px - #. Download and install the required Bonsai packages: + #. Download and install the required Bonsai packages or update to the latest versions using + the Bonsai Package Manager: * Bonsai.StarterPack diff --git a/source/ucla-miniscope-v4/user/miniscope-daq/gui/description.rst b/source/ucla-miniscope-v4/user/miniscope-daq/gui/description.rst new file mode 100644 index 0000000..15403f8 --- /dev/null +++ b/source/ucla-miniscope-v4/user/miniscope-daq/gui/description.rst @@ -0,0 +1,55 @@ +#################### +Workflow Description +#################### + +.. note:: This description assumes the reader has a foundation in Bonsai that is built on the :doc:`Trigger Workflow Description <../save-data/description>`. Start there if you have not already. + +*************** +GUI Description +*************** + +.. image:: /_static/images/uclaminiscopev4-miniscopedaq-gui.svg + :alt: exported svg of main workflow with bounding box over nodes responsible for automatic commutation + :align: center + +This example workflow is meant to be extensible. For that purpose, we have provided an overview of +how it works broad overview of how it works. + +.. tip:: + + If you edit this workflow for your own experiment, one important feature of Bonsai to know about + is that all items passed from node to node are visible to the user using type visualizers. Either: + + #. Double-click a node while the workflow is running to open the default visualizer. + #. Right-click a node, click "Show Visualizer", and click a visualizer to show up when the + workflow is running. + + Not all types have descriptive visualizers, but they can still be helpful to know when data is + sent. Moreover, if a type doesn't have a descriptive visualizer, you might be able to select a + member from that type and visualize that member instead, i.e. what we do to visualize image or + quaternion data from a `UCLAMiniscopeV4Frame`. + +There are several ``GroupWorkflow`` operators that have been named after the GUI elements that they +contain or the function that they serve. Double-click one while the workflow is off to inspect it, or +press ``F12`` while one is selected. + +- The "SaveData" ``GroupWorkflow`` contains a pattern that allows the ``VideoWriter`` operator to + subscribe (a `Reactive `__ way to say + "listening") to upstream operators which allows the user to change the filename while the + workflow is running. + +- The "DataSource" ``GroupWorkflow`` contains the ``UCLAMiniscopeV4`` source node. + +- The rest of the ``GroupWorkflows`` are for controlling the state of GUI elements. Each one has a + ``VisualizerMapping`` to map each GUI element to a panel. + + - If you want to add your own custom data-processing pipeline for visualization, inspect the + "Video" ``GroupWorkflow``. It contains three more ``GroupWorkflows`` that each represent a + way to look at the data. Create another radio button and branch (or override one that + already exists) to add your custom data-processing pipeline to the visualizer. + +This workflow also demonstrates the usage of ``PublishSubject``, ``MulticastSubject``, and +``BehaviorSubject`` which can be combined with ``SubscribeSubject`` to connect nodes without drawing +lines between them. Using `subjects `_ is `good +practice `_ when creating more +extensive workflows. \ No newline at end of file diff --git a/source/ucla-miniscope-v4/user/miniscope-daq/gui/hardware.rst b/source/ucla-miniscope-v4/user/miniscope-daq/gui/hardware.rst new file mode 100644 index 0000000..845a3c1 --- /dev/null +++ b/source/ucla-miniscope-v4/user/miniscope-daq/gui/hardware.rst @@ -0,0 +1,5 @@ +#################### +Hardware Connections +#################### + +Coming soon \ No newline at end of file diff --git a/source/ucla-miniscope-v4/user/miniscope-daq/gui/index.rst b/source/ucla-miniscope-v4/user/miniscope-daq/gui/index.rst new file mode 100644 index 0000000..6eb900b --- /dev/null +++ b/source/ucla-miniscope-v4/user/miniscope-daq/gui/index.rst @@ -0,0 +1,31 @@ +### +GUI +### + +.. image:: /_static/images/uclaminiscopev4-miniscopedaq-gui.svg + :alt: image of workflow + :width: 50% + :align: center + +After following this tutorial, the user will be able to open an example GUI constructed in Bonsai for +interfacing with the UCLA Miniscope v4, Miniscope DAQ and Open Ephys torque-free commutator with the following features: + +- toggle between one of three online data-processing pipelines for viewing (raw, saturation, ΔF/F) +- control various properties related to the Miniscope hardware, saving data, and the ΔF/F signal-processing pipeline +- toggle recording manually or with a hardware input trigger +- view real-time pixel brightness histogram +- view real-time digital input data +- commutate the UCLA Miniscope V4 tether automatically with the Open Ephys torque-free commutator + +This example GUI is intended to provide easy-to-use access to the key features of the libraries that are available in Bonsai to work with this Miniscope system. We believe it will be useful as-is for most users. However, since the GUI is itself programmed in Bonsai, users can extend the layout or remove features to fit their experimental needs. + +.. note:: + This is the first release of this Bonsai GUI for Miniscopes. If you have feedback, (i.e. feature requests, usability issues, bug fixes, etc.), please submit them as a `GitHub issue `__! + +.. toctree:: + :hidden: + + hardware + software + tutorial + description \ No newline at end of file diff --git a/source/ucla-miniscope-v4/user/miniscope-daq/gui/software.rst b/source/ucla-miniscope-v4/user/miniscope-daq/gui/software.rst new file mode 100644 index 0000000..30dc819 --- /dev/null +++ b/source/ucla-miniscope-v4/user/miniscope-daq/gui/software.rst @@ -0,0 +1,75 @@ +##################################### +Bonsai Installation and Configuration +##################################### + +#. If you have not already done so, + + #. `Download and Install Bonsai `_ + + #. `Install the necessary Bonsai packages: `_ + + #. Open Bonsai + + #. Open the Bonsai package manager: + + .. grid:: + + .. grid-item:: + :columns: 5 + + From the Bonsai landing window, select *Manage Packages* + + .. image:: /_static/images/bonsai-landing-page-package-manager-button.webp + :alt: screenshot of Bonsai landing window with *Manage Packages* text highlighted + :align: center + + .. grid-item:: + :columns: auto + :child-align: center + + or + + .. grid-item:: + :columns: 6 + + From the Bonsai workflow editor, hover over the *Tools* tab in the top ribbon to reveal a drop-down menu, and left-click *Manage Packages...*. + + .. image:: /_static/images/bonsai-workflow-editor-package-manager-button.webp + :alt: screenshot of Bonsai workflow editor with *Manage Packages...* text highlighted + :align: center + + #. Select the *Browse* tab in the top ribbon: + + .. image:: /_static/images/bonsai-package-manager-browse-button.webp + :alt: screenshot of Bonsai package manager with *Browse* tab highlighted + :align: center + :height: 400px + + #. Configure the *Package Source* field to *All* using the drop-down menu: + + .. image:: /_static/images/bonsai-package-manager-package-source-dropdown.webp + :alt: screenshot of Bonsai package manager with the Package Source drop-down highlighted + :align: center + :height: 400px + + #. Download and install the required Bonsai packages or update to the latest versions using + the Bonsai Package Manager: + + * Bonsai.StarterPack + + * OpenEphys.Miniscope + + * OpenEphys.Commutator + + * Bonsai.GUI + + For each one, search its name in the search bar, left-click its corresponding entry, and left-click the *Install* button. For example: + + .. image:: /_static/images/bonsai-starterpack.webp + :alt: screenshot of Bonsai package manager with search bar highlighted + :align: center + :height: 400px + + Click the *I Accept* button when prompted. + + diff --git a/source/ucla-miniscope-v4/user/miniscope-daq/gui/tutorial.rst b/source/ucla-miniscope-v4/user/miniscope-daq/gui/tutorial.rst new file mode 100644 index 0000000..5320eb5 --- /dev/null +++ b/source/ucla-miniscope-v4/user/miniscope-daq/gui/tutorial.rst @@ -0,0 +1,69 @@ +################# +Workflow Tutorial +################# + +#. Download the following workflow (.bonsai file) and open it with Bonsai: + + .. raw:: html + + {% with static_path = '../../../../_static', name = 'uclaminiscopev4-miniscopedaq-gui' %} + {% include 'workflow.html' %} + {% endwith %} + +#. Double-click the ``DataSource`` node and set the ``UCLAMiniscopeV4`` operator's ``Index`` + property to the value that corresponds to the index of your miniscope. + + .. grid:: + + .. grid-item:: + + .. include:: /includes/set-index.rst + + .. grid-item:: + :columns: 3 + + .. image:: /_static/images/uclaminiscopev4-properties.webp + :align: center + :alt: screenshot of ucla miniscope v4 node properties for index + +#. Set the COM port associated with your commutator in the workflow + + * Left-click the ``AutoCommutator`` node and set the ``PortName`` property under the + `Properties` pane to match the port that corresponds to your commutator. + + .. note:: + + If you are uncertain about which COM port corresponds to your commutator, follow these instructions: + + #. Open Window's *Device Manager*. + + #. Unplug the commutator, and plug it back in. Observe which COM port disappears and + appears in device manager when doing so - that is the COM port associated with your + commutator. If the commutator does not appear in device manager, follow `these + instructions `_ + +#. If you do not have a commutator connected, select the following chain of nodes and disable them + by either pressing ``Ctrl+D`` or right-clicking the selected nodes and clicking the "Disable" + option in the context menu that pops up. + + .. figure:: /_static/images/uclaminiscopev4-miniscopedaq-gui_commutate-disable.svg + :align: center + :alt: screenshot of nodes to be disabled if no commutator is connected + + Disable this row that performs commutation if no commutator is connected. + +#. If you want to change the FourCC, click the "SaveData" ``GroupWorkflow`` and edit it from the + properties panel. + +#. Run the workflow. Double-click the ``Miniscope GUI`` node and expand the visualizer that pops + up. + +#. Using the GUI, you can: + + - toggle between one of three online data-processing pipelines for viewing (raw, saturation, ΔF/F) + - control various properties related to the Miniscope hardware, saving data, + and the ΔF/F signal-processing pipeline + - toggle recording manually or with a hardware input trigger + - view real-time pixel brightness histogram + - view real-time digital input data + - commutate the UCLA Miniscope V4 tether automatically with the Open Ephys torque-free commutator diff --git a/source/ucla-miniscope-v4/user/miniscope-daq/index.rst b/source/ucla-miniscope-v4/user/miniscope-daq/index.rst index 8fc487d..c817b0d 100644 --- a/source/ucla-miniscope-v4/user/miniscope-daq/index.rst +++ b/source/ucla-miniscope-v4/user/miniscope-daq/index.rst @@ -15,7 +15,7 @@ The User Guide contains following tutorials: * :doc:`Commutate the UCLA Miniscope's tether using the on-board IMU ` For an extensive overview of the Miniscope-DAQ, refer to :ref:`its section ` of the :doc:`/overview/data-acq-hardware` page. - + .. toctree:: :hidden: @@ -23,3 +23,4 @@ For an extensive overview of the Miniscope-DAQ, refer to :ref:`its section