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

Provide trait based opt in for Images API (take 2) #86

Merged
merged 4 commits into from
Aug 12, 2019
Merged

Provide trait based opt in for Images API (take 2) #86

merged 4 commits into from
Aug 12, 2019

Conversation

Tokazama
Copy link
Contributor

@Tokazama Tokazama commented Aug 3, 2019

This is following up on JuliaImages/Images.jl#815.

The idea is to provide a bear bones interface for acting within the Images.jl ecosystem. It also aims to disrupt everything else as little as possible when adopted by other packages in the JuliaImages organization.

@codecov
Copy link

codecov bot commented Aug 3, 2019

Codecov Report

Merging #86 into master will increase coverage by 0.23%.
The diff coverage is 52.94%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #86      +/-   ##
=========================================
+ Coverage   66.66%   66.9%   +0.23%     
=========================================
  Files           9       9              
  Lines         414     426      +12     
=========================================
+ Hits          276     285       +9     
- Misses        138     141       +3
Impacted Files Coverage Δ
src/ImageCore.jl 61.11% <ø> (ø) ⬆️
src/traits.jl 78.16% <52.94%> (-4.94%) ⬇️
src/colorchannels.jl 34.67% <0%> (+0.27%) ⬆️
src/stackedviews.jl 70.76% <0%> (+1.07%) ⬆️
src/convert_reinterpret.jl 85.71% <0%> (+3.89%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3141352...00e4259. Read the comment docs.

@codecov
Copy link

codecov bot commented Aug 3, 2019

Codecov Report

Merging #86 into master will increase coverage by 0.78%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #86      +/-   ##
==========================================
+ Coverage   66.66%   67.45%   +0.78%     
==========================================
  Files           9        9              
  Lines         414      424      +10     
==========================================
+ Hits          276      286      +10     
  Misses        138      138
Impacted Files Coverage Δ
src/ImageCore.jl 61.11% <ø> (ø) ⬆️
src/traits.jl 85.18% <100%> (+2.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3141352...11372af. Read the comment docs.

@Tokazama
Copy link
Contributor Author

Tokazama commented Aug 3, 2019

I think Julia inlined my code so it's not getting caught by Codecov (the lines not covered are the default axis names which are indirectly tested by different array sizes).

Copy link
Member

@johnnychen94 johnnychen94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this idea since it's absolutely an add-on feature. Most of the existing codes won't be affected unless the developers decide to take advantages of axis information.

src/traits.jl Outdated
ntuple(i -> default_name(i), N)::NTuple{N,Symbol}
end

@inline function default_name(i::Int)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like :dim_1, :dim_2, :dim_3 since it provides nothing useful by default.

Providing meaningful axes for it might cause some unexpected behaviors, e.g.,:

img = rand(RGB, 2, 2)
namedaxes(channelview(img)) # it should be (:channel, :row, :col)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default names were pulled from what AxisArrays uses. I was trying to be conservative with what I changed, but I agree that his makes more sense as a default.

`default_names` is now a simple generated function, because the symbol
names weren't being interpolated at compile time. Hopefully dispatching
on `Vall{N}` instead of the full array will limit the number of
functions that have to be generated.
@johnnychen94
Copy link
Member

LGTM, @timholy how do you think?

@Tokazama
Copy link
Contributor Author

bump

@timholy timholy merged commit aa88400 into JuliaImages:master Aug 12, 2019
@timholy
Copy link
Member

timholy commented Aug 12, 2019

Thanks!

timholy pushed a commit that referenced this pull request Aug 23, 2019
The duplicated key `Random` is introduced by #86 and #87
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

Successfully merging this pull request may close these issues.

3 participants