Reputation: 420
I'm new to ndarrays in Numpy, so please be kind.
I have a 3D raw volume imported into numpy as a dtype uint8 array with shape
(309L, 138L, 134L)
representing Z, Y, X dimensions.
The Raw image dimensions are (x,y,z), 134 138 309
This array is called ThreeD
.
I can plot a Z 'section' of dimension XY of ThreeD with
ThreeD[70]
(selecting row 70)
I can plot a Y 'section' of dimension XZ of ThreeD with
ThreeD[:,70]
(selecting column 70)
but of course, there is the extra dimension! These first two are easy to reference, but I'm at a loss of how to select/reference the third dimension.. i.e. the X section of dimension YZ (i.e. slicing a face of the matrix). I should add that I'm not entirely sure of the XZ/YZ dimension here, so those references might be reversed.
I got as far as I did using Sebastian Raschka's handy cheat sheet http://sebastianraschka.com/Articles/2014_matrix_cheatsheet.html
thanks kindly for any help
Upvotes: 1
Views: 983
Reputation: 420
ThreeD[70]
for Z
ThreeD[:, 70]
for Y
ThreeD[:, :, 70]
or ThreeD[..., 70]
for X
from Jaime. Thankyou.
Upvotes: 2