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

recenter: accept origin::Tuple #74

Merged
merged 1 commit into from
Aug 6, 2021

Conversation

johnnychen94
Copy link
Collaborator

@johnnychen94 johnnychen94 commented Jun 2, 2021

OffsetArrays.center is added in JuliaArrays/OffsetArrays.jl#242, and I think it makes sense to remove ImageTransformations.center in favor of OffsetArrays.center

# https://github.com/JuliaImages/ImageTransformations.jl/blob/master/src/ImageTransformations.jl#L43-L44
center(img::AbstractArray{T,N}) where {T,N} = SVector{N}(map(_center, axes(img)))
_center(ind::AbstractUnitRange) = (first(ind)+last(ind))/2

The only reason that SVector is used here is because CoordinateTransformations.recenter requires AbstractVector input, I relax this constrain in this PR so that OffsetArrays.center can be a drop-in replacement for ImageTransformations.center (if we ignore the integer rounding differences).

@johnnychen94
Copy link
Collaborator Author

bump :)

Copy link
Member

@c42f c42f left a comment

Choose a reason for hiding this comment

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

It seems kind of strange to allow a linear map to operate on things which aren't vectors, but I guess it's also fairly harmless.

@johnnychen94 johnnychen94 merged commit 561fde6 into JuliaGeometry:master Aug 6, 2021
@johnnychen94 johnnychen94 deleted the jc/recenter_tuple branch August 6, 2021 12:46
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.

2 participants