pontikos-lab / Relayer

Web app for segmenting OCT Scans
GNU Affero General Public License v3.0
2 stars 0 forks source link

Colour Scale #13

Closed giovanniometto closed 6 years ago

giovanniometto commented 6 years ago
IsmailM commented 6 years ago

Can you send me the colour scale colours again? This is what, I'm currently using

[
                ['0.0', 'rgb(0,0,0)'],
                ['100', 'rgb(0,0,0)'],
                ['170', 'rgb(170,0,170)'],
                ['240', 'rgb(0,0,255)'],
                ['300', 'rgb(0,255,0)'],
                ['370', 'rgb(255,255,0)'],
                ['450', 'rgb(255,0,0)'],
                ['520', 'rgb(255,255,255)'],
]

Do you want the colour scale to be discrete or continuous?

giovanniometto commented 6 years ago

Do you want the colour scale to be discrete or continuous? continuous

giovanniometto commented 6 years ago

That colour scale should be correct, in fact values around 240 should be blue: ['240', 'rgb(0,0,255)'],

IsmailM commented 6 years ago

Yep - I realised that. Plotly uses percentages instead of raw values for the colour scale and as such, it is probably changing to its default values. I will raise an issue on Plotly to see if there is an easy way to use raw values. If not I'll create a custom gradient for each analysis (i.e. work out maxima/minima and then use that to set values of 0 and 100% of the colour scheme based on the raw values scale).

Do either of you know how to get colour values for each value in 0-520 based on the above colour scale?

Have changed the titles in 52c19a7065004004f62a57d17bf39510e032e596

giovanniometto commented 6 years ago

[ ['0.0', 'rgb(0,0,0)'], ['0.1923', 'rgb(0,0,0)'], ['0.3269', 'rgb(170,0,170)'], ['0.4615', 'rgb(0,0,255)'], ['0.5769', 'rgb(0,255,0)'], ['0.7115', 'rgb(255,255,0)'], ['0.8654', 'rgb(255,0,0)'], ['1', 'rgb(255,255,255)'], ]

giovanniometto commented 6 years ago

not sure about the syntax, but these are the values given 520 = 100% 0.0000 0.1923 0.3269 0.4615 0.5769 0.7115 0.8654 1.0000

IsmailM commented 6 years ago

Those wouldn't work.

For example, when the maxima and minima in the plot is 200 and 300, plotly would assign 0% (i.e. white) to 200 and 100% (i.e. black) to 300. Which isn't what we want.

This is why I would need to create a custom scale for each plot based on the maxima/minima. (i.e. to correctly assign the 200 minima and 300 maxima to the correct values in the scale...

As such, I need to get a RGB values for each raw value between 0 and 520 and use that to generate the scale...

giovanniometto commented 6 years ago

ok, I will make it

giovanniometto commented 6 years ago

colourmap.txt

IsmailM commented 6 years ago

Thanks for producing that @giovanniometto. That's pretty cool.

Two questions:

giovanniometto commented 6 years ago

well, it is a "manual" decision so it could not be much automated - well maybe a bit more than this :) but only took a couple of minutes..

R = [zeros(100,1); (0:170/69:170)';round(flipud((0:170/69:170)')); zeros(60,1); ...
round((0:255/69:255)'); 255*ones(150,1)];
G = [zeros(240,1); round(0:255/59:255)'; 255*ones(70,1);...
round(flipud((0:255/79:255)'));round((0:255/69:255)')];
B = [zeros(100,1); round(0:170/69:170)'; round(170+85/70:85/70:255)';...
round(flipud((0:255/59:255)'));zeros(150,1);round(0:255/69:255)'];
RGB= ([R G B]);
[(1:520)' double(uint8(RGB))]
giovanniometto commented 6 years ago

colourmap.txt