-
-
Notifications
You must be signed in to change notification settings - Fork 668
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG: Support serialization of an empty itk.Image
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. #4267.
- Loading branch information
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,10 @@ | |
i.e. k,j,i versus i,j,k. However C-order indexing is expected by most | ||
algorithms in NumPy / SciPy. | ||
""" | ||
|
||
if image.GetBufferPointer() is None: | ||
return None | ||
|
||
if update: | ||
# Ensure the image regions and image pixel buffer have been updated | ||
# correctly | ||
|
@@ -46,6 +50,8 @@ | |
|
||
This is a deep copy of the image buffer and is completely safe and without potential side effects. | ||
""" | ||
if image.GetBufferPointer() is None: | ||
return None | ||
|
||
arrayView = itkPyBuffer@[email protected](image, keep_axes, update) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters