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<float, ImageDimension> PointType;<br>
typedef itk::Vector<float, ImageDimension> VectorType;<br> typedef itk::Image<VectorType, ImageDimension> DeformationFieldType;<br>
typedef TransformType::SpacingType SpacingType;<br> typedef TransformType::ParametersType ParametersType;<br> typedef TransformType::OriginType OriginType;<br>
typedef itk::ImageRegionIterator<DeformationFieldType> FieldIterator;<br> typedef itk::ImageFileWriter<DeformationFieldType> FieldWriterType;<br>
<br> DeformationFieldType::Pointer field = DeformationFieldType::New();<br> FieldWriterType::Pointer fieldWriter = FieldWriterType::New();<br><br>...<br>...<br><br>std::string in_field = "c:\deformed_field.png";<br>
<br> fieldWriter->SetInput( field );<br><br> if( !in_field.empty() )<br> {<br> fieldWriter->SetFileName(in_field);<br> try<br> {<br> fieldWriter->Update();<br> }<br> catch( itk::ExceptionObject & excp )<br>
{<br> std::cerr << "Exception thrown " << std::endl;<br> std::cerr << excp << 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"><<a href="mailto:mort.motes@gmail.com">mort.motes@gmail.com</a>></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"><<a href="mailto:ramon.casero@comlab.ox.ac.uk" target="_blank">ramon.casero@comlab.ox.ac.uk</a>></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->Update();<br>
<br>
throws the exception:<br>
<br>
Exception thrown<br>
<br>
itk::ExceptionObject (00CAE438)<br>
Location: "void __thiscall itk::PNGImageIO::WriteSlice(const class<br>
std::basic_string<char,struct std::char_traits<c<br>
har>,class std::allocator<char> > &,const void *)"<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>
"Description: PNG supports unsigned char and unsigned short"<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>