question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Render volumetric heatmaps on top of brain structures

See original GitHub issue

Hi! This is a duplicate of an issue that I posted yesterday on the official vedo repository (https://github.com/marcomusy/vedo/issues/209). I wasn’t sure anymore whether it fits best as separate brainrender or as a vedo issue (given that not all features of vedo are enabled in brainrender?). I think it is also similar to this issue: https://github.com/BrancoLab/brainrender/issues/105.

What I want is to display some kind of volumetric heatmap, which I constructed as numpy array in the dimensions of the reference brain (allen 25 um), on top of some brain structures.

actor = Volume(
        my_numpy_3d_volume,
        spacing=[25, 25, 25], 
        alpha=.5,
        alphaUnit=.5
    )
actor = actor.legosurface(vmin=np.nanmin(score_map)+0.25, cmap='inferno')

The my_numpy_3d_volume contains a bunch of scores (but mostly nans). I am able to utilise .legosurface to display the volume at the correct location, which is great. However, what I really want is some kind of “smooth point cloud” that is mostly transparent where the original volume contains nans. What happens when I use .legosurface is that I get a volume with pretty jagged edges which distracts from the actual information that I want to shine through (a smooth blob in the center). I can smooth the volume, but that also smoothes the values inside, which is not what I want. Do you have any tipps on how to do this kind of stuff?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
marcomusycommented, Sep 22, 2020

@FedeClaudi correct!

One other trick to see the inside is to transform the volume into a mesh, eg.:

from vedo import *
vol = load(datadir+'embryo.tif')
msh = vol.tomesh().clean()
msh.cutWithPlane(origin=(14000,0,0), normal=(1,1,1)).cmap('gist_ncar')
show(vol, msh, N=2, axes=1)

image

Note that this is feasible if the volume is relatively small.

2reactions
FedeClaudicommented, Sep 14, 2020

this is how I do it for gene expression data. I don’t know how it works with nans but yeah you can convert them to some numeric value before thresholding if that’s causing you problems.

I haven’t played around with it, but you might be able to change the appearance of the mesh you get from lego surface. In vedo when legosurface is created: https://github.com/marcomusy/vedo/blob/c8d5b3fcdeea49a89e74f3b4dd9dc86d7c08b42e/vedo/base.py#L1428

it sets lw to 0.1, which I think it’s why you see the voxels edges. You can try to do .lw(0) to see if that works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using brainrender for whole brain visualization - YouTube
Learn how to use BrainRender and Napari to annotate and explore whole- brain datasets ... Visualizing imaging regions or probe placements.
Read more >
Construction of 3D place fields. (A) Top, heat map of spike rate ...
(A) Top, heat map of spike rate for one neuron during an experimental flight session for ... (B) 3D rendering of the place...
Read more >
High-Resolution Digital Panorama of Multiple Structures in ...
The workflow employed the steps that include virtual channel splitting, feature enhancement, iso-surface rendering, direct volume rendering, and ...
Read more >
High-Resolution Digital Panorama of Multiple ... - NCBI
Aβ plaques are surrounded by multiple brain structures such as ... High-precision volume rendering of 400-μm-thick slices similar to the ...
Read more >
Spatial-data-driven layouting for brain network visualization
Left: Strongest structural connections (top 2%) within the cerebral cortex of a mouse ... These views comprise a 3D volume/mesh rendering, a 2D...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found