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

WIP: add macro channelwise #105

Closed
wants to merge 1 commit into from
Closed

WIP: add macro channelwise #105

wants to merge 1 commit into from

Conversation

johnnychen94
Copy link
Member

@johnnychen94 johnnychen94 commented Dec 19, 2019

This is the very draft of my @channelwise idea in JuliaImages/Images.jl#817

The basic idea is to insert a channelview to each possible argument. For example, @channelwise euclidean(x, y) is equivalent to euclidean(channelview(x), channelview(y)).

I'm not familiar with the macro mechanism at present, the current code doesn't work properly. (I guess I need to quote the codes in has_channel for Symbol and Expr)

@timholy
Copy link
Member

timholy commented Dec 29, 2019

Out of curiosity, how often do you need the view? Could we do something similar using mapc or mapreducec? The reason I ask is that it's more straightforward to achieve very high performance that way (tuples are almost always better than arrays for performance).

@AliMalik9599
Copy link

Hey @johnnychen94 so I think I figured out how to make this work. The only problem is that channelview returns a Base.reinterpretArray, so I do not know how to send this to euclidean (just as an example) without specifying the parameters for that function as Base.reinterpretarray{...}. Any advice? Thanks!

@johnnychen94
Copy link
Member Author

Hmmm, could you illustrate it a bit more? I probably don't get what your problem is. The functions(e.g., euclidean) should just work generically for AbstractArray.

@AliMalik9599
Copy link

Yes, I think I made a mistake as I was testing using a custom function I made which did not have the correct code to work for any abstract array. I think this works now, in what file can I find the euclidean function? Thanks for the help

@johnnychen94
Copy link
Member Author

euclidean is defined in ImageDistances (for images) and Distances (for numerical array)

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