ENH: Add ctype aliases for numeric types of specific sizes to Python - #6762
Conversation
30289a6 to
bbffc33
Compare
|
bbffc33 to
faaacd4
Compare
|
How about using ? |
Thanks Matt, can you please elaborate a little bit? For example, how would you define a 2D itk P.S. It looks like there is a bug at # This is a Mapping from numpy array types to itk pixel types. (Bug?)
_np_itk = {
...
np.dtype(np.int64): itk.SL,
...
}
# This is a Mapping from numpy array types to itk pixel types. (Fixed!)
_np_itk = {
...
np.dtype(np.int64): itk.int64_ctype,
...
}Is that what you meant to say? |
I think it would be easier to write, easier to read, and more expected names if we had
Good catch! |
faaacd4 to
1d06a17
Compare
|
Update: Inspired by Matt's comments, I just renamed the proposed aliases (with this force-pushed amend) to: Under the hood, they are still simply aliases of The PR will now allow users to write (for example) Hope that it's good enough now! |
Added the following aliases:
float32_t
float64_t
uint8_t
uint16_t
uint32_t
uint64_t
int8_t
int16_t
int32_t
int64_t
Aims to provide a more human-readable alternative to F, D, UC, US, UI, UL, ULL,
SC, SS, SI, SL, SLL, etc. Eases writing code for which the specific size of
numeric types should be platform-independent.
1d06a17 to
dc0ea28
Compare
Added the following aliases:
Aims to provide a more human-readable alternative to F, D, UC, US, UI, ULL, SC, SS, SI, and SLL. Eases writing code for which the specific size of numeric types should be platform-independent.
Typical use cases, specifying the pixel type of an image:
itk.Image[itk.uint8_ctype, 2](equivalent toitk.Image[itk.UC, 2])itk.Image[itk.float64_ctype, 2](equivalent toitk.Image[itk.D, 2])