Try casting your image to float type before <div>you feed to the smoother. That should do it </div><div>I guess. </div><div><br></div><div>Cagatay<br><br><div class="gmail_quote">On Thu, May 10, 2012 at 11:27 AM, Ing. Arturo Vargas Olivares <span dir="ltr">&lt;<a href="mailto:ing.arturo.vargas@gmail.com" target="_blank">ing.arturo.vargas@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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" target="_blank">scipy.io</a> as ios<br>import matplotlib.pyplot as mplot<br>import <a href="http://matplotlib.cm" target="_blank">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( &#39;BrainProtonDensitySlice.png&#39; )<br>image = reader.Execute();<br>#<br># Set up the writer<br>#<br>writer = sitk.ImageFileWriter()<br>

writer.SetFileName( &#39;BrainProtonDensitySlice_out.png&#39; )<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&#39;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 &lt;module&gt;()<br>     22 blurFilter.SetNumberOfIterations( 5 )<br>     23 blurFilter.SetTimeStep( 0.125 )<br>

---&gt; 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         &quot;&quot;&quot;<br>-&gt; 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>

<br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br></div>