Cannot import numpy array using updateVolumeFromArray

I have a numpy file that I am trying to import using the updateVolumeFromArray function. The file can load into slicer as a numpy array, but the second I go to update the volume, and display the image (clicking on the volume eye button from the data module), the entire system crashes. I can call the matrix in, and I can perform operations on it such as finding out the unique values, but I cannot display it in slicer? My matrix is a 128X256X256 numpy array with binary values of 0-4.

Can you provide sample code and data set?

So, I import my volume with np.load(filepath)['arr_0']. I then create a volume node with volumeNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLScalarVolumeNode", nodeName) and update the volume with updateVolumeFromArray. The second I go to click on the visualize button the system crashes. Here is a link to my file: https://drive.google.com/open?id=1C4RmyRS-4YWwO_c6IhWOGEpV3ImGqVri

The link requires authentication. Please approve the read request or share with a public link.

The problem was that the numpy array in that file had “long long” type. You had to cast it to a type that VTK can handle:

import numpy as np
filepath=r"c:\Users\andra\Downloads\am_output.npz"
volumeNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLLabelMapVolumeNode")
voxels=np.load(filepath)['arr_0'].astype(np.int16)
updateVolumeFromArray(volumeNode,voxels)
setSliceViewerLayers(background=volumeNode, fit=True)

I have updated updateVolumeFromArray to report an error when “long long” array is attempted to be loaded.