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 convenience methods for creating images from arrays #349

Closed
wants to merge 1 commit into from

Conversation

minnerbe
Copy link
Contributor

@minnerbe minnerbe commented Oct 16, 2023

The "learnathon" part of the ImgLib2/BDV hackathon in Brno showed that there is a need for an Img-creation API that caters to absolute beginners. The existing API for wrapping native arrays by means of the ArrayImgs util-class implicitly introduces the concepts of Img-backend and data-access, which seemed to keep people from exploring more awesome features.

I do think that wrapping native arrays is the best way to introduce people that are familiar with Matlab / Python / ... to ImgLib2, so I'm proposing this little wrapper API that can serve as a first exposure point for beginners:

ArrayImg<FloatType, ?> img = ArrayImgs.floats(array, dims) // previous
Img<FloatType> img = Imgs.fromArray(array, dims)           // new

Just to clarify again, this is meant as an educational API, so I don't see any need for deprecating the ArrayImgs API. This is simply inspired by the List-API that does a very good job of keeping implementational details hidden.

@minnerbe
Copy link
Contributor Author

After discussing with @tpietzsch, it became clear that there is some potential to sustainably simplify static creation methods beyond this PR.
I created an according issue (#350) that supersedes this PR.

@minnerbe minnerbe closed this Oct 17, 2023
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.

1 participant