help > Custom Color Map
Showing 1-3 of 3 posts
Display:
Results per page:
Nov 21, 2018  08:11 PM | Renante Rondina - Rotman Research Institute
Custom Color Map
Hello,

I have been using BrainNet for some time now, and am comfortable with the GUI, but I am not very proficient at coding. I had a question about customizing the color map.

I am interested in displaying node data that ranges from negative to positive values (e.g., -11 to +4), with a gradient to the color map so that nodes with more extreme values are either more saturated or have a different hue (e.g., warmer vs. cooler). I also need to threshold my data so that nodes with mid-range values (e.g., -3 to +3) do not appear on the brain map. Ideally, the colors corresponding to those mid-range values would appear as white or colorless on the color map, similar to the colormap shown on the right side of this image: https://hughpumphrey.files.wordpress.com/2017/06/bwr.png

However, there is nothing similar in the preset options when selecting nodal color. Currently, I am using a Jet scale and have removed data points with mid-range values from the input file. Please see attached file for an example output image. Note that this image does not contain any nodes with mid-range values, which would correspond to colors from yellow to redish-orange on the color map. However, this creates a problem when interpreting multiple images with different scales as the colors corresponding to mid-range values changes in the color map from image to image.

Are there any available patches or custom-made maps that would be suitable for my purposes?
Please let me know,
Thank you in advance
Attachment: delay_Theta.tif
Nov 30, 2018  01:11 AM | Mingrui Xia
RE: Custom Color Map
Hi, 

I wrote a small function to help generate the color map you need. This function can adjust an original continuous color map by adding a blank corresponding to your need. Then this adjusted color map can be input as the custom colormap in GUI.

For example, in your case: 

First, generate the same colormap as in the image (without the white part):
original_color_map = [linspace(22,208,5),ones(1,5)*255;linspace(22,208,5),linspace(208,22,5);ones(1,5)*255,linspace(208,22,5)]'/255;

then, use the attached function to adjust this colormap with your values:
adjusted_color_map = BrainNet_GenColormap(-11,-3,3,4,original_color_map);


I need more time to add this function to the GUI, possibly with the next release. 

Best,
Mingrui 

Originally posted by Renante Rondina:
Hello,

I have been using BrainNet for some time now, and am comfortable with the GUI, but I am not very proficient at coding. I had a question about customizing the color map.

I am interested in displaying node data that ranges from negative to positive values (e.g., -11 to +4), with a gradient to the color map so that nodes with more extreme values are either more saturated or have a different hue (e.g., warmer vs. cooler). I also need to threshold my data so that nodes with mid-range values (e.g., -3 to +3) do not appear on the brain map. Ideally, the colors corresponding to those mid-range values would appear as white or colorless on the color map, similar to the colormap shown on the right side of this image: https://hughpumphrey.files.wordpress.com/2017/06/bwr.png

However, there is nothing similar in the preset options when selecting nodal color. Currently, I am using a Jet scale and have removed data points with mid-range values from the input file. Please see attached file for an example output image. Note that this image does not contain any nodes with mid-range values, which would correspond to colors from yellow to redish-orange on the color map. However, this creates a problem when interpreting multiple images with different scales as the colors corresponding to mid-range values changes in the color map from image to image.

Are there any available patches or custom-made maps that would be suitable for my purposes?
Please let me know,
Thank you in advance
Jul 16, 2022  06:07 PM | Natalia Zdorovtsova - University of Cambridge
RE: Custom Color Map
I've managed to do it! You'll need to click Custom Colormap and then copy-paste the following 256x3 array into the prompt (the colour gradient will be from blue, to white (at the centre), to red.

[1.0000 1.0000 1.0000;
1.0000 0.9922 0.9922;
1.0000 0.9843 0.9843;
1.0000 0.9765 0.9765;
1.0000 0.9686 0.9686;
1.0000 0.9608 0.9608;
1.0000 0.9529 0.9529;
1.0000 0.9451 0.9451;
1.0000 0.9373 0.9373;
1.0000 0.9294 0.9294;
1.0000 0.9216 0.9216;
1.0000 0.9137 0.9137;
1.0000 0.9059 0.9059;
1.0000 0.8980 0.8980;
1.0000 0.8902 0.8902;
1.0000 0.8824 0.8824;
1.0000 0.8745 0.8745;
1.0000 0.8667 0.8667;
1.0000 0.8588 0.8588;
1.0000 0.8510 0.8510;
1.0000 0.8431 0.8431;
1.0000 0.8353 0.8353;
1.0000 0.8275 0.8275;
1.0000 0.8196 0.8196;
1.0000 0.8118 0.8118;
1.0000 0.8039 0.8039;
1.0000 0.7961 0.7961;
1.0000 0.7882 0.7882;
1.0000 0.7804 0.7804;
1.0000 0.7725 0.7725;
1.0000 0.7647 0.7647;
1.0000 0.7569 0.7569;
1.0000 0.7490 0.7490;
1.0000 0.7412 0.7412;
1.0000 0.7333 0.7333;
1.0000 0.7255 0.7255;
1.0000 0.7176 0.7176;
1.0000 0.7098 0.7098;
1.0000 0.7020 0.7020;
1.0000 0.6941 0.6941;
1.0000 0.6863 0.6863;
1.0000 0.6784 0.6784;
1.0000 0.6706 0.6706;
1.0000 0.6627 0.6627;
1.0000 0.6549 0.6549;
1.0000 0.6471 0.6471;
1.0000 0.6392 0.6392;
1.0000 0.6314 0.6314;
1.0000 0.6235 0.6235;
1.0000 0.6157 0.6157;
1.0000 0.6078 0.6078;
1.0000 0.6000 0.6000;
1.0000 0.5922 0.5922;
1.0000 0.5843 0.5843;
1.0000 0.5765 0.5765;
1.0000 0.5686 0.5686;
1.0000 0.5608 0.5608;
1.0000 0.5529 0.5529;
1.0000 0.5451 0.5451;
1.0000 0.5373 0.5373;
1.0000 0.5294 0.5294;
1.0000 0.5216 0.5216;
1.0000 0.5137 0.5137;
1.0000 0.5059 0.5059;
1.0000 0.4980 0.4980;
1.0000 0.4902 0.4902;
1.0000 0.4824 0.4824;
1.0000 0.4745 0.4745;
1.0000 0.4667 0.4667;
1.0000 0.4588 0.4588;
1.0000 0.4510 0.4510;
1.0000 0.4431 0.4431;
1.0000 0.4353 0.4353;
1.0000 0.4275 0.4275;
1.0000 0.4196 0.4196;
1.0000 0.4118 0.4118;
1.0000 0.4039 0.4039;
1.0000 0.3961 0.3961;
1.0000 0.3882 0.3882;
1.0000 0.3804 0.3804;
1.0000 0.3725 0.3725;
1.0000 0.3647 0.3647;
1.0000 0.3569 0.3569;
1.0000 0.3490 0.3490;
1.0000 0.3412 0.3412;
1.0000 0.3333 0.3333;
1.0000 0.3255 0.3255;
1.0000 0.3176 0.3176;
1.0000 0.3098 0.3098;
1.0000 0.3020 0.3020;
1.0000 0.2941 0.2941;
1.0000 0.2863 0.2863;
1.0000 0.2784 0.2784;
1.0000 0.2706 0.2706;
1.0000 0.2627 0.2627;
1.0000 0.2549 0.2549;
1.0000 0.2471 0.2471;
1.0000 0.2392 0.2392;
1.0000 0.2314 0.2314;
1.0000 0.2235 0.2235;
1.0000 0.2157 0.2157;
1.0000 0.2078 0.2078;
1.0000 0.2000 0.2000;
1.0000 0.1922 0.1922;
1.0000 0.1843 0.1843;
1.0000 0.1765 0.1765;
1.0000 0.1686 0.1686;
1.0000 0.1608 0.1608;
1.0000 0.1529 0.1529;
1.0000 0.1451 0.1451;
1.0000 0.1373 0.1373;
1.0000 0.1294 0.1294;
1.0000 0.1216 0.1216;
1.0000 0.1137 0.1137;
1.0000 0.1059 0.1059;
1.0000 0.0980 0.0980;
1.0000 0.0902 0.0902;
1.0000 0.0824 0.0824;
1.0000 0.0745 0.0745;
1.0000 0.0667 0.0667;
1.0000 0.0588 0.0588;
1.0000 0.0510 0.0510;
1.0000 0.0431 0.0431;
1.0000 0.0353 0.0353;
1.0000 0.0275 0.0275;
1.0000 0.0196 0.0196;
1.0000 0.0118 0.0118;
1.0000 0.0039 0.0039;
0.9980 0 0;
0.9941 0 0;
0.9902 0 0;
0.9863 0 0;
0.9824 0 0;
0.9784 0 0;
0.9745 0 0;
0.9706 0 0;
0.9667 0 0;
0.9627 0 0;
0.9588 0 0;
0.9549 0 0;
0.9510 0 0;
0.9471 0 0;
0.9431 0 0;
0.9392 0 0;
0.9353 0 0;
0.9314 0 0;
0.9275 0 0;
0.9235 0 0;
0.9196 0 0;
0.9157 0 0;
0.9118 0 0;
0.9078 0 0;
0.9039 0 0;
0.9000 0 0;
0.8961 0 0;
0.8922 0 0;
0.8882 0 0;
0.8843 0 0;
0.8804 0 0;
0.8765 0 0;
0.8725 0 0;
0.8686 0 0;
0.8647 0 0;
0.8608 0 0;
0.8569 0 0;
0.8529 0 0;
0.8490 0 0;
0.8451 0 0;
0.8412 0 0;
0.8373 0 0;
0.8333 0 0;
0.8294 0 0;
0.8255 0 0;
0.8216 0 0;
0.8176 0 0;
0.8137 0 0;
0.8098 0 0;
0.8059 0 0;
0.8020 0 0;
0.7980 0 0;
0.7941 0 0;
0.7902 0 0;
0.7863 0 0;
0.7824 0 0;
0.7784 0 0;
0.7745 0 0;
0.7706 0 0;
0.7667 0 0;
0.7627 0 0;
0.7588 0 0;
0.7549 0 0;
0.7510 0 0;
0.7471 0 0;
0.7431 0 0;
0.7392 0 0;
0.7353 0 0;
0.7314 0 0;
0.7275 0 0;
0.7235 0 0;
0.7196 0 0;
0.7157 0 0;
0.7118 0 0;
0.7078 0 0;
0.7039 0 0;
0.7000 0 0;
0.6961 0 0;
0.6922 0 0;
0.6882 0 0;
0.6843 0 0;
0.6804 0 0;
0.6765 0 0;
0.6725 0 0;
0.6686 0 0;
0.6647 0 0;
0.6608 0 0;
0.6569 0 0;
0.6529 0 0;
0.6490 0 0;
0.6451 0 0;
0.6412 0 0;
0.6373 0 0;
0.6333 0 0;
0.6294 0 0;
0.6255 0 0;
0.6216 0 0;
0.6176 0 0;
0.6137 0 0;
0.6098 0 0;
0.6059 0 0;
0.6020 0 0;
0.5980 0 0;
0.5941 0 0;
0.5902 0 0;
0.5863 0 0;
0.5824 0 0;
0.5784 0 0;
0.5745 0 0;
0.5706 0 0;
0.5667 0 0;
0.5627 0 0;
0.5588 0 0;
0.5549 0 0;
0.5510 0 0;
0.5471 0 0;
0.5431 0 0;
0.5392 0 0;
0.5353 0 0;
0.5314 0 0;
0.5275 0 0;
0.5235 0 0;
0.5196 0 0;
0.5157 0 0;
0.5118 0 0;
0.5078 0 0;
0.5039 0 0;
0.5000 0 0]

I hope this helps, it took me a while too.