1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 01:18:38 -05:00

Added cubehelix and cubegamma color maps. Default to angel if not found. Fixes #2191

This commit is contained in:
f4exb 2024-07-26 07:27:20 +02:00
parent a5b5500441
commit 78b73ae529
2 changed files with 535 additions and 0 deletions

View File

@ -33,6 +33,14 @@ QStringList ColorMap::getColorMapNames()
const float *ColorMap::getColorMap(const QString &name)
{
QHash<QString, const float*>::const_iterator it = m_colorMaps.find(name);
if (it == m_colorMaps.end())
{
qWarning("ColorMap::getColorMap: %s color map not supported. Default to Angel", qPrintable(name));
return m_colorMaps.value("Angel");
}
return m_colorMaps.value(name);
}
@ -59,6 +67,8 @@ QHash<QString, const float *> ColorMap::m_colorMaps{
{"Viridis", &m_viridis[0]},
{"Loggray", &m_loggray[0]},
{"Shrimp", &m_shrimp[0]},
{"Cubehelix", &m_cubehelix[0]},
{"Cubegamma", &m_cubegamma[0]},
};
const float ColorMap::m_angel[m_size] =
@ -5780,3 +5790,526 @@ const float ColorMap::m_shrimp[m_size] =
0.9985, 0.3437, 0.0163,
1.0000, 0.3333, 0.0000
};
// See: https://people.phy.cam.ac.uk/dag9/CUBEHELIX/
const float ColorMap::m_cubehelix[m_size] =
{
0.0000, 0.0273, 0.0117,
0.0000, 0.0352, 0.0195,
0.0000, 0.0391, 0.0195,
0.0000, 0.0430, 0.0234,
0.0000, 0.0508, 0.0273,
0.0000, 0.0586, 0.0273,
0.0000, 0.0625, 0.0312,
0.0000, 0.0703, 0.0352,
0.0000, 0.0781, 0.0391,
0.0000, 0.0859, 0.0430,
0.0000, 0.0938, 0.0430,
0.0000, 0.0977, 0.0469,
0.0000, 0.1016, 0.0508,
0.0000, 0.1055, 0.0547,
0.0000, 0.1133, 0.0625,
0.0000, 0.1211, 0.0703,
0.0000, 0.1250, 0.0781,
0.0000, 0.1289, 0.0859,
0.0000, 0.1367, 0.0938,
0.0000, 0.1406, 0.0977,
0.0000, 0.1445, 0.1055,
0.0000, 0.1523, 0.1133,
0.0000, 0.1523, 0.1172,
0.0000, 0.1602, 0.1289,
0.0000, 0.1641, 0.1328,
0.0000, 0.1719, 0.1445,
0.0000, 0.1758, 0.1523,
0.0000, 0.1836, 0.1602,
0.0000, 0.1875, 0.1680,
0.0000, 0.1914, 0.1719,
0.0000, 0.1953, 0.1797,
0.0000, 0.1992, 0.1875,
0.0039, 0.2070, 0.2031,
0.0039, 0.2070, 0.2070,
0.0078, 0.2109, 0.2188,
0.0078, 0.2148, 0.2266,
0.0078, 0.2188, 0.2422,
0.0117, 0.2227, 0.2500,
0.0117, 0.2227, 0.2578,
0.0156, 0.2266, 0.2695,
0.0156, 0.2266, 0.2734,
0.0156, 0.2344, 0.2891,
0.0156, 0.2344, 0.3008,
0.0195, 0.2383, 0.3086,
0.0234, 0.2422, 0.3164,
0.0234, 0.2461, 0.3281,
0.0273, 0.2500, 0.3398,
0.0273, 0.2500, 0.3477,
0.0273, 0.2539, 0.3555,
0.0312, 0.2539, 0.3672,
0.0430, 0.2578, 0.3789,
0.0469, 0.2578, 0.3867,
0.0547, 0.2578, 0.3984,
0.0625, 0.2617, 0.4062,
0.0703, 0.2617, 0.4219,
0.0742, 0.2656, 0.4297,
0.0781, 0.2656, 0.4375,
0.0859, 0.2656, 0.4492,
0.0898, 0.2656, 0.4531,
0.0977, 0.2695, 0.4688,
0.1016, 0.2695, 0.4766,
0.1094, 0.2734, 0.4844,
0.1172, 0.2734, 0.4961,
0.1250, 0.2734, 0.5078,
0.1328, 0.2773, 0.5195,
0.1367, 0.2773, 0.5234,
0.1445, 0.2773, 0.5312,
0.1523, 0.2773, 0.5352,
0.1680, 0.2773, 0.5508,
0.1719, 0.2773, 0.5547,
0.1836, 0.2773, 0.5625,
0.1914, 0.2773, 0.5703,
0.2031, 0.2773, 0.5781,
0.2148, 0.2773, 0.5898,
0.2227, 0.2812, 0.5938,
0.2344, 0.2812, 0.6016,
0.2383, 0.2812, 0.6055,
0.2539, 0.2812, 0.6172,
0.2617, 0.2812, 0.6250,
0.2695, 0.2812, 0.6328,
0.2812, 0.2812, 0.6367,
0.2930, 0.2812, 0.6445,
0.3008, 0.2812, 0.6523,
0.3125, 0.2812, 0.6562,
0.3203, 0.2812, 0.6641,
0.3320, 0.2812, 0.6641,
0.3477, 0.2812, 0.6680,
0.3555, 0.2812, 0.6719,
0.3672, 0.2812, 0.6758,
0.3789, 0.2812, 0.6797,
0.3945, 0.2812, 0.6836,
0.4023, 0.2812, 0.6875,
0.4141, 0.2812, 0.6914,
0.4258, 0.2812, 0.6953,
0.4336, 0.2812, 0.6953,
0.4531, 0.2812, 0.7031,
0.4609, 0.2812, 0.7031,
0.4727, 0.2812, 0.7109,
0.4805, 0.2812, 0.7148,
0.4961, 0.2812, 0.7188,
0.5078, 0.2812, 0.7188,
0.5195, 0.2812, 0.7188,
0.5273, 0.2852, 0.7188,
0.5352, 0.2852, 0.7148,
0.5508, 0.2852, 0.7148,
0.5586, 0.2852, 0.7148,
0.5703, 0.2891, 0.7148,
0.5820, 0.2891, 0.7148,
0.5938, 0.2930, 0.7109,
0.6016, 0.2930, 0.7109,
0.6133, 0.2930, 0.7109,
0.6250, 0.2930, 0.7109,
0.6328, 0.2930, 0.7109,
0.6484, 0.2969, 0.7109,
0.6562, 0.2969, 0.7070,
0.6680, 0.2969, 0.7070,
0.6758, 0.3008, 0.7070,
0.6914, 0.3008, 0.7070,
0.6992, 0.3047, 0.7070,
0.7031, 0.3047, 0.7070,
0.7148, 0.3086, 0.7070,
0.7227, 0.3125, 0.7070,
0.7344, 0.3125, 0.7070,
0.7383, 0.3164, 0.7070,
0.7461, 0.3203, 0.7070,
0.7539, 0.3242, 0.7070,
0.7695, 0.3281, 0.7070,
0.7773, 0.3281, 0.7070,
0.7812, 0.3320, 0.7070,
0.7891, 0.3359, 0.7070,
0.7930, 0.3398, 0.7070,
0.8086, 0.3398, 0.7070,
0.8164, 0.3438, 0.7070,
0.8242, 0.3477, 0.7070,
0.8320, 0.3516, 0.7070,
0.8398, 0.3555, 0.7031,
0.8438, 0.3594, 0.6953,
0.8477, 0.3633, 0.6875,
0.8516, 0.3711, 0.6758,
0.8516, 0.3711, 0.6680,
0.8633, 0.3789, 0.6602,
0.8672, 0.3828, 0.6523,
0.8711, 0.3906, 0.6445,
0.8750, 0.3945, 0.6328,
0.8828, 0.4023, 0.6250,
0.8867, 0.4062, 0.6172,
0.8906, 0.4102, 0.6094,
0.8945, 0.4141, 0.6016,
0.8984, 0.4180, 0.5898,
0.9062, 0.4258, 0.5820,
0.9102, 0.4297, 0.5742,
0.9141, 0.4375, 0.5664,
0.9180, 0.4414, 0.5586,
0.9180, 0.4492, 0.5547,
0.9180, 0.4570, 0.5508,
0.9180, 0.4609, 0.5508,
0.9219, 0.4688, 0.5430,
0.9219, 0.4688, 0.5391,
0.9219, 0.4844, 0.5352,
0.9219, 0.4883, 0.5312,
0.9219, 0.4922, 0.5312,
0.9258, 0.5000, 0.5273,
0.9258, 0.5078, 0.5234,
0.9258, 0.5156, 0.5195,
0.9258, 0.5195, 0.5195,
0.9258, 0.5273, 0.5156,
0.9258, 0.5312, 0.5078,
0.9297, 0.5391, 0.5039,
0.9297, 0.5430, 0.5039,
0.9297, 0.5547, 0.5039,
0.9297, 0.5625, 0.5000,
0.9258, 0.5703, 0.5000,
0.9219, 0.5781, 0.5000,
0.9219, 0.5781, 0.5000,
0.9219, 0.5898, 0.5000,
0.9180, 0.5938, 0.5000,
0.9180, 0.6055, 0.5000,
0.9141, 0.6094, 0.5000,
0.9141, 0.6172, 0.5000,
0.9141, 0.6250, 0.4961,
0.9102, 0.6367, 0.4961,
0.9102, 0.6445, 0.4961,
0.9062, 0.6484, 0.4961,
0.9062, 0.6562, 0.4961,
0.9023, 0.6602, 0.4961,
0.9023, 0.6758, 0.4961,
0.8984, 0.6797, 0.4961,
0.8984, 0.6836, 0.4961,
0.8945, 0.6914, 0.5000,
0.8945, 0.6992, 0.5039,
0.8906, 0.7109, 0.5078,
0.8867, 0.7148, 0.5117,
0.8867, 0.7227, 0.5156,
0.8828, 0.7266, 0.5195,
0.8789, 0.7344, 0.5234,
0.8789, 0.7422, 0.5273,
0.8750, 0.7500, 0.5312,
0.8711, 0.7578, 0.5352,
0.8711, 0.7617, 0.5391,
0.8672, 0.7695, 0.5430,
0.8633, 0.7773, 0.5469,
0.8633, 0.7852, 0.5508,
0.8594, 0.7891, 0.5508,
0.8594, 0.8008, 0.5586,
0.8555, 0.8047, 0.5625,
0.8555, 0.8086, 0.5664,
0.8555, 0.8164, 0.5742,
0.8516, 0.8242, 0.5859,
0.8516, 0.8281, 0.5938,
0.8516, 0.8320, 0.5977,
0.8516, 0.8398, 0.6055,
0.8516, 0.8438, 0.6133,
0.8516, 0.8516, 0.6250,
0.8477, 0.8516, 0.6289,
0.8477, 0.8594, 0.6367,
0.8477, 0.8672, 0.6445,
0.8477, 0.8711, 0.6523,
0.8477, 0.8789, 0.6641,
0.8477, 0.8828, 0.6680,
0.8438, 0.8906, 0.6758,
0.8438, 0.8906, 0.6797,
0.8438, 0.9023, 0.6914,
0.8438, 0.9023, 0.6992,
0.8477, 0.9062, 0.7109,
0.8477, 0.9102, 0.7188,
0.8516, 0.9180, 0.7305,
0.8555, 0.9219, 0.7383,
0.8555, 0.9219, 0.7461,
0.8594, 0.9258, 0.7578,
0.8594, 0.9297, 0.7617,
0.8633, 0.9375, 0.7773,
0.8633, 0.9375, 0.7812,
0.8672, 0.9414, 0.7930,
0.8711, 0.9414, 0.8008,
0.8711, 0.9453, 0.8125,
0.8750, 0.9531, 0.8242,
0.8750, 0.9531, 0.8281,
0.8789, 0.9570, 0.8398,
0.8789, 0.9609, 0.8477,
0.8867, 0.9648, 0.8594,
0.8906, 0.9688, 0.8633,
0.8984, 0.9688, 0.8711,
0.9023, 0.9688, 0.8789,
0.9141, 0.9727, 0.8945,
0.9180, 0.9727, 0.9023,
0.9219, 0.9766, 0.9062,
0.9297, 0.9766, 0.9141,
0.9336, 0.9805, 0.9180,
0.9453, 0.9805, 0.9336,
0.9492, 0.9844, 0.9375,
0.9570, 0.9844, 0.9453,
0.9648, 0.9883, 0.9531,
0.9688, 0.9883, 0.9648,
0.9766, 0.9922, 0.9727,
0.9844, 0.9922, 0.9805,
0.9883, 0.9961, 0.9883,
};
// Generated with https://people.phy.cam.ac.uk/dag9/CUBEHELIX/cubetry.html
// Using: Start color: 2.0, Number of rotations: 1.5, Rotation direction: positive, Hue: 1.0, Gamma: 0.4
const float ColorMap::m_cubegamma[m_size] =
{
0.000, 0.000, 0.000,
0.036, 0.155, 0.064,
0.049, 0.202, 0.091,
0.059, 0.236, 0.114,
0.066, 0.263, 0.134,
0.073, 0.286, 0.154,
0.079, 0.306, 0.172,
0.085, 0.323, 0.191,
0.091, 0.339, 0.209,
0.096, 0.354, 0.226,
0.101, 0.367, 0.244,
0.106, 0.379, 0.261,
0.111, 0.391, 0.278,
0.116, 0.401, 0.295,
0.122, 0.411, 0.312,
0.127, 0.420, 0.329,
0.133, 0.428, 0.345,
0.138, 0.436, 0.362,
0.144, 0.443, 0.378,
0.150, 0.450, 0.394,
0.157, 0.456, 0.410,
0.163, 0.462, 0.426,
0.170, 0.467, 0.441,
0.177, 0.472, 0.457,
0.184, 0.477, 0.472,
0.192, 0.481, 0.487,
0.200, 0.485, 0.502,
0.208, 0.489, 0.516,
0.216, 0.492, 0.530,
0.224, 0.495, 0.544,
0.233, 0.497, 0.558,
0.242, 0.500, 0.571,
0.251, 0.502, 0.585,
0.261, 0.504, 0.597,
0.271, 0.506, 0.610,
0.281, 0.507, 0.622,
0.291, 0.509, 0.634,
0.301, 0.510, 0.645,
0.311, 0.511, 0.656,
0.322, 0.512, 0.667,
0.333, 0.512, 0.678,
0.344, 0.513, 0.688,
0.355, 0.513, 0.697,
0.367, 0.514, 0.706,
0.378, 0.514, 0.715,
0.390, 0.514, 0.724,
0.401, 0.514, 0.732,
0.413, 0.514, 0.739,
0.425, 0.514, 0.747,
0.437, 0.514, 0.753,
0.449, 0.513, 0.760,
0.461, 0.513, 0.766,
0.473, 0.513, 0.772,
0.485, 0.513, 0.777,
0.497, 0.512, 0.781,
0.509, 0.512, 0.786,
0.521, 0.512, 0.790,
0.534, 0.512, 0.793,
0.546, 0.511, 0.797,
0.558, 0.511, 0.799,
0.569, 0.511, 0.802,
0.581, 0.511, 0.804,
0.593, 0.511, 0.805,
0.605, 0.511, 0.807,
0.616, 0.511, 0.807,
0.627, 0.511, 0.808,
0.639, 0.512, 0.808,
0.650, 0.512, 0.808,
0.661, 0.512, 0.807,
0.671, 0.513, 0.807,
0.682, 0.514, 0.805,
0.692, 0.514, 0.804,
0.703, 0.515, 0.802,
0.713, 0.516, 0.800,
0.722, 0.517, 0.798,
0.732, 0.519, 0.795,
0.741, 0.520, 0.792,
0.750, 0.521, 0.789,
0.759, 0.523, 0.786,
0.767, 0.525, 0.782,
0.776, 0.526, 0.779,
0.784, 0.528, 0.775,
0.791, 0.531, 0.771,
0.799, 0.533, 0.766,
0.806, 0.535, 0.762,
0.813, 0.538, 0.757,
0.819, 0.540, 0.753,
0.826, 0.543, 0.748,
0.832, 0.546, 0.743,
0.837, 0.549, 0.738,
0.843, 0.552, 0.733,
0.848, 0.556, 0.728,
0.852, 0.559, 0.723,
0.857, 0.563, 0.717,
0.861, 0.566, 0.712,
0.865, 0.570, 0.707,
0.868, 0.574, 0.702,
0.872, 0.578, 0.697,
0.875, 0.583, 0.691,
0.877, 0.587, 0.686,
0.880, 0.591, 0.681,
0.882, 0.596, 0.676,
0.883, 0.601, 0.671,
0.885, 0.605, 0.666,
0.886, 0.610, 0.662,
0.887, 0.615, 0.657,
0.888, 0.620, 0.653,
0.888, 0.625, 0.648,
0.888, 0.630, 0.644,
0.888, 0.636, 0.640,
0.888, 0.641, 0.636,
0.887, 0.646, 0.632,
0.886, 0.652, 0.629,
0.885, 0.657, 0.625,
0.884, 0.663, 0.622,
0.883, 0.668, 0.619,
0.881, 0.674, 0.616,
0.879, 0.680, 0.614,
0.877, 0.685, 0.611,
0.875, 0.691, 0.609,
0.873, 0.697, 0.607,
0.870, 0.702, 0.606,
0.868, 0.708, 0.604,
0.865, 0.714, 0.603,
0.862, 0.720, 0.602,
0.859, 0.725, 0.602,
0.856, 0.731, 0.601,
0.853, 0.737, 0.601,
0.850, 0.742, 0.601,
0.847, 0.748, 0.601,
0.843, 0.754, 0.602,
0.840, 0.759, 0.603,
0.836, 0.765, 0.604,
0.833, 0.770, 0.605,
0.829, 0.775, 0.607,
0.826, 0.781, 0.609,
0.822, 0.786, 0.611,
0.819, 0.791, 0.613,
0.815, 0.796, 0.616,
0.812, 0.802, 0.619,
0.808, 0.807, 0.622,
0.805, 0.811, 0.625,
0.802, 0.816, 0.628,
0.798, 0.821, 0.632,
0.795, 0.826, 0.636,
0.792, 0.830, 0.640,
0.789, 0.835, 0.644,
0.786, 0.839, 0.649,
0.783, 0.843, 0.653,
0.781, 0.847, 0.658,
0.778, 0.852, 0.663,
0.775, 0.856, 0.669,
0.773, 0.859, 0.674,
0.771, 0.863, 0.679,
0.769, 0.867, 0.685,
0.767, 0.870, 0.691,
0.765, 0.874, 0.697,
0.763, 0.877, 0.703,
0.762, 0.880, 0.709,
0.760, 0.883, 0.715,
0.759, 0.886, 0.721,
0.758, 0.889, 0.728,
0.757, 0.892, 0.734,
0.757, 0.894, 0.741,
0.756, 0.897, 0.747,
0.756, 0.899, 0.754,
0.756, 0.901, 0.761,
0.756, 0.904, 0.767,
0.756, 0.906, 0.774,
0.756, 0.908, 0.781,
0.757, 0.910, 0.787,
0.757, 0.911, 0.794,
0.758, 0.913, 0.801,
0.759, 0.915, 0.808,
0.761, 0.916, 0.814,
0.762, 0.917, 0.821,
0.764, 0.919, 0.827,
0.765, 0.920, 0.834,
0.767, 0.921, 0.840,
0.769, 0.922, 0.847,
0.772, 0.923, 0.853,
0.774, 0.924, 0.859,
0.776, 0.925, 0.865,
0.779, 0.926, 0.871,
0.782, 0.926, 0.877,
0.785, 0.927, 0.883,
0.788, 0.928, 0.888,
0.791, 0.928, 0.894,
0.794, 0.929, 0.899,
0.798, 0.929, 0.905,
0.801, 0.930, 0.910,
0.805, 0.930, 0.915,
0.809, 0.930, 0.920,
0.813, 0.931, 0.924,
0.817, 0.931, 0.929,
0.821, 0.931, 0.933,
0.825, 0.931, 0.938,
0.829, 0.932, 0.942,
0.833, 0.932, 0.946,
0.837, 0.932, 0.950,
0.842, 0.932, 0.953,
0.846, 0.933, 0.957,
0.850, 0.933, 0.960,
0.855, 0.933, 0.963,
0.859, 0.933, 0.966,
0.863, 0.934, 0.969,
0.868, 0.934, 0.972,
0.872, 0.934, 0.974,
0.877, 0.934, 0.977,
0.881, 0.935, 0.979,
0.885, 0.935, 0.981,
0.890, 0.936, 0.983,
0.894, 0.936, 0.985,
0.898, 0.936, 0.986,
0.903, 0.937, 0.988,
0.907, 0.938, 0.989,
0.911, 0.938, 0.991,
0.915, 0.939, 0.992,
0.919, 0.939, 0.993,
0.923, 0.940, 0.994,
0.927, 0.941, 0.994,
0.931, 0.942, 0.995,
0.935, 0.943, 0.996,
0.938, 0.944, 0.996,
0.942, 0.945, 0.997,
0.945, 0.946, 0.997,
0.949, 0.947, 0.997,
0.952, 0.948, 0.997,
0.955, 0.949, 0.997,
0.958, 0.950, 0.998,
0.961, 0.952, 0.998,
0.964, 0.953, 0.998,
0.967, 0.955, 0.997,
0.969, 0.956, 0.997,
0.972, 0.958, 0.997,
0.974, 0.959, 0.997,
0.976, 0.961, 0.997,
0.979, 0.963, 0.997,
0.981, 0.964, 0.997,
0.983, 0.966, 0.996,
0.984, 0.968, 0.996,
0.986, 0.970, 0.996,
0.988, 0.972, 0.996,
0.989, 0.974, 0.996,
0.991, 0.976, 0.996,
0.992, 0.978, 0.996,
0.993, 0.980, 0.996,
0.994, 0.982, 0.996,
0.995, 0.984, 0.997,
0.996, 0.986, 0.997,
0.997, 0.989, 0.997,
0.998, 0.991, 0.998,
0.998, 0.993, 0.998,
0.999, 0.995, 0.999,
1.000, 0.998, 0.999,
1.000, 1.000, 1.000,
};

View File

@ -64,6 +64,8 @@ private:
static const float m_viridis[m_size];
static const float m_loggray[m_size];
static const float m_shrimp[m_size];
static const float m_cubehelix[m_size];
static const float m_cubegamma[m_size];
};
#endif