Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ct scan greys #70

Open
jakubMitura14 opened this issue May 29, 2021 · 2 comments
Open

Ct scan greys #70

jakubMitura14 opened this issue May 29, 2021 · 2 comments

Comments

@jakubMitura14
Copy link

Hello I am trying to create colorscheme that I want to use in the heatmap of makie for now I use greys and It works quite well but

I would like to implement windows
so pixels below given value a should be black
all above given value b should be white
different shades of grey for all values between a and b and proportional to those values

How to achieve this?

Thank you for help!

Below What Is already achieved but without windows

image

@cormullion
Copy link
Member

cormullion commented May 29, 2021

Hi Jakub! Assuming you can pass in normalised values from 0 to 1 in Makie, you can do this with ColorSchemeTools.jl:

using ColorSchemes, ColorSchemeTools

function f(n, a, b)
    if n < a
        return 0
    elseif n > b
        return 1
    else
        return ColorSchemes.remap(n, a, b, 0, 1)
    end
end

a = 0.3
b = 0.8

newscheme = make_colorscheme(n -> f(n, a, b), n -> f(n, a, b), n -> f(n, a, b), 
    length=100,
    category = " ... ",
    notes    = " ... ")

Screenshot 2021-05-29 at 09 27 45

@jakubMitura14
Copy link
Author

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants