0

I'm using SimpleITK to load in a layered tiff image, its a volumetric image having 30 planes/slices.

After playing around a lot with skimage and imageio Ive found out that SimpleITK is the best way to handle volumetric images but the problem is that none of the functions seem to work for my image.

img = sitk.ReadImage(path)

After reading the image in, I can easily convert it to numpy and even display it using sitk.Show() so its loading up properly. but any function I use on it such as:

img_s = sitk.CurvatureFlow(img, 0.125, 5)
# or
sitk.IntensityWindowing(img)
# or
img_m = sitk.ConnectedThreshold(img, (257,419,7))

gives the warning:

sitk::ERROR: Pixel type: vector of 16-bit unsigned integer is not supported in 3D byclass itk::simple::

I tried casting to to any other datatype as well but I keep getting errors again:

img2 = sitk.Cast(img, sitk.sitkFloat32)

sitk::ERROR: Filter does not support casting from casting vector of 16-bit unsigned integer to 32-bit float

I tried a 2D variation as well of the above:

img_m = sitk.ConnectedThreshold(img2[:,:,7], [(257,419)])

but this time I got the error:

sitk::ERROR: Pixel type: vector of 64-bit float is not supported in 2D byclass itk::simple::ConnectedThresholdImageFilter

Any idea what may be causing this?

P.S. I have read the question: SimpleITK N4BiasFieldCorrection, not working with any data type and I believe this is not a duplicate as his problem is solved by casting whereas mine does not work even for casting.

Thanks

4

1 回答 1

1

看起来您的图像具有矢量像素类型。许多过滤器不适用于矢量像素。您需要选择向量的一个特定元素来应用此类过滤器。

您可以使用 VectorIndexSelectionCastImageFilter 或函数 VectorIndexSelectionCast 将矢量的特定通道提取到标量图像。

于 2018-11-13T20:13:35.480 回答