-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose data type of CuImage object for interoperability with NumPy (#246
) - Expose typestr property on CuImage object - Expose DLDataType and DLDataTypeCode under cucim.clara Without this patch, DLDataType and DLDataTypecode can be accessible with the below workaround. ```python >>> from cucim import CuImage >>> a = CuImage("notebooks/input/image.tif") >>> b = a.read_region((0,0), (10,10)) >>> import numpy as np >>> np.dtype(b.__array_interface__["typestr"]) # b would expose `__cuda_array_interface__` if memory is in GPU. dtype('uint8') ``` With this patch, we can convert data type to NumPy's dtype easily, and also can access cuCIM's DLDataType. ```python >>> from cucim import CuImage >>> a = CuImage("notebooks/input/image.tif") >>> b = a.read_region((0,0), (10,10)) >>> import numpy as np >>> b.typestr '|u1' >>> np.dtype(b.typestr) == np.uint8 True >>> from cucim.clara import DLDataType, DLDataTypeCode >>> b.dtype == DLDataType(DLDataTypeCode.DLUInt, 8, 1) True ``` Fixes #243 Authors: - Gigon Bae (https://github.com/gigony) Approvers: - https://github.com/jakirkham URL: #246
- Loading branch information
Showing
12 changed files
with
216 additions
and
76 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
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
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
Oops, something went wrong.