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

Pass arguments to the LowLevelCallable #15

Open
davideC00 opened this issue Sep 24, 2023 · 2 comments
Open

Pass arguments to the LowLevelCallable #15

davideC00 opened this issue Sep 24, 2023 · 2 comments

Comments

@davideC00
Copy link

@cfunc(intc(CPointer(float64), intp, CPointer(float64), voidptr))
def function(values_ptr, len_values, result, data):
  ...
  weights = carray(data, (1,), double)[0]
  ...

weights = [0.6, 0.8, 0.4]
seq = ctypes.c_double * len(weights)
arr = seq(*weights)
ptr = ctypes.cast(ctypes.pointer(arr), ctypes.c_void_p)
ndi.generic_filter(image, LowLevelCallable(function.ctypes, ptr), footprint=footprint)

Source:
scipy doc

@jni
Copy link
Owner

jni commented Sep 25, 2023

🙏

@jni
Copy link
Owner

jni commented Sep 25, 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

No branches or pull requests

2 participants