The following codes cause exception: “vtkUnsignedShortArray (0000014ECA3A0510): Unable to allocate 1566872789057536 elements of size 2 bytes”.
vtkSmartPointer<vtkImageData> image =
vtkSmartPointer<vtkImageData>::New();
image->SetDimensions(512, 512, 151);
image->AllocateScalars(VTK_UNSIGNED_SHORT, 512*512*151);
Note that 512x512x151 is 39583744, much less than 1566872789057536. This happens in both VTK 7.1 and VTK 9.0. It works for small size of memory such as 10000. Any help is greatly appreciated.