Skip to content

CML's brain visualization tool reworked and remade in Unity. Embedded into CML's django web app using WebGL.

Notifications You must be signed in to change notification settings

pennmem/brain_viz_unity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

brain_viz_unity

This is a Unity project which uses html requests to our web app to provide a graphical interface for brain vizualization. The data visualized includes 3D brain models, electrode locations, and prior stim sites.

To deploy the app

The project is intended to be built for WebGL and placed within our web app. The web app then serves up the brain vizualization app on its /brain/ page. To deploy the project:

  1. Use the unity editor to build to WebGL. (File menu -> Build Settings -> Make sure that "brain" scene is checked under "Scenes in build" and that WebGL is selected under platform -> click "Build" -> select an output location.)
  2. Find the folder which Unity generates in the selected output location, and within that folder, the subfolder called "Build."
  3. Update the cml web project to include your new build by replacing the cml-web/static/brain/unity_web_app/Build folder. Note you will need to update the web app on rhino using tmux on the ram_maint account before your change is reflected on the actual running web app. (Optionally also replace TemplateData and logo.png, which are used for css styling of the page the web app is on.)

The web app's responses to the requests of this vizualizer depend on data generated by the brain vizualization pipeline. For information about that pipeline, see https://github.com/pennmem/neurorad_pipeline and our cml-web project on gitlab. To speed up the loading of 3D brain models, Unity can also generate asset bundles. Note the vizualizer first requests asset bundles from the web app, and then regular .objs if an asset bundle isn't available.

To generate assetBundles

To generate asset bundles, create a new scene containing only one objSpawner component on a GameObject, or use the provided "baker" scene. Then use the functions of Editor/CreateAssetBundles.cs which can be triggered by options in the Assets menu (next to the File menu in the upper left of the screen.)

  1. "Download Brains" option. Download Brains in the unity editor. Do this in a scene with an objSpawner, and note that downloading all brains will take a while. The editor is single threaded and will freeze while downloading- you can check progress by looking at requests on the server.
  2. "Create Prefab From Selected" option. Create prefabs of the brains you want to make asset bundles for. Do this by selecting the downloaded brains in the scene first.
  3. "Build Asset Bundles." Build prefabs into asset bundles. This will automatically build all assets bundles. Prefabs will already have been added to the correct asset bundle. This is fast-ish. The bundles will be output to /AssetBundles .

The resultant asset bundles should be uploaded to rhino. They will then be served to the brain viz app upon request. The web app expects asset bundles to be: data10/eeg/freesurfer/subjects/R????X/surf/roi/r????x . (note the capital R and X in the subject directory, and lowercase r and x in the filename. note the file has no extension.)

Note that there is a store of already built asset bundles on box under "system 3 installers/unity brain viz app."

About

CML's brain visualization tool reworked and remade in Unity. Embedded into CML's django web app using WebGL.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published