xtk

Can you apply colour maps to volume renders?


Every example I have seen only renders in greyscale.

Is there a way to map scalar volumes in voxels to colours? ( similar to vtkColorTransferFunction in VTK for example?)

If there is no support for this out of the box, how difficult would it be for us to add that capability?


Solution

  • So far, only min and max colors are supported (lesson 15).

    ...
    r.onShowtime = function() {
    v.minColor = [0, 0.06666666666666667, 1];
    v.maxColor = [0.5843137254901961, 1, 0];
    };
    ...
    

    You could also use a custom labelmap/color table as a hack for now (lesson 11).

    There is no easy mechanism to support it right now but this is on the TODO list and should not be too hard to implement.

    Please feel free to contribute to XTK on github, this would be a very useful addition! https://github.com/xtk/X

    Thanks