我使用 simpleITK 读取 nifti 图像 (.nii)图像采用 Image<float,3> 格式如何将此图像转换为 C# 数组并统一显示?

问题描述

    void ReadImage(string path)
    {
        eText.text = path;   
        itk.simple.Image input = SimpleITK.ReadImage(path);
        Debug.Log(input);
    }

Debug.Log 给出 Image 我需要将此图像转换为类似于 python 中可用的 satk.GetArrayFromImage() 方法的 C# 数组。

解决方法

在 CSharp(和其他包装语言)中,您可以使用 GetBufferAsFloat 方法获取图像的副本。

您可以在 SimpleITK CSharp 集成示例中看到它的使用情况:

https://simpleitk.readthedocs.io/en/master/link_CSharp_docs.html