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.
Asked
Active
Viewed 409 times
1
-
I think you may be interested in parts B. and C. from [this answer](https://stackoverflow.com/a/42611693/4124317). – ImportanceOfBeingErnest Jul 25 '18 at 21:50
1 Answers
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