-
-
Notifications
You must be signed in to change notification settings - Fork 670
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: Make empty itk.Image
and related data serializable (pickleable) for use with dask.distributed
#4267
Comments
At this point, if the image buffer is empty / has not been allocated, we should return |
If an itk.Image's memory has not been allocated return None from itk.array_view_from_image. Pickle and unpickles an unallocated itk.Image to support sending the image's metadata with Dask. Closes InsightSoftwareConsortium#4267.
If an itk.Image's memory has not been allocated return None from itk.array_view_from_image. Pickle and unpickles an unallocated itk.Image to support sending the image's metadata with Dask. InsightSoftwareConsortium#4267.
I will work on this in coordination with InsightSoftwareConsortium/ITK-Wasm#983.
I think |
I see the following behavior in
|
Ah, yes, it currently has to be explicitly converted to a NumPy array. |
Optional specification of the BufferedRegion, which is a subset of the LargestPossibleRegion. Addresses InsightSoftwareConsortium#4267. The LargestPossibleRegion's Index is assumed to be trivial (zeros). Also update the NumPy bridge to correctly use the BufferedRegion instead of the LargestPossibleRegion for the array shape.
Optional specification of the BufferedRegion, which is a subset of the LargestPossibleRegion. Addresses InsightSoftwareConsortium#4267. The LargestPossibleRegion's Index is assumed to be trivial (zeros). Also update the NumPy bridge to correctly use the BufferedRegion instead of the LargestPossibleRegion for the array shape.
Description
ITK supports Python's pickle serialization technique for fully buffered
itk.Image
objects (see #2829), but not for advanced use cases ofitk.Image
.It would be good to support the following cases:
itk.Image
describing a relationship between an oriented spatial bounding box and an implied underlying voxel array. I.e.,image.GetBufferedRegion()
is zero andimage.GetLargestPossibleRegion()
is greater than zero.itk.Image
describing a subimage. I.e.,image.GetBufferedRegion()
is greater than zero and is strictly less thanimage.GetLargestPossibleRegion()
.itk.Image
header objects such asitk.ImageRegion
anditk.Matrix
.Steps to Reproduce
For case 1:
Expected behavior
Image is serialized to a bytestring and can be deserialized with
pickle.loads(result)
with no loss of informationActual behavior
Serialization fails because there is not a voxel buffer to convert to NumPy:
Additional Information
Related to work with
dask.distributed
in https://github.com/InsightSoftwareConsortium/itk-dregcc @thewtex
The text was updated successfully, but these errors were encountered: