-
Notifications
You must be signed in to change notification settings - Fork 1
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
Transposition and 3d data #2
Comments
For me the fact that Julia arrays are in colum-major order is not an issue, on the contrary, since my team and I have adopted the same convention for all our code (mostly 2D, 3D and 4D image processing) since a long time. I however do understand that this can be an issue for others. The easier fix would be to have a keyword like For other purposes, I have written somewhere some preliminary code that deals with all all possibilities for 2D arrays (there are 8 possibilities for 2D arrays: permute axes or not and reverse each axes or not) with a keyword The advantage of having a single integer summarizing all possible transforms is that it is easy to have each user provide a default value for this parameter. Using an environment variable is quite fast: default_orient() = begin
val = tryparse(Int, get(ENV, "DS9_ORIENT", ""))
val === nothing ? 0 : val
end
using BenchmarkTools
ENV["DS9_ORIENT"] = ""
@btime default_orient() # --> 58.697 ns (0 allocations: 0 bytes)
ENV["DS9_ORIENT"] = "9"
@btime default_orient() # --> 87.417 ns (1 allocation: 32 bytes) Let me know if you would agree with this. In the meantime I will extract the 2D code to provide a starting example. |
Something to remember is that coordinates retrieved from DS9 will have to be transformed back if you use different conventions for the array axes than the ones assumed by DS9. |
I think something more like |
I've been playing around with
DS9.jl
for a while now and figured a couple things could be addressed.In particular the way array data is transferred between XPA and Julia permutes each dimension, since Julia is column-ordered. Using PyDS9 through PyCall will correctly orient the data (something in PyCall makes sure arrays show up in python knowing they are column-oriented), but the same image put through DS9.jl will be transposed.
At a low-level, I'm not sure if there is an appropriate way to write things in
XPA.jl
to make sure when the array pointers are given they are column ordered, if that's even a thing. At a higher level, within this library whenset
encounters an array, it should permute it appropriately to become row-ordered.I also work with 3d data frequently, and it seems pretty trivial to add the feature here. I've coded up a version that seems to work-
I'm happy to wrap this up in a PR, but I wanted to discuss the transposition issue first.
The text was updated successfully, but these errors were encountered: