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

[FEATURE REQUEST] ImageBuf "wrap" numpy array in python #4259

Open
lgritz opened this issue May 8, 2024 · 2 comments
Open

[FEATURE REQUEST] ImageBuf "wrap" numpy array in python #4259

lgritz opened this issue May 8, 2024 · 2 comments
Labels
difficulty/easy Hours-to-days for veterans, days for newcomers to the project feature request help wanted A task that is desired, but needs somebody to commit the effort to implement it. python Python APIs

Comments

@lgritz
Copy link
Collaborator

lgritz commented May 8, 2024

In C++, it is straightforward to construct an ImageBuf that "wraps" an existing buffer without owning the memory, where you just give it the pointer to the memory and the strides.

There's not currently an equivalent in python, but there should be! It's a great idea suggested by a question from João Vítor Silva on the slack channel. We could imagine a Python-side IB constructor that takes a numpy ndarray and knows it's just a reference to that data and not to do any copies or ownership. (With the caveat that you need to ensure that you don't change the shape or where the data lives in the numpy array, because the IB that wraps it would have no way of knowing.)

@lgritz lgritz added feature request help wanted A task that is desired, but needs somebody to commit the effort to implement it. python Python APIs difficulty/easy Hours-to-days for veterans, days for newcomers to the project labels May 8, 2024
@sumana-2705
Copy link

sumana-2705 commented Jun 27, 2024

Hello @lgritz
I am a newbie in this project, I can solve this issue, shall I work on this ?
If no one are working on it previously

@lgritz
Copy link
Collaborator Author

lgritz commented Jun 27, 2024

Yes, please do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/easy Hours-to-days for veterans, days for newcomers to the project feature request help wanted A task that is desired, but needs somebody to commit the effort to implement it. python Python APIs
Projects
None yet
Development

No branches or pull requests

2 participants