如何计算nifti医学图像的单个体素的体积?

问题描述 投票:0回答:1

我已经使用nibabel工具加载了一个nifti图像文件,并且已经使用了一些属性。但是我不知道如何计算单个体素的体积(以mm³为单位)。

volume voxel medical nifti nibabel
1个回答
0
投票

我不是NiBabel专家,但是我可以推荐Python的SimpleITK软件包。我经常用它来读取NifTi图像文件。它具有方法GetSpacing(),该方法返回以mm为单位的像素间距。

import SimpleITK as sitk

# read image
im = sitk.ReadImage("/path/to/input/image.nii")

# get voxel spacing (for 3-D image)
spacing = im.GetSpacing()
spacing_x = spacing[0]
spacing_y = spacing[1]
spacing_z = spacing[2]

# determine volume of a single voxel
voxel_volume = spacing_x * spacing_y * spacing_z
© www.soinside.com 2019 - 2024. All rights reserved.