JuliaImages / ImageShow.jl

Inline graphical display of images in Julia graphical environments
MIT License
26 stars 9 forks source link

Include simshow function #56

Closed roflmaostc closed 1 year ago

roflmaostc commented 1 year ago

As discussed in #55

Would be happy to receive feedback :)

Right now it basically displays only 2D arrays.

I think it would be nice to have the option for 3D arrays to be shown as RGB, if possible.

For other 3D arrays I think we can just error because simshow is not a fully fledged viewer but instead a simple viewer for inline displays of arrays

codecov[bot] commented 1 year ago

Codecov Report

Base: 87.98% // Head: 88.32% // Increases project coverage by +0.34% :tada:

Coverage data is based on head (e0f6073) compared to base (245e0e4). Patch coverage: 91.30% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #56 +/- ## ========================================== + Coverage 87.98% 88.32% +0.34% ========================================== Files 6 7 +1 Lines 233 257 +24 ========================================== + Hits 205 227 +22 - Misses 28 30 +2 ``` | [Impacted Files](https://codecov.io/gh/JuliaImages/ImageShow.jl/pull/56?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaImages) | Coverage Δ | | |---|---|---| | [src/ImageShow.jl](https://codecov.io/gh/JuliaImages/ImageShow.jl/pull/56?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaImages#diff-c3JjL0ltYWdlU2hvdy5qbA==) | `50.00% <ø> (+50.00%)` | :arrow_up: | | [src/simshow.jl](https://codecov.io/gh/JuliaImages/ImageShow.jl/pull/56?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaImages#diff-c3JjL3NpbXNob3cuamw=) | `91.30% <91.30%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaImages). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaImages)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

johnnychen94 commented 1 year ago

@tlnagy do you happen to have some suggestion/feedback on this? For instance, does this function suits your need for #41?

roflmaostc commented 1 year ago

Hi! Just wanted to ping this again :)

tlnagy commented 1 year ago

Sorry for the delay @roflmaostc, but this looks a nifty and it works on my end: image

It would be great if you add support for signed fixed point numbers (as discussed in #41 like @johnnychen94 mentioned), which currently have the awful behavior of:

image

I think something simple like subtyping on Gray{<: Fixed} and then centering the display at 0 (similar to the functions you already have implemented) would be fantastic.

roflmaostc commented 1 year ago

Thank, I'll try to look into it!

I probably remove the parameter f inside simshow because it's rather useless.

roflmaostc commented 1 year ago

@tlnagy do we introduce a new dependency for the FixedPointNumbers.jl?

johnnychen94 commented 1 year ago

FixedPointNumbers and Colors are always included as long as ImageCore is loaded https://github.com/JuliaImages/ImageCore.jl/blob/fc9ac05630ac07876963d412a295fade46e0094e/src/ImageCore.jl#L4-L6

roflmaostc commented 1 year ago

Would it be OK to convert the FixedPointNumbers to Float for displaying it?

Error such this occur:

rgumentError: FixedPointNumbers.Q0f7 is an 8-bit type representing 256 values from -1.0 to 0.992; cannot represent 1

What should I do in this case? Even the operation arr = set_zero ? arr .- minimum(arr) : arr can't be represented in FixedPointNumbers in some cases.

So think I can't recycle the other functionalities very well (how would a gamma work?).

Is something like this ok?

 function simshow(arr::AbstractArray{Colors.Gray{T}}) where {T<:Fixed}
     return simshow(Array{Gray{Float64}}(arr))
 end
roflmaostc commented 1 year ago

What's the state of it?

I really use that every day and need to copy paste it all the time :laughing:

johnnychen94 commented 1 year ago

I was waiting for more people involved because I'm not so active here these days; nevertheless, let's merge this and give it a try since it's a greenfield implementation, and I don't see it harmful to the existing codebase.

roflmaostc commented 1 year ago

Should we advertise it a little more, like in: https://github.com/roflmaostc/SimpleImageView.jl