[Insight-users] Example of ITK
Ing. Arturo Vargas Olivares
ing.arturo.vargas at gmail.com
Thu May 10 14:27:05 EDT 2012
Hello to all !!
I have implemented this code in order to test an example from the ITK
software guide.
import numpy as np
import scipy.io as ios
import matplotlib.pyplot as mplot
import matplotlib.cm as cm
import SimpleITK as sitk
import sys
#
# Read the image
#
reader = sitk.ImageFileReader()
reader.SetFileName( 'BrainProtonDensitySlice.png' )
image = reader.Execute();
#
# Set up the writer
#
writer = sitk.ImageFileWriter()
writer.SetFileName( 'BrainProtonDensitySlice_out.png' )
#
# Blur using CurvatureFlowImageFilter
#
blurFilter = sitk.CurvatureFlowImageFilter()
blurFilter.SetNumberOfIterations( 5 )
blurFilter.SetTimeStep( 0.125 )
image = blurFilter.Execute( image )
#
# Set up ConnectedImageFilter for segmentation
#
segmentationFilter = sitk.ConnectedThresholdImageFilter()
segmentationFilter.SetLower(150)
segmentationFilter.SetUpper(180)
segmentationFilter.SetReplaceValue(255)
segmentationFilter.SetSeed((60,116))
image = segmentationFilter.Execute( image )
writer.Execute( image )
It seems that everything is OK except the execution of my filters (see
below). It says that the Pixel Type is the problem but I don't know how to
fix this.
Guys, do you have any ideas?
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
C:\Users\Student3\Desktop\MRI images\test8.py in <module>()
22 blurFilter.SetNumberOfIterations( 5 )
23 blurFilter.SetTimeStep( 0.125 )
---> 24 image = blurFilter.Execute( image )
25 #
26 # Set up ConnectedImageFilter for segmentation
C:\Python27\lib\site-packages\simpleitk-0.4.0-py2.7-win-amd64.egg\SimpleITK.pyc
in Execute(self, *args)
8050
8051 """
-> 8052 return _SimpleITK.CurvatureFlowImageFilter_Execute(self,
*args)
8053
8054 __swig_destroy__ = _SimpleITK.delete_CurvatureFlowImageFilter
RuntimeError: Exception thrown in SimpleITK
CurvatureFlowImageFilter_Execute: c:\users\bradley
lowekamp\documents\source\simpleitk\code\common\include\sitkMemberFunctionFactory.txx:174:
sitk::ERROR: Pixel type: vector of 8-bit unsigned integer is not supported
in 2D byclass itk::simple::CurvatureFlowImageFilter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120510/2c26ed39/attachment.htm>
More information about the Insight-users
mailing list