From 30218bdc28efe6b6f7ca46e3b28c3a4fe0a23d42 Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Tue, 12 Sep 2023 07:52:15 -0700 Subject: [PATCH 01/12] testing a different structure for development pages --- source/about/development.rst | 17 +++++++++++++++++ source/api_reference_tp.rst | 18 ------------------ source/api_reference_urn_csharp.rst | 4 ---- 3 files changed, 17 insertions(+), 22 deletions(-) create mode 100644 source/about/development.rst delete mode 100644 source/api_reference_tp.rst delete mode 100644 source/api_reference_urn_csharp.rst diff --git a/source/about/development.rst b/source/about/development.rst new file mode 100644 index 0000000..e0209e3 --- /dev/null +++ b/source/about/development.rst @@ -0,0 +1,17 @@ +================== +Development +================== + + +Contents: +--------- + +.. toctree:: + :maxdepth: 2 + :caption: Table of Contents + + misc/general + misc/brain_atlas + pinpoint/development + urchin/development + ephys_link/development \ No newline at end of file diff --git a/source/api_reference_tp.rst b/source/api_reference_tp.rst deleted file mode 100644 index 2fed635..0000000 --- a/source/api_reference_tp.rst +++ /dev/null @@ -1,18 +0,0 @@ - -Pinpoint -=============================================== - -.. .. autosummary:: -.. :toctree: _autosummary -.. :template: custom-module-template.rst -.. :recursive: - -.. unityneuro - -.. .. doxygenclass:: UM_Client -.. :project: urchin -.. :members: - -.. .. doxygenclass:: UM_Launch -.. :project: urchin -.. :members: \ No newline at end of file diff --git a/source/api_reference_urn_csharp.rst b/source/api_reference_urn_csharp.rst deleted file mode 100644 index 8f1ca41..0000000 --- a/source/api_reference_urn_csharp.rst +++ /dev/null @@ -1,4 +0,0 @@ -UnityClient -=============================================== - -The Renderer runs as a Unity Client application. Documentation coming soon... From 26af92b3a0ce487c99712f64a12f7c38c1c85c30 Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Tue, 12 Sep 2023 07:55:56 -0700 Subject: [PATCH 02/12] Update index.rst --- source/index.rst | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/source/index.rst b/source/index.rst index ab26383..690c655 100644 --- a/source/index.rst +++ b/source/index.rst @@ -48,18 +48,6 @@ Please see the individual projects for installation instructions and documentati urchin/tutorial ibl/ibl_tools - -.. toctree:: - :hidden: - :maxdepth: 3 - :caption: Development - - misc/general - misc/brain_atlas - pinpoint/development - urchin/development - ephys_link/development - .. toctree:: :hidden: :maxdepth: 2 @@ -67,6 +55,7 @@ Please see the individual projects for installation instructions and documentati about/overview about/vbl_manual + about/development about/contract_us .. toctree:: From c75af3ce09377b5e913585064b2be7bdfda4f67a Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Tue, 12 Sep 2023 08:00:45 -0700 Subject: [PATCH 03/12] wrong depth for development file? --- requirements.txt | 2 +- source/{about => }/development.rst | 0 source/index.rst | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename source/{about => }/development.rst (100%) diff --git a/requirements.txt b/requirements.txt index 0c899eb..3615c70 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ ephys-link==0.9.11 myst-parser==2.0.0 sphinx==6.2.1 sphinx-rtd-theme==1.3.0 -oursin==0.4.8 +oursin \ No newline at end of file diff --git a/source/about/development.rst b/source/development.rst similarity index 100% rename from source/about/development.rst rename to source/development.rst diff --git a/source/index.rst b/source/index.rst index 690c655..b9047f7 100644 --- a/source/index.rst +++ b/source/index.rst @@ -55,7 +55,7 @@ Please see the individual projects for installation instructions and documentati about/overview about/vbl_manual - about/development + development about/contract_us .. toctree:: From 31f88f0315779f60c281a2749a336904771e33c4 Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Tue, 12 Sep 2023 08:04:18 -0700 Subject: [PATCH 04/12] remove redundant header --- source/development.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/source/development.rst b/source/development.rst index e0209e3..07e64cc 100644 --- a/source/development.rst +++ b/source/development.rst @@ -2,10 +2,6 @@ Development ================== - -Contents: ---------- - .. toctree:: :maxdepth: 2 :caption: Table of Contents From 9a4bb347625c31492384e467fcbcb7289f8b41b7 Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Tue, 12 Sep 2023 16:16:46 -0700 Subject: [PATCH 05/12] testing adding a grid of collaborators instead of individual images --- source/about/overview.md | 51 ++++++++++++++++++++++++++-------------- source/conf.py | 3 +++ source/custom.css | 24 +++++++++++++++++++ 3 files changed, 61 insertions(+), 17 deletions(-) create mode 100644 source/custom.css diff --git a/source/about/overview.md b/source/about/overview.md index d4d1118..229c4d6 100644 --- a/source/about/overview.md +++ b/source/about/overview.md @@ -47,23 +47,40 @@ Selina is piloting new 2-photon integrations in Urchin. ### Collaborators -Mayo Faulkner - -**[Mayo Faulkner, PhD](https://uk.linkedin.com/in/mayo-faulkner-592a8387)** - -User Experience Engineer - International Brain Laboratory - -Cyrille Rossant - -**[Cyrille Rossant, PhD](https://cyrille.rossant.net/about/)** - -Scientific Programmer - International Brain Laboratory - -Yoni Browning - -**[Yoni Browning, PhD](https://www.representations.space/)** - -Scientist - Allen Institute +
+ +
+ Mayo Faulkner +

Mayo Faulkner, PhD

+

UX Engineer - IBL

+
+
+ Cyrille Rossant +

Cyrille Rossant, PhD

+

Scientific Programmer - IBL

+
+
+ Yoni Browning +

Yoni Browning, PhD

+

Scientist - Allen Institute

+
+ + +
*** diff --git a/source/conf.py b/source/conf.py index 4ead4d5..4099da7 100644 --- a/source/conf.py +++ b/source/conf.py @@ -53,6 +53,9 @@ # html_theme = 'sphinx_rtd_theme' +# Include your custom CSS file +html_css_files = ['custom.css'] + # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". diff --git a/source/custom.css b/source/custom.css new file mode 100644 index 0000000..871abf0 --- /dev/null +++ b/source/custom.css @@ -0,0 +1,24 @@ +/* Center-align text */ +.collaborator { + text-align: center; +} + +/* Style the collaborator images */ +.collaborator img { + max-width: 148px; /* Adjust the image width as needed */ +} + +/* Add some spacing between collaborators */ +.collaborator + .collaborator { + margin-top: 20px; /* Adjust the spacing as needed */ +} + +/* Style collaborator names */ +.collaborator-name { + font-weight: bold; +} + +/* Style collaborator positions */ +.collaborator-position { + font-style: italic; +} From e441714347e32d74fc82a4c3b346eb741e2f4ef2 Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Tue, 12 Sep 2023 16:22:58 -0700 Subject: [PATCH 06/12] Update conf.py --- source/conf.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/conf.py b/source/conf.py index 4099da7..eb340c0 100644 --- a/source/conf.py +++ b/source/conf.py @@ -53,8 +53,10 @@ # html_theme = 'sphinx_rtd_theme' -# Include your custom CSS file -html_css_files = ['custom.css'] +html_context = { + # ... + 'css_files': ['custom.css'], +} # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, From 7580711eefd52e6a7cb8470f8e0baa242de29c29 Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Tue, 12 Sep 2023 16:25:17 -0700 Subject: [PATCH 07/12] another try --- source/{ => _static/css}/custom.css | 0 source/conf.py | 8 +++----- 2 files changed, 3 insertions(+), 5 deletions(-) rename source/{ => _static/css}/custom.css (100%) diff --git a/source/custom.css b/source/_static/css/custom.css similarity index 100% rename from source/custom.css rename to source/_static/css/custom.css diff --git a/source/conf.py b/source/conf.py index eb340c0..37cbfe0 100644 --- a/source/conf.py +++ b/source/conf.py @@ -53,11 +53,9 @@ # html_theme = 'sphinx_rtd_theme' -html_context = { - # ... - 'css_files': ['custom.css'], -} - +def setup(app): + app.add_css_file('css/custom.css') # may also be an URL + # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". From 386c49292a449ec2bc9a3e6fb4452c8802f7b901 Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Tue, 12 Sep 2023 16:31:59 -0700 Subject: [PATCH 08/12] switching back because that code broke something --- source/_autosummary/unityneuro.render.rst | 91 ----------------------- source/conf.py | 6 +- 2 files changed, 3 insertions(+), 94 deletions(-) delete mode 100644 source/_autosummary/unityneuro.render.rst diff --git a/source/_autosummary/unityneuro.render.rst b/source/_autosummary/unityneuro.render.rst deleted file mode 100644 index 5a8ceee..0000000 --- a/source/_autosummary/unityneuro.render.rst +++ /dev/null @@ -1,91 +0,0 @@ -unityneuro.render -================= - -.. automodule:: unityneuro.render - - - - - - - - .. rubric:: Functions - - .. autosummary:: - :nosignatures: - - change_id - clear - clear_areas - clear_neurons - clear_probes - clear_texts - clear_volumes - close - connect - connected - create_neurons - create_probes - create_text - create_volume - delete_neurons - delete_probes - delete_text - delete_volume - disconnect - load_beryl_areas - load_cosmos_areas - message - set_allen_volume_visibility - set_area_alpha - set_area_color - set_area_colormap - set_area_data - set_area_data_index - set_area_intensity - set_area_material - set_area_visibility - set_camera_pan - set_camera_position - set_camera_rotation - set_camera_target - set_camera_target_area - set_camera_zoom - set_neuron_colors - set_neuron_materials - set_neuron_positions - set_neuron_shapes - set_neuron_sizes - set_probe_angles - set_probe_colors - set_probe_positions - set_probe_size - set_text - set_text_colors - set_text_positions - set_text_sizes - set_volume_colormap - set_volume_data - set_volume_slice_data - set_volume_visibility - setup - - - - - - .. rubric:: Classes - - .. autosummary:: - :nosignatures: - - bcolors - - - - - - - - - diff --git a/source/conf.py b/source/conf.py index 37cbfe0..4099da7 100644 --- a/source/conf.py +++ b/source/conf.py @@ -53,9 +53,9 @@ # html_theme = 'sphinx_rtd_theme' -def setup(app): - app.add_css_file('css/custom.css') # may also be an URL - +# Include your custom CSS file +html_css_files = ['custom.css'] + # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". From 81ab25eb6ef73f6361768aaf40dad488e5d62c5d Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Tue, 12 Sep 2023 16:33:44 -0700 Subject: [PATCH 09/12] Moving css file --- source/_static/{css => }/custom.css | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename source/_static/{css => }/custom.css (100%) diff --git a/source/_static/css/custom.css b/source/_static/custom.css similarity index 100% rename from source/_static/css/custom.css rename to source/_static/custom.css From 10f9769c57f503a0f8336d9bb73e73641fadcefe Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Tue, 12 Sep 2023 16:37:03 -0700 Subject: [PATCH 10/12] Another attempt --- source/custom.css | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 source/custom.css diff --git a/source/custom.css b/source/custom.css new file mode 100644 index 0000000..6729bdf --- /dev/null +++ b/source/custom.css @@ -0,0 +1,21 @@ +.collaborator-grid { + display: grid; + grid-template-columns: repeat(3, 1fr); /* Three equal-width columns */ + gap: 20px; /* Adjust the gap between items as needed */ +} + +.collaborator { + text-align: center; +} + +.collaborator img { + max-width: 100%; /* Adjust the image width as needed */ +} + +.collaborator-name { + font-weight: bold; +} + +.collaborator-position { + font-style: italic; +} From e21740f94536af5ac75acf458baf8245186208c4 Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Tue, 12 Sep 2023 16:42:21 -0700 Subject: [PATCH 11/12] Update Urchin development page --- source/urchin/development.md | 55 +++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/source/urchin/development.md b/source/urchin/development.md index aedd5e6..bd8bc12 100644 --- a/source/urchin/development.md +++ b/source/urchin/development.md @@ -2,11 +2,23 @@ ## Organization -Urchin is organized into three parts. A client, server, and renderer. The only client right now is the Python API, but in the future we may build other APIs (MATLAB, R). The Server is a Node.js server that echoes messages between clients and renderers. The Renderer is a Unity app that can run either as a standalone desktop build or in the browser. +Urchin is organized into three parts. An API, server, and renderer. -### Virtual environment +### API -To develop for Urchin you will need to run a local copy of the client, server, and Unity builds. For the Python API you will need a new virtual environment with `unityneuro` installed in **editable** mode. +The Python API allows users to push and get data to the serverer and to a renderer instance. + +### Server + +The server runs both an HTTP REST endpoint and a Node.js Socket.IO server. The REST endpoints allow users to push new datasets to the server and retrieve them from data buckets, see below. The Socket.IO server acts as a proxy between a client API and the renderer itself, this can be used for testing visualizations without saving the data or for grabbing screenshot or video data back from the renderer. + +### Renderer + +The renderer is a standalone WebGL or Desktop client that displays data alongside anatomical reference atlases. + +## Virtual environment + +To develop for Urchin you will need to run a local copy of the client, server, and Unity builds. For the Python API you will need a new virtual environment with `oursin` installed in **editable** mode. To setup the venv go into the API folder and run: @@ -16,17 +28,27 @@ urchin-venv/Scripts/activate pip install -e . ``` -### Adding new functionality +Updates you make to the code will then be accessible by restarting your Python kernel. + +## Adding new functionality To add a new render function you need three pieces: - 1. Update `API/urchin/renderer.py` to include the new function and add documentation + 1. Add the new API documentation 2. Add the `socket.io` call to the set of calls in `Server/server.js` 3. Add the new functionality to the UnityClient in `Client.cs` and in your manager class -Before deploying you should add a new test script in `Examples/basic` which runs your new functionality and makes sure that it works. +Before deploying you should add a new test script in the [urchin-examples](https://github.com/VirtualBrainLab/urchin-examples) repository which runs your new functionality and makes sure that it works. + +### Schema -#### Urchin (API/unityneuro/render.py) +Schemas are stored in the `Schema/` folder. They have the following pattern: + +``` +? +``` + +### Python (oursin package) The Urchin API has two patterns for inputs, a single object (singular) pattern and a multi-object (plural) pattern. They should in general look like this: @@ -64,11 +86,17 @@ Examples """ ``` -#### Server (Server/server.js) +#### Testing + +Unit tests should test that the functions generate valid JSON and that the sanitizing functions perform their job correctly for a variety of inputs. + +### HTTP REST Server (HTTPServer/?) + +### Socket.IO Server (Server/server.js) The server calls just echo the data from the sender (API) to the receiver (Unity). Copy any of the existing calls and replace the message headers. Please keep the server organized. -#### Unity (Client.cs and your manager code) +### Unity (Client.cs and your manager code) Your code in Unity should be separated into two layers. All socket messages should be received in the `Client.cs` class and then passed on to a `XXManager.cs`. The `Client` handles all socket communication, while the `Manager` handles all of the Unity local content. Keep managers separated by functionality (e.g. `ProbeManager`, `NeuronManager`, `LineRendererManager`, etc). @@ -77,18 +105,17 @@ Your code in Unity should be separated into two layers. All socket messages shou To test your code locally, run the server on your local machine by navigating to the `Server/` folder and running `node server.js`. Then, run client in standalone localhost mode: ``` -urn.setup(localhost=True, standalone=True) +import oursin as urchin +urchin.setup(localhost=True, standalone=True) ``` -You should see the client connect with your username as ID on the server window. - Finally, run the Unity renderer app in the editor. You may need to manually set your username as the ID in the app if it doesn't detect it automatically (either via code in `Client.cs` or by pressing `I` and opening the ID input window). ## Deployment ### Deploying the client -The client is accessed by users in two ways: either through the [web server](http://data.virtualbrainlab.org/UMRenderer/) or through a standalone desktop app which we include in each minor version release. To deploy a new client you need to take a few steps. +The client is accessed by users in two ways: either through the [web server](http://data.virtualbrainlab.org/Urchin/) or through a standalone desktop app which is deployed on Steam. To deploy a new client you need to take a few steps. 1. If you changed the Addressable assets or updated to a new version of Unity you need to re-build the assets. Do this for each build target separately. Then copy the `UnityClient/ServerData` folder to the `htdocs/UMData` subfolder on the server. 2. Build the WebGL target build, then copy this to the `htdocs/UMRenderer` subfolder on the server. @@ -111,4 +138,4 @@ py -m twine upload dist/* #### On Heroku -Every time the github repository is pushed the Heroku server will re-build. You will get back a 503 server response if there are errors in the code running on Heroku. +Every time the github repository is pushed the Heroku server will re-build. You will get back a 503 server response if there are errors in the code running on Heroku. \ No newline at end of file From a0ea69919156446a449980022b5170563a33f99a Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Tue, 12 Sep 2023 16:42:27 -0700 Subject: [PATCH 12/12] modified incorrect custom.css file --- source/_static/custom.css | 17 +++++++---------- source/custom.css | 21 --------------------- 2 files changed, 7 insertions(+), 31 deletions(-) delete mode 100644 source/custom.css diff --git a/source/_static/custom.css b/source/_static/custom.css index 871abf0..6729bdf 100644 --- a/source/_static/custom.css +++ b/source/_static/custom.css @@ -1,24 +1,21 @@ -/* Center-align text */ +.collaborator-grid { + display: grid; + grid-template-columns: repeat(3, 1fr); /* Three equal-width columns */ + gap: 20px; /* Adjust the gap between items as needed */ +} + .collaborator { text-align: center; } -/* Style the collaborator images */ .collaborator img { - max-width: 148px; /* Adjust the image width as needed */ -} - -/* Add some spacing between collaborators */ -.collaborator + .collaborator { - margin-top: 20px; /* Adjust the spacing as needed */ + max-width: 100%; /* Adjust the image width as needed */ } -/* Style collaborator names */ .collaborator-name { font-weight: bold; } -/* Style collaborator positions */ .collaborator-position { font-style: italic; } diff --git a/source/custom.css b/source/custom.css deleted file mode 100644 index 6729bdf..0000000 --- a/source/custom.css +++ /dev/null @@ -1,21 +0,0 @@ -.collaborator-grid { - display: grid; - grid-template-columns: repeat(3, 1fr); /* Three equal-width columns */ - gap: 20px; /* Adjust the gap between items as needed */ -} - -.collaborator { - text-align: center; -} - -.collaborator img { - max-width: 100%; /* Adjust the image width as needed */ -} - -.collaborator-name { - font-weight: bold; -} - -.collaborator-position { - font-style: italic; -}