简体   繁体   English

从SimpleITK中的3D阵列构建2D RGB图像

[英]2D RGB image construction from 3D array in SimpleITK

I have an RGB image in the format of a 3D array with the shape of (m, n, 3). 我有一个3D数组格式的RGB图像,其形状为(m,n,3)。 I would like to create a SimpleITK image. 我想创建一个SimpleITK图像。 Using the GetImageFromArray() function results in creation of an image in 3D which is not what I am looking for. 使用GetImageFromArray()函数可创建3D图像,这不是我想要的。 How can I create a 2D RGB image instead? 如何创建2D RGB图像呢?

The documentation reads: 该文档的内容如下:

Signature: sitk.GetImageFromArray(arr, isVector=None) 签名:sitk.GetImageFromArray(arr,isVector = None)

Docstring: Get a SimpleITK Image from a numpy array. Docstring:从一个numpy数组中获取一个SimpleITK图像。 If isVector is True, then the Image will have a Vector pixel type, and the last dimension of the array will be considered the component index. 如果isVector为True,则Image将具有Vector像素类型,并且数组的最后一个维将被视为组件索引。 By default when isVector is None, 4D images are automatically considered 3D vector images. 默认情况下,当isVector为None时,将自动将4D图像视为3D矢量图像。

Have you tried passing isVector=True ? 您是否尝试过传递isVector=True

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

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