Ngl: Volume custom color?

Created on 20 Jan 2017  路  5Comments  路  Source: nglviewer/ngl

hi, is there a way to customize the color of a volume. I'm not talking about a flat color but a "per voxel" color. For density maps we can get local resolutions values which tell us how accurate is that voxel.

This is how it looks in Chimera:
image

The information we are passing to quimera is:
a) The volume itself (this is already in place and works like a charm, thanks)
b) A second volume (same dimensions) with the local resolution values.
c) The color scale (basically, a color ramp/map, an array of [(resolution, color),...]). We do not pass all the existing values but the extremes and some points in the middle. Currently we are defining a color ramp with 20 "steps". Values in the middle are interpolated by chimera. But the simplest color ramp would be [(17,"green"), (4, "yellow")] (could be html colors). 17 and 4 would be the min and max values of the "second volume".

Resmap documentation: http://resmap.sourceforge.net/#

I'll be happily disappointed if it's already doable....all my explanation is because I assumed is not.

All the best, Pablo.

question

Most helpful comment

Hi, made it work, will push tomorrow. A teaser image today :)

screen shot 2017-01-26 at 5 08 30 pm

All 5 comments

Hey, if I understand you correctly, this is possible using the volume colorscheme. However I think it has never been tried for surfaces generated from a volume map. If you can provide me with example files (the smaller the better, so I can add it to the repository) I am happy to try it out. Sorry for the wait, and sorry for the likely disappointment ;)

volComp.addRepresentation( "surface", {
    volume: resmapComp.volume,
    colorScheme: "volume",
    colorScale: "roygb",
    colorDomain: [ 4, 17 ]
} );

No worries about the delay.
I've attached a zip file with:
1.- A volume (.mrcs)
2.- A .vol with the values for colors, not sure if this format is supported...(I'll upload a second zip with both mrcs)
3.- A quimera script to run
ChimeraSurfaceColor.zip

Same here but with 2 mrcs files instead of mrcs + .vol.

ChimeraSurfaceColor2Mrcs.zip

Pablo, a happy disappointed user. ;-)

Hi, made it work, will push tomorrow. A teaser image today :)

screen shot 2017-01-26 at 5 08 30 pm

wow! This is great, could you please, pase the line code you've used. I can't be more happy now about this software. Very impressive. Congratulations!

This required some code changes which I just pushed. You can now supply the voxelSize for maps and color volume-derived surfaces by another surface. I also added to following example

Promise.all([
    stage.loadFile( "data://betaGal.mrc" ),
    stage.loadFile( "data://localResolution.mrc", { voxelSize: 3.54 } )
]).then( function( l ){
    var betaGal = l[ 0 ];
    var localResolution = l[ 1 ];
    betaGal.addRepresentation( "surface", {
        colorVolume: localResolution.volume,
        colorScheme: "volume",
        colorScale: "rwb",
        colorDomain: [ 7, 14 ]
    } );
    localResolution.addRepresentation( "dot", {
        thresholdMin: 0,
        thresholdMax: 8,
        thresholdType: "value",
        dotType: "sphere",
        radius: 0.6,
        colorScheme: "value",
        colorScale: "rwb",
        colorDomain: [ 7, 14 ]
    } );
    stage.centerView();
} );
Was this page helpful?
0 / 5 - 0 ratings

Related issues

sunhwan picture sunhwan  路  4Comments

arose picture arose  路  3Comments

garyo picture garyo  路  5Comments

iwatobipen picture iwatobipen  路  4Comments

hainm picture hainm  路  8Comments