python/simpleITK 剥头骨

Skull stripping with python/simpleITK

我正尝试在 python 中使用 simpleITK 执行头骨剥离。 我正在使用 StripTsImageFilter 函数,如下所示:

#upload data
# Path of nii img
path = r'C:\Users\Kate\Jupyter\DataThesis\PROGRESSION[=11=]03\fet.nii.gz'

# Read the .nii image with SimpleITK:
img = sitk.ReadImage(path)

#read atlas and atlasmap
#Obtained from 3DSlicer documentation: https://www.slicer.org/wiki/Documentation/Nightly/Modules/SwissSkullStripper

atlas = sitk.ReadImage(r'C:\Users\Kate\Jupyter\thesis\atlasImage.mha')
atlasMask = sitk.ReadImage(r'C:\Users\Kate\Jupyter\thesis\atlasMask.mha')

#Skull stripping 
#https://www.istb.unibe.ch/e43946/e43949/e158631/e187931/pane187932/e187939/files187941/article_eng.pdf

brainMask = sitk.StripTsImageFilter(img, atlas, atlasMask)

我收到错误“AttributeError:模块 'SimpleITK' 没有属性 'StripTsImageFilter'” 我已经尝试实施 img.StripTsImageFilter 并尝试使用 sitk.SkullStrip.StripTsFilter。

有人知道怎么解决吗?

StripTsImageFilter 是 ITK 的 'remote' 模块。所以它没有被 SimpleITK 包装,甚至没有在 ITK 中默认构建。

要在 Python 中访问它,您将不得不使用 ITK 的 Python 包装,并且您将不得不自己构建 ITK-Python,因为它不在 PyPi 上的 pre-build ITK-Python。