[ITK] [ITK-users] R-SimpleITK LabelStatisticsImageFilter 3D Error

Mathew Guilfoyle mrguilfoyle at gmail.com
Tue Jul 5 21:37:00 EDT 2016


Ziv: thanks for the reply.

I'm using the R wrapped version of SimpleITK

I've run the equivalent of your example:

library('SimpleITK')
image = ReadImage('training_001_ct.mha')

segmented_image = image>700

lisf = LabelIntensityStatisticsImageFilter()
lisf$Execute(segmented_image, image)

Unfortunately I'm getting the same error as for my own scripts:

Warning message:
In f(...) :
  Exception thrown in SimpleITK Show: /ITK/SITK/Source-Current/Build-290516/ITK-prefix/include/ITK-4.10/itkImageFileWriter.hxx:290:
itk::ERROR: ImageFileWriter(0x10c05cbc0): Largest possible region does not fully contain requested paste IO regionPaste IO region: ImageIORegion (0x7fff5fbf6cd8)
  Dimension: 2
  Index: 0 0 
  Size: 0 0 
Largest possible region: ImageRegion (0x7fff5fbf6d70)
  Dimension: 2
  Index: [0, 0]
  Size: [0, 0]

I have a feeling that this is a problem with the LabelIntensityStatisticsImageFilter being templated over 2D and 3D images and when it is instantiated it is defaulting to the 2D?  Previously using Python wrapped ITK (i.e. not SimpleITK) when I declared these filters I would give it a 2D or 3D image type but this is not possible in SimpleITK.

However, if this is working for you in Python-SimpleITK maybe it is an issue peculiar to the R wrapping?

Any further suggestions would be appreciated

Cheers

> On 5 Jul 2016, at 15:43, Yaniv, Ziv Rafael (NIH/NLM/LHC) [C] <zivrafael.yaniv at nih.gov> wrote:
> 
> 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

_____________________________________
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