The error has moved on to when I try to create the deformation field in the BSplineWarping1.cxx example (modified slightly below)<br><br><br>  typedef itk::Point&lt;float, ImageDimension&gt;                                               PointType;<br>
  typedef itk::Vector&lt;float, ImageDimension&gt;                                              VectorType;<br>  typedef itk::Image&lt;VectorType, ImageDimension&gt;                                          DeformationFieldType;<br>
  typedef TransformType::SpacingType                                                      SpacingType;<br>  typedef TransformType::ParametersType                                                   ParametersType;<br>  typedef TransformType::OriginType                                                       OriginType;<br>
  typedef itk::ImageRegionIterator&lt;DeformationFieldType&gt;                                  FieldIterator;<br>  typedef itk::ImageFileWriter&lt;DeformationFieldType&gt;                                      FieldWriterType;<br>
<br>  DeformationFieldType::Pointer field = DeformationFieldType::New();<br>  FieldWriterType::Pointer fieldWriter = FieldWriterType::New();<br><br>...<br>...<br><br>std::string in_field = &quot;c:\deformed_field.png&quot;;<br>
<br>    fieldWriter-&gt;SetInput( field );<br><br>        if( !in_field.empty() )<br>    {<br>      fieldWriter-&gt;SetFileName(in_field);<br>      try<br>      {<br>        fieldWriter-&gt;Update();<br>      }<br>      catch( itk::ExceptionObject &amp; excp )<br>
      {<br>        std::cerr &lt;&lt; &quot;Exception thrown &quot; &lt;&lt; std::endl;<br>        std::cerr &lt;&lt; excp &lt;&lt; std::endl;<br>        return EXIT_FAILURE;<br>      }<br>    }<br><br><br>Should the deformation field have a certain type?<br>
<br><br><br><div class="gmail_quote">2009/7/21 motes motes <span dir="ltr">&lt;<a href="mailto:mort.motes@gmail.com">mort.motes@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Ok in the followup its recommended to change the type of PixelType to:<br><br>typedef unsigned char  PixelType;<br>
<br>or<br>
<br>
typedef unsigned short   PixelType;<br><br><br>But I already declared it as :<br><br>typedef unsigned char  PixelType;<br><br>and I have also tried:<br><br>typedef unsigned short   PixelType;<br><br>but I still get the same error, any ideas?<br>

<br><br><br><br><div class="gmail_quote">2009/7/21 Ramón Casero Cañas <span dir="ltr">&lt;<a href="mailto:ramon.casero@comlab.ox.ac.uk" target="_blank">ramon.casero@comlab.ox.ac.uk</a>&gt;</span><div><div></div><div class="h5">
<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>motes motes wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
But the call:<br>
      fixedReader-&gt;Update();<br>
<br>
throws the exception:<br>
<br>
Exception thrown<br>
<br>
itk::ExceptionObject (00CAE438)<br>
Location: &quot;void __thiscall itk::PNGImageIO::WriteSlice(const class<br>
std::basic_string&lt;char,struct std::char_traits&lt;c<br>
har&gt;,class std::allocator&lt;char&gt; &gt; &amp;,const void *)&quot;<br>
File: ..\..\..\Code\IO\itkPNGImageIO.cxx<br>
Line: 473<br>
Description: PNG supports unsigned char and unsigned short<br>
<br>
<br>
I have tried removing the update() call but then I get an error further down<br>
the code. It seems that the error is related to the PNG format of the file,<br>
any ideas?<br>
</blockquote>
<br></div><div>
Hi motes,<br>
<br>
A quick search in google of the error, i.e. search for<br>
<br></div><div>
&quot;Description: PNG supports unsigned char and unsigned short&quot;<br>
<br></div><div><div></div><div>
shows that this problem has been addressed in a previous thread of this list<br>
<br>
<a href="http://www.itk.org/pipermail/insight-users/2006-September/019320.html" target="_blank">http://www.itk.org/pipermail/insight-users/2006-September/019320.html</a><br>
<br>
Cheers,<br>
<br>
Ramon.<br>
<br>
-- <br>
Ramón Casero Cañas, DPhil<br>
<br>
Computational Biology, Computing Laboratory<br>
University of Oxford<br>
Wolfson Building, Parks Rd<br>
Oxford OX1 3QD<br>
<br>
tlf     +44 (0) 1865 610807<br>
web     <a href="http://web.comlab.ox.ac.uk/people/Ramon.CaseroCanas" target="_blank">http://web.comlab.ox.ac.uk/people/Ramon.CaseroCanas</a><br>
photos  <a href="http://www.flickr.com/photos/rcasero/" target="_blank">http://www.flickr.com/photos/rcasero/</a><br>
<br>
</div></div></blockquote></div></div></div><br>
</blockquote></div><br>