MaMuT - Manual color: float to RGB and RGB to float?



Dear all,

I have a question regarding the definition of spot colors in MaMuT.

I can add the color of my choice manually to a spot by right clicking on a spot in the TrackScheme and entering the RGBA values of the color I need. This color is later stored as an integer (for instance, red, e.g. [255, 0, 0, 255] is stored as -65536).
Instead of changing the colors of the spots manually one by one, I would like to modify directly the value in the field “MANUAL_COLOR” of the .xml. I have been scratching my head quite a while to find the correspondance between my RGB values and the float, but I can’t find the solution. I recall @tinevez told me a while a ago that color what coded in 8 bits in MaMuT.
I found that colors can be written in 24 bit true color: for instance (example comes from this document:, yellow [255,255,0] can be written 255 + 255*2^8 + 0*2^{16} = 65535. However, this does not take into account the value of alpha, and can only produce positive integers.

Would you know how I can convert colors (in RGB or HEX) to their equivalent integer in MaMuT, and also how to interpret the integers from MaMuT as RGB/HEX colors?

Many thanks in advance.


The color int value is directly encoded to and decoded from Color using the builtin java.awt.Color methods:


with hasAlpha set to true.
Hope this helps.


Many thanks, the name of the functions set me on the right track!
I found more information on what does the getRGB function, here:

This is very helpful for the R package I am currently writing to export and analyse MaMuT data in R (soon on my GitHub…).

Best regards,