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

Serialize itk functions with pickle #1517

Open
mrocklin opened this issue Dec 24, 2019 · 1 comment
Open

Serialize itk functions with pickle #1517

mrocklin opened this issue Dec 24, 2019 · 1 comment

Comments

@mrocklin
Copy link
Contributor

@mrocklin mrocklin commented Dec 24, 2019

Python ITK functions do not appear to survive a pickle roundtrip in different processes

Process 1

import pickle, itk
print(pickle.dumps(itk.median_image_filter))
b'\x80\x03citkMedianImageFilterPython\nmedian_image_filter\nq\x00.'

Process 2

import pickle
pickle.loads(b'\x80\x03citkMedianImageFilterPython\nmedian_image_filter\nq\x00.')
ModuleNotFoundError: No module named 'itkMedianImageFilterPython'

Environment

This is on an Ubuntu laptop with Python installed with Miniconda

(base) mrocklin@carbon-7:~$ pip list | grep itk
itk                    5.1rc1.post1        
itk-core               5.1rc1.post1        
itk-filtering          5.1rc1.post1        
itk-io                 5.1rc1.post1        
itk-numerics           5.1rc1.post1        
itk-registration       5.1rc1.post1        
itk-segmentation       5.1rc1.post1        
@mrocklin mrocklin added the type:Bug label Dec 24, 2019
@mrocklin

This comment has been minimized.

Copy link
Contributor Author

@mrocklin mrocklin commented Dec 24, 2019

I'm trying to make ITK to work better with Dask. For that my minimal test case is as follows:

from dask.distributed import Client
import itk, numpy as np

if __name__ == "__main__":
    with Client() as client:
        x = client.submit(np.ones, (100, 100))
        y = client.submit(itk.median_image_filter, x, radius=2)
        y.result()
@thewtex thewtex self-assigned this Jan 2, 2020
@thewtex thewtex added this to the ITK v5.1rc02 milestone Jan 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.