It appears quite hard to fully support 64-bit memory address space (including images of more than 4 GB), in ITK source code. On many places, it appears that a 64-bit “size” or offset value is converted to 32-bit (depending on platform, compiler and CMake options), which could cause a crash when an ITK based user application processes large image data.
I did a first pull request, which fixes some cases of narrowing conversion from 64-bit “size type” to 32-bit: Pull request #1087: Fix possible loss of data on type conversion But honestly, this is just a tip of the iceberg!
A thing dat makes 64-bit support harder is that C++ and ITK both define various different “size types” and “offset types”, which may or may not have the same number of bits.
It seems much easier to me if ITK would drop the
ITK_USE_64BITS_IDS option, and just do
using SizeValueType = std::size_t;
std::size_t is always 32-bit on a 32-bit application, and 64-bit on a 64-bit application, right? It seems to me that that would be fine for
itk::SizeValueType as well. What do you think?