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

Include more functionality such as displaying an array as Gray color #55

Closed
roflmaostc opened this issue Nov 10, 2022 · 3 comments
Closed

Comments

@roflmaostc
Copy link
Member

Hi all!

as discussed on Slack with @mkitti and @johnnychen94 we could include an simshow (simple show) to show inline graphics in Pluto and Jupyter.

A draft is like here: https://github.com/roflmaostc/SimpleImageView.jl

function simshow(arr::AbstractArray{<:Real}; 
                 set_one=true, set_zero=false,
                 f = identity,
                 γ = 1)

    arr = set_zero ? arr .- minimum(arr) : arr
    arr = set_one ? arr ./ maximum(arr) : arr

    arr = f(arr) 

    if !isone(γ)
        arr .= arr .^ γ
    end

    Gray.(arr)
end

Should I prepare a PR for including the functionality to this package?

I can also try to include RGB for 3D arrays.

Best,

Felix

@roflmaostc
Copy link
Member Author

Based in ColorSchemes.jl we could also use different colormaps, e.g. simshow(arr, cmap=:tableau_colorblind)

Would it be ok to introduce that dependency?

@johnnychen94
Copy link
Member

johnnychen94 commented Nov 10, 2022

I'm supportive of having an explicit method (that doesn't get implicitly called by Base.show) to support various usages, it might need some experiments to shape out a good interface that finds a good balance between versatility and convenience. Since this is a visualization helper tool that won't be used in multi-threaded scenarios (I think?), I'm also supportive of having a global variable to control the default behavior. And it doesn't necessarily need to be limited in one data input -- MosaicViews is a good helper to tile multiple inputs together.

we could include an simshow (simple show) to show inline graphics in Pluto and Jupyter.

imshow sounds like a better name to me 😆 . Luckily we haven't used this name yet.

Also cc @tlnagy who opened #41 and #43, maybe he's more interested in this.

@roflmaostc
Copy link
Member Author

imshowis already used by ImageView.jl 😅

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