<div><font color="#000066" size="4">Hello to all !!</font></div><div><font color="#000066" size="4"></font> </div><div><font color="#000066" size="4">I have implemented this code in order to test an example from the ITK software guide.</font></div>
<div> </div><div>import numpy as np<br>import <a href="http://scipy.io">scipy.io</a> as ios<br>import matplotlib.pyplot as mplot<br>import <a href="http://matplotlib.cm">matplotlib.cm</a> as cm<br>import SimpleITK as sitk<br>
import sys<br>#<br># Read the image<br>#<br>reader = sitk.ImageFileReader()<br>reader.SetFileName( 'BrainProtonDensitySlice.png' )<br>image = reader.Execute();<br>#<br># Set up the writer<br>#<br>writer = sitk.ImageFileWriter()<br>
writer.SetFileName( 'BrainProtonDensitySlice_out.png' )<br>#<br># Blur using CurvatureFlowImageFilter<br>#<br>blurFilter = sitk.CurvatureFlowImageFilter()<br>blurFilter.SetNumberOfIterations( 5 )<br>blurFilter.SetTimeStep( 0.125 )<br>
image = blurFilter.Execute( image )<br>#<br># Set up ConnectedImageFilter for segmentation<br>#<br>segmentationFilter = sitk.ConnectedThresholdImageFilter()<br>segmentationFilter.SetLower(150)<br>segmentationFilter.SetUpper(180)<br>
segmentationFilter.SetReplaceValue(255)<br>segmentationFilter.SetSeed((60,116))<br>image = segmentationFilter.Execute( image )<br>writer.Execute( image )<br> </div><div> </div><div><font color="#000066" size="4">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.</font></div>
<div> </div><div><font color="#000066" size="4">Guys, do you have any ideas? </font></div><div><font color="#000066" size="4"></font> </div><div>---------------------------------------------------------------------------<br>
RuntimeError Traceback (most recent call last)<br>C:\Users\Student3\Desktop\MRI images\test8.py in <module>()<br> 22 blurFilter.SetNumberOfIterations( 5 )<br> 23 blurFilter.SetTimeStep( 0.125 )<br>
---> 24 image = blurFilter.Execute( image )<br> 25 #</div><div> 26 # Set up ConnectedImageFilter for segmentation</div><div><br>C:\Python27\lib\site-packages\simpleitk-0.4.0-py2.7-win-amd64.egg\SimpleITK.pyc in Execute(self, *args)<br>
8050 <br> 8051 """<br>-> 8052 return _SimpleITK.CurvatureFlowImageFilter_Execute(self, *args)<br> 8053 <br> 8054 __swig_destroy__ = _SimpleITK.delete_CurvatureFlowImageFilter</div>
<div>RuntimeError: Exception thrown in SimpleITK CurvatureFlowImageFilter_Execute: c:\users\bradley lowekamp\documents\source\simpleitk\code\common\include\sitkMemberFunctionFactory.txx:174:<br>sitk::ERROR: Pixel type: vector of 8-bit unsigned integer is not supported in 2D byclass itk::simple::CurvatureFlowImageFilter</div>