简体   繁体   English

python中的3D体积杂技。在3D numpy数组中选择x / y / z行/列

[英]3D volume acrobatics in python.. selecting x/y/z rows/columns in 3D numpy arrays

I'm new to ndarrays in Numpy, so please be kind. 我是Numpy的ndarrays的新手,所以请保持友好。 I have a 3D raw volume imported into numpy as a dtype uint8 array with shape (309L, 138L, 134L) representing Z, Y, X dimensions. 我将3D原始体积作为dtype uint8数组导入到numpy中,其形状(309L, 138L, 134L)表示Z,Y,X尺寸的形状(309L, 138L, 134L)

The Raw image dimensions are (x,y,z), 134 138 309 原始图像尺寸为(x,y,z),134138309

This array is called ThreeD . 该数组称为ThreeD

I can plot a Z 'section' of dimension XY of ThreeD with 我可以画出ThreeD的XY尺寸的Z'截面'

ThreeD[70]

(selecting row 70) (选择第70行)

I can plot a Y 'section' of dimension XZ of ThreeD with 我可以用以下方式绘制ThreeD的XZ尺寸的Y“截面”

ThreeD[:,70]

(selecting column 70) (选择第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.. ie the X section of dimension YZ (ie slicing a face of the matrix). 前两个很容易引用,但是我不知道如何选择/引用第三个维度。即,维度YZ的X部分(即切片矩阵的一个面)。 I should add that I'm not entirely sure of the XZ/YZ dimension here, so those references might be reversed. 我应该补充一点,就是我不确定XZ / YZ尺寸,因此这些引用可能会颠倒。

I got as far as I did using Sebastian Raschka's handy cheat sheet http://sebastianraschka.com/Articles/2014_matrix_cheatsheet.html 我使用塞巴斯蒂安·拉施卡(Sebastian Raschka)方便的备忘单http://sebastianraschka.com/Articles/2014_matrix_cheatsheet.html

thanks kindly for any help 谢谢你的帮助

ThreeD[70] for Z Z ThreeD[70]

ThreeD[:, 70] for Y Y ThreeD[:, 70]

ThreeD[:, :, 70] or ThreeD[..., 70] for X ThreeD[:, :, 70]ThreeD[..., 70]X

from Jaime. 来自海梅。 Thankyou. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM