[ITK] [ITK-users] LabelStatisticsImageFilter in 3D

Yaniv, Ziv Rafael (NIH/NLM/LHC) [C] zivrafael.yaniv at nih.gov
Tue Jul 5 10:43:57 EDT 2016


Hi Mathew,

As I haven¹t seen your code I cannot pinpoint the issue, but it is not the
dimension of the image.

The following SimpleITK code does what I believe you are asking for (image
is available here - https://midas3.kitware.com/midas/item/317034):

import SimpleITK as sitk

image = sitk.ReadImage("training_001_ct.mha")

# HU values for bone are 700 and up
segmented_image = image>700

# segmented label for the threshold operation is 1 (0 for everything else).
# the LabelIntensityStatisticsImageFilter also works with multiple labels
and not just a binary segmentation.
segmented_label = 1

lisf = sitk.LabelIntensityStatisticsImageFilter()
lisf.Execute(segmented_image, image)

print("mean HU value: {0:.2f}".format(lisf.GetMean(segmented_label)))

     hope this helped

             Ziv






On 7/3/16, 9:11 PM, "Mathew Guilfoyle" <mrguilfoyle at gmail.com> wrote:

>Hi
>
>Using SimpleITK I'm trying to get statistics for a grayscale image
>segmentation for which I have a binary mask.  Both image and mask are 3D
>volumes
>
>I have converted my binary mask to a Label map and then tried to apply
>the LabelStatisticsImageFilter, however I get the following exception:
>
>Pixel type: 32-bit float is not supported in 3D
>
>I've tried casting the intensity image to unsigned int, Float 64 etc...
>none of them work.  It seems to be the 3D that is the issue.  Is this
>filter defined for 3D images?  There is nothing I have found in the
>documentation/source to suggest not.
>
>Thanks
>_____________________________________
>Powered by www.kitware.com
>
>Visit other Kitware open-source projects at
>http://www.kitware.com/opensource/opensource.html
>
>Kitware offers ITK Training Courses, for more information visit:
>http://www.kitware.com/products/protraining.php
>
>Please keep messages on-topic and check the ITK FAQ at:
>http://www.itk.org/Wiki/ITK_FAQ
>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/insight-users

_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list