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

nwb2widget - images are displayed rotated to the left by 90 degree #193

Open
rozmar opened this issue Nov 24, 2021 · 4 comments
Open

nwb2widget - images are displayed rotated to the left by 90 degree #193

rozmar opened this issue Nov 24, 2021 · 4 comments

Comments

@rozmar
Copy link

rozmar commented Nov 24, 2021

Hi there,
This is a minor issue and probably can be fixed easily.

If there is an image in an .nwb file (pynwb.image.GrayscaleImage or pynwb.ophys.TwoPhotonSeries), nwbwidgets.nwb2widget displays it 90 degree rotated to the left.
with nwb2widget:
image
with imshow:
image
The images are not too revealing, but the dimensions are obviously not right.

@rozmar
Copy link
Author

rozmar commented Nov 24, 2021

Now that I look at the images side by side, it looks transposed not rotated.

@bendichter
Copy link
Collaborator

bendichter commented Nov 25, 2021

Yes, this is because imshow expects y,x and GrayscaleImage is x,y (though this could be clearer in the documentation)

@rozmar
Copy link
Author

rozmar commented Nov 26, 2021

Thanks for the quick response!
I didn't spot that in the documentation indeed.
I am using scanimage for generating these data and it seems like their standard is also (y,x), although (x,y) would make more sense. Quite confusing.
So what is the correct way to use it? Should I transpose all my movies and images before putting in the .nwb file? And when someone reads it, they should transpose it back if they want to use imshow? Could I specify the dimensions instead?

@bendichter
Copy link
Collaborator

Yes, images are often stored with y first. This is consistent with indexing of an array, but I agree it can be confusing nonetheless. If x vs y is important to you, you should transpose the data before saving it, then users would transpose when reading.

@weiglszonja, do you think you could add to the docval of PyNWB Image types to make this dimension order more clear to users of those classes?

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

No branches or pull requests

2 participants