Skip to content

3d rendering of nii volumes #7

@PolarBean

Description

@PolarBean

by setting the alpha channel to be the same value as the channel (multiplied by some large value) it is possible to render great semi transparent views of precomputed volumes in the volumetric rendering window.
ie; https://tinyurl.com/bfay8aem
and: https://t.co/pi2k3D3Wit

here is an example of a shader with the magma colormap (this is applied in the first link)

// iav-colormap-is-magma

      vec3 magma(float t) {
      
          const vec3 c0 = vec3(-0.002136485053939582, -0.000749655052795221, -0.005386127855323933);
          const vec3 c1 = vec3(0.2516605407371642, 0.6775232436837668, 2.494026599312351);
          const vec3 c2 = vec3(8.353717279216625, -3.577719514958484, 0.3144679030132573);
          const vec3 c3 = vec3(-27.66873308576866, 14.26473078096533, -13.64921318813922);
          const vec3 c4 = vec3(52.17613981234068, -27.94360607168351, 12.94416944238394);
          const vec3 c5 = vec3(-50.76852536473588, 29.04658282127291, 4.23415299384598);
          const vec3 c6 = vec3(18.65570506591883, -11.48977351997711, -5.601961508734096);
      
          return c0+t*(c1+t*(c2+t*(c3+t*(c4+t*(c5+t*c6)))));
      
      }
    
void main() {
  float raw_x = toNormalized(getDataValue());
  float x = (raw_x - 0.0000000001) / (0.23) - 0.0000000000;

  
    vec3 rgb;
    rgb=magma(x);
    emitRGBA(vec4(rgb*exp(0.0000000000),
                  clamp(x*255.0,0.0,256.0)));
  
}

alpha can either be a single digit or an array of values with the same shape as a single channel of the data.

The issue with this is that in many cases it can screw up the XY 2d views since the same shader is applied to both volumetric rendering and the 2d view. So some trickery may be required (for instance loading them as seperate but linked layers).

Another requirement is making sure the volumetric rendering option is specified here:
image
And I am not sure if this is available in your current branch of neuroglancer.

All the best,

Harry

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions