AllenCellModeling / napari-aicsimageio

Multiple file format reading directly into napari using pure Python
GNU General Public License v3.0
33 stars 9 forks source link

bugfix/use-data.data-in-open_scene #69

Closed psobolewskiPhD closed 1 year ago

psobolewskiPhD commented 1 year ago

Description

If a single scene image is opened, the return is data.data which is just the array from the xarray.DataArray If a multi scene file is opened (using the scene selector widget) the return from the open_scene is an image layer with data, the actual xarray.DataArray.

Napari actually handles this just fine, but some downstream plugins do not, expecting numpy arrays (e.g. napari-matplotlib). This is sort of something they should be better at handling, perhaps using np.asarray, but at the same time I feel like these two should work the same? I think this plugin should/could be the default beyond builtins, so probably standardizing on the array and not xarray.DataArray is best, so probably data.data is preferred as a default behavior. As the person partially responsible for the scene selector, I think this was an oversight on my part...

So in this PR I just make that small change and update the test accordingly. At the same time, I can understand just returning the xarray.DataArray. But then for consistency, the single scene should just return data.

Pull request recommendations:

Thanks for contributing!

psobolewskiPhD commented 1 year ago

Lint CI fail is unrelated, hopefully fixed by https://github.com/AllenCellModeling/napari-aicsimageio/pull/70

evamaxfield commented 1 year ago

Seems fine to me! Thanks! Also @psobolewskiPhD do you mind if I give you write access to this repo?

I unfortunately haven't had time to work on imaging / cell science stuff in a long time. Happy to still review but I don't see myself as a large code author for the foreseeable future...

evamaxfield commented 1 year ago

Reason being: if you have write access you can publish releases after something merges.

psobolewskiPhD commented 1 year ago

Um, I don't mind I guess, if you think it's helpful! I'll definitely need to bone up on releases and all that—I've never done that.