Denoising filter on 64 bit Float pixel type image

Hi Team,

I am getting below error when I try to get intensity statistics for labelled image. The pixel type for segmented image is 32-bit unsigned integer. I am using SLIC algo on base image with following type:
pixel type: vector of 64-bit float
number of channels: 2

It seems SLIC outputs labelled image with Pixel type: 32-bit unsigned integer

sitk::ERROR: Pixel type: 32-bit unsigned integer is not supported in 3D

However, shape statistics label filter works fine for labelled image with Pixel type: 32-bit unsigned integer

Can you please guide how can I get label intensity stats for images working or am I missing something?


I think I found the issue. I was using vector image instead of using single channel image from which I need intensities. I can get the intensities measures after using segmented image with correct intensity image. Although I had to down cast 64-bit float intensity image down to 32-bit unsigned labelled image to make it work.


Can you please provide a minimal example to reproduce the issue?

Hi Bradley,

Here you go. If you pick sample pet and ct image and execute below code you will see error I mentioned. However in below code when I execute intensity stats with pet_image_resampled image the error seems to be resolved.

Let me know if you need more information.


import SimpleITK as sitk

ct_file_path = "../resources/P2/ct/"
pet_file_path = "../resources/P2/pet/"
image_dirs = [pet_file_path,ct_file_path]

def read_first_series_in_dir(dir):
    series_reader = sitk.ImageSeriesReader()
    series_IDs = sitk.ImageSeriesReader.GetGDCMSeriesIDs(dir)
    series_file_names = sitk.ImageSeriesReader.GetGDCMSeriesFileNames(dir, series_IDs[0])
    return series_reader.Execute()

images = [read_first_series_in_dir(image_dir) for image_dir in image_dirs]

pet_image = images[0]
ct_image = images[1]

pt_imgSmooth = sitk.CurvatureFlow(image1=pet_image, timeStep=0.125, numberOfIterations=5)
ct_imgSmooth = sitk.CurvatureFlow(image1=ct_image, timeStep=0.125, numberOfIterations=5)

# Resample PET onto CT grid using default interpolator and identity transformation.
pet_image_resampled = sitk.Resample(pt_imgSmooth, ct_imgSmooth)

# Compose the PET and CT image into a single two channel image.
# The pixel types of all channels need to match, so we upcast the CT from
# 32bit signed int to the PET pixel type of 64bit float.
pet_ct_combined = sitk.Compose(pet_image_resampled, sitk.Cast(ct_imgSmooth, pet_image_resampled.GetPixelID()))

imgSmoothWithSLIC = sitk.SLIC(image1=pet_ct_combined, superGridSize=[10, 10, 3],

# Get the intensity label stats
intensity_stats = sitk.LabelIntensityStatisticsImageFilter()
intensity_stats.Execute(imgSmoothWithSLIC, pet_ct_combined)

for label in intensity_stats.GetLabels():
    print("ROI Intensity Stats: {0} min: {1} avg: {2} max: {3}".format(label, intensity_stats.GetMinimum(label), intensity_stats.GetMean(label), intensity_stats.GetMaximum(label)))

Hi Bradley, Did above example code help for issue re-creation?