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

Add steps/offsets convenience constructor: #53

Merged
merged 1 commit into from
Jan 5, 2017
Merged

Conversation

timholy
Copy link
Member

@timholy timholy commented Jan 5, 2017

This adds a convenience constructor with the following syntax:

AxisArray(A::AbstractArray, (names...,), (steps...,), [(offsets...,)])

where steps is meant in the range-step sense, and offsets is like start for each coordinate. Requested in JuliaImages/Images.jl#542 (comment). I can add it to ImageAxes but I thought perhaps it would be worth gauging interest here first. CC @tknopp.

Is that one line in the docs enough, or does it need more explanation?

    AxisArray(A::AbstractArray, (names...,), (steps...,), [(offsets...,)])
@tknopp
Copy link

tknopp commented Jan 5, 2017

Yes thanks, this looks good. I am just realizing that the range objects as we have them are not sufficient to define cell-centered grids. So what I actually would like to have is to define an image of e.g. 10x10mm^2 discretized into 2x2 voxels giving me positions located at (2.5,2.5), (2.5,7.5), (7.5,2.5), (7.5,7.5). But maybe this is something I should store in the MetaData of an ImageMeta object.

@timholy
Copy link
Member Author

timholy commented Jan 5, 2017

I'm not sure I see the problem. The ranges specify a grid; it's up to you to interpret what that grid means. If you want it to mean the cell centers, then just make sure that the offsets tuple expresses the position of the center of the first "corner" grid element.

@tknopp
Copy link

tknopp commented Jan 5, 2017

yes, this was more a self conversation that I need to reorganize my thinking. In the old Images.jl the actual grid points were never specified an in turn I could generate them cell centered when I needed them. Now I need to think about this when creating the AxisArray. So all fine.

@mbauman mbauman merged commit 65263db into master Jan 5, 2017
@mbauman mbauman deleted the teh/convenience branch January 5, 2017 23:33
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