elastix
elastix copied to clipboard
Size of PixelType "long" platform dependent, causing confusion
The size of pixels specified by FixedInternalImagePixelType = "long", MovingInternalImagePixelType = "long", or ResultImagePixelType = "long" is platform dependent. On Windows, long is typically 32-bit (just like int), while on Linux, it is typically 64-bit (just like long long).
It would be clearer if elastix would support "int32" and "int64" to specify pixel types of 32 bits and 64 bits, respectively.
What do other libraries do?
- MetaIO (implementing the MHD and MHA file formats) uses both
MET_INTandMET_LONGfor 32-bit pixel types. It usesMET_LONG_LONGfor 64-bit integers. https://github.com/Kitware/MetaIO/blob/355483a6bf98df21b4e1817ed16e7e7fcc28ea47/src/metaTypes.h#L64-L99 - PyTorch/LibTorch uses
kLongfor 64-bits integers. For example, https://github.com/pytorch/pytorch/blob/6b1acfa41bd3b5b81c2adbd2fcc74b3302fa8376/torch/csrc/utils/python_scalars.h#L50
Personally I would prefer to deprecate using "long" for the PixelType parameters of elastix.
Having said so, this may be a minor problem, because "long" is probably rarely used as PixelType.