Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brain network ideas? #77

Open
seantma opened this issue Jan 31, 2018 · 2 comments
Open

Brain network ideas? #77

seantma opened this issue Jan 31, 2018 · 2 comments

Comments

@seantma
Copy link

seantma commented Jan 31, 2018

@bwlewis Thank you for this great package that helps convey ideas on paper onto visual graphs that is approachable.

I'm trying to use rthreejs to render some brain activity networks under a glass brain for interactive purposes. After searching the threejs website and forum, most of the brain related projects are focused on rendering surfaces.

My idea is rather to combine graphjs() with globejs() without the globe but substitute it with a glass brain that has its own 3d coordinates.

Any suggestions or pointers where I can get started? Many thanks!

Sean

@bwlewis
Copy link
Owner

bwlewis commented Jan 31, 2018

Hmmm. I think instead of globejs, a rather hacky function, one approach might be to plot points in 3d with scatterplot3js (graphjs actually calls scatterplot3js under the hood).

the thing to add would be the three-d glass brain image. That would require additions to the JavaScript code. One possibility is to add the ability to import a 3d texture from a file or url, for example x3d (https://en.wikipedia.org/wiki/X3D). See this example:

https://threejs.org/examples/#webgl_loader_x

For example, maybe add an option to the R scatterpot3js function like x3d="file.x" or whatever. Then just display that 3d texture in the scatterplot, probably as a new THREE.Object3d(). You could then layer whatever points/lines you want over that.

Just a thought...

Note that the globejs() function is much dumber. It maps a 2-d image onto a sphere only, and is not capable of displaying generic 3d textures.

@bwlewis
Copy link
Owner

bwlewis commented Mar 3, 2018

Check this experimental function out render:

devtools::install_github("bwlewis/rthreejs")
threejs::render(gzfile(system.file("extdata/pump.json.gz", package="threejs")), bg="black")

Also see ?threejs::render.

Right now, this is a super-basic implementation that just displays a JSON-encoded threejs scene. The plan is to add a few basic functions to help build threejs scenes up easily from R. Then we can visualize and animate just about anything. This is similar to R's rgl package, but with a threejs focus.

What do you think of this approach?

Would anyone like to help add some functions to help build up threejs scenes from R?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants