Repository navigation
Fix GetCTypeForDType(itk_ctype.dtype) round-trip - #6783
hjmjohnson merged 4 commits into
Conversation
|
WIP probably because it just adds a test, not a fix. |
The order in which these itkCType objects are created appears relevant for the mapping from NumPy `dtype` to itkCType!
Aims to fix issue InsightSoftwareConsortium#6782 "itkCType.GetCTypeForDType(np.uint32) should return the CType for `unsigned int`"
Fixes issue InsightSoftwareConsortium#6785 "On Linux, GetCTypeForDType(np.uint64) should return UL, and GetCTypeForDType(np.int64) should return SL"
Tests that GetCTypeForDType(itk_ctype.dtype) is equal to itk_ctype, for the itkCType aliases with a specified size.
802f1ac to
b22d58e
Compare
|
Thanks @hjmjohnson! Two days ago, this was still WIP, because I expected the added test to fail. And indeed, it said on Linux-Build16899-PR6783-GetCTypeForDType-round-trip-Python test CTypeTest: This was fixed by the commit BUG: Let initialize_c_types_once create ULL and SLL before UL and SL, that I added to this PR. So it was originally WIP, because I was doing Test Driven Development (TDD) 😇 |
Reordered the creation of itkCType objects in initialize_c_types_once, in order to fix the following two issues:
unsigned int#6782Documented that the order in which these itkCType objects are created is relevant for the mapping from NumPy
dtypeto itkCType.Added a Python unit test to check the round-trip itkCType ==> dtype ==> itkCType, for numeric C types with specified sizes ("fixed width types"): int8_t, uint8_t, int16_t, uint16_t, etc.