1

I'm trying to display 3D data using matplolib. I have a list of numpy arrays representing DICOM slices. Each slice contains structure points. I want to display this structure in 3d but dicom voxels are of irregular shape. Ex their shape is [1.4, 1.4, 2]. Is there a way to scale axes in x, y and z dimensions, so it would show how the structure really looks like? Currently, when i display it looks deformed.

Biba
  • 631
  • 9
  • 28

1 Answers1

1

Yes, you can pass in x, y, z into the voxels method

my_data = ...
x, y, z = np.indices(np.array(my_data.shape) + 1)
x *= 2
y *= 2
z *= 1.4
ax.voxels(x, y, z, my_data)

This will produce a plot with correct axis scales, but this may still look deformed unless you set axis scales correctly.

Eric
  • 95,302
  • 53
  • 242
  • 374