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

iterate over last dimension when grouping N-D tables of images #627

Merged
merged 3 commits into from Apr 14, 2017

Conversation

rdeits
Copy link
Collaborator

@rdeits rdeits commented Apr 13, 2017

Fixes #625 (assuming that that is, in fact, an error).

Before:

screenshot from 2017-04-13 16 58 35

After:

screenshot from 2017-04-13 16 57 38

My reasoning is that this is more consistent with the way arrays are printed as text in Julia:

[fill(z * z2) for x in 1:2, y in 1:2, z in [0.5, 1], z2 in [0.5, 1]]

gives:

2×2×2×2 Array{Array{Float64,0},4}:
[:, :, 1, 1] =
 0.25  0.25
 0.25  0.25

[:, :, 2, 1] =
 0.5  0.5
 0.5  0.5

[:, :, 1, 2] =
 0.5  0.5
 0.5  0.5

[:, :, 2, 2] =
 1.0  1.0
 1.0  1.0

@rdeits
Copy link
Collaborator Author

rdeits commented Apr 13, 2017

Derp, this doesn't handle dimensions with length > 2 correctly. Please don't merge yet.

@rdeits
Copy link
Collaborator Author

rdeits commented Apr 13, 2017

Ok, fixed.

src/showmime.jl Outdated
@@ -48,9 +48,9 @@ end

function _show_odd{T<:ColorantArray, N}(io::IO, m::MIME"text/html", imgs::AbstractArray{T, N})
Copy link
Member

Choose a reason for hiding this comment

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

Presumably this needs to be updated to ColorantMatrix now? (Sorry if I merged the PRs in the wrong order!)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No problem. I've rebased this branch, so it should be fixed now.

@rdeits
Copy link
Collaborator Author

rdeits commented Apr 14, 2017

Actually, there's one more issue to resolve: this change results in the table of images being displayed in a row-major ordering, which is inconsistent with the rest of Julia. Let me see if I can fix that...

src/showmime.jl Outdated
@@ -48,9 +48,9 @@ end

function _show_odd{T<:ColorantMatrix, N}(io::IO, m::MIME"text/html", imgs::AbstractArray{T, N})
colons = ([Colon() for i=1:(N-1)]...)
for i = 1:size(imgs, 1)
for i = 1:size(imgs, N)
Copy link
Member

Choose a reason for hiding this comment

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

is it worth changing this to for i in indices(imgs, N) ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. I'll do that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok, done

@rdeits
Copy link
Collaborator Author

rdeits commented Apr 14, 2017

Oh, never mind; that's clearly the intended behavior, since a vector of images is displayed as a row.

@timholy timholy merged commit 8db0581 into JuliaImages:master Apr 14, 2017
@timholy
Copy link
Member

timholy commented Apr 14, 2017

Thanks!

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.

None yet

3 participants