elastix icon indicating copy to clipboard operation
elastix copied to clipboard

Size of PixelType "long" platform dependent, causing confusion

Open N-Dekker opened this issue 6 months ago • 1 comments

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_INT and MET_LONG for 32-bit pixel types. It uses MET_LONG_LONG for 64-bit integers. https://github.com/Kitware/MetaIO/blob/355483a6bf98df21b4e1817ed16e7e7fcc28ea47/src/metaTypes.h#L64-L99
  • PyTorch/LibTorch uses kLong for 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.

N-Dekker avatar Apr 28 '25 19:04 N-Dekker