<div><span class="Apple-style-span" style="font-family:monospace,fixed;font-size:12px;line-height:15px;white-space:pre;background-color:rgb(251,252,253)">Hi Arturo, </span></div><div><span class="Apple-style-span" style="font-family:monospace,fixed;font-size:12px;line-height:15px;white-space:pre;background-color:rgb(251,252,253)"><br>
</span></div><div><span class="Apple-style-span" style="font-family:monospace,fixed;font-size:12px;line-height:15px;white-space:pre;background-color:rgb(251,252,253)">the following line should cast the image to float </span></div>
<span class="Apple-style-span" style="font-family:monospace,fixed;font-size:12px;line-height:15px;white-space:pre;background-color:rgb(251,252,253)">image = sitk.Cast( image, sitk.sitkFloat32 )</span><br><div class="gmail_quote">
<br></div><div class="gmail_quote">Let us know how it goes </div><div class="gmail_quote"><br></div><div class="gmail_quote">Cagatay</div><div class="gmail_quote"><br></div><div class="gmail_quote">On Thu, May 10, 2012 at 11:36 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>I&#39;m new in this...</div><div>how do I cast my image to float?</div><div class="HOEnZb"><div class="h5"><div><br>
<br> </div><div class="gmail_quote">On Thu, May 10, 2012 at 2:31 PM, Cagatay Bilgin <span dir="ltr">&lt;<a href="mailto:bilgincc@gmail.com" target="_blank">bilgincc@gmail.com</a>&gt;</span> wrote:<br>
<blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">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"><div><div>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>


</div></div><blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote"><div><div><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></div></div>_____________________________________<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>
</blockquote></div><br>
</div></div></blockquote></div><br>