Custom / User-specified colourmap

Dear all,

I would like to visualize a set of streamlines with my own user-specified colourmap (and using the -tractography.tsf_load option).

Is there some workaround for creating a custom colourmap (given known RGB triplets)? I have tried looking into the colourmap.cpp, but that didn’t lead me very far.

I’m using the Ubuntu 16.04 and an MRtrix3 version built on June 2018.

Many thanks,
Roey

No, I’m afraid there’s no such functionality at the moment. It’s come up before in different contexts, but we’ve not had time to put into making it happen. Feel free to file a feature request as an issue on Github.

As to implementing your own colourmap directly: the current code would make it tricky to implement in the way you might expect, since each colourmap is implemented as code injected directly into the OpenGL fragment shader - it’s not a look-up like in Matlab, etc.

What colourmap where you after implementing anyway?

Hi Donald,

Thank you for the detailed response.

I see, indeed it doesn’t sound like there’s a straightforward solution. I was interested in implementing one of the perceptually uniform colourmaps available in matplotlib.

I will file a feature request as you suggested.

Thanks again.

I recently commented in an old closed GitHub issue that while Matlab’s parula is off-limits, the matplotlib perceptually uniform colourmaps are pretty good. One challenge for incorporation of such into mrview is that each colourmap must be defined both in GLSL and as a C++ functor; so need to figure out how to store a colourmap table as a texture and then control fragment colour using it :nerd_face: