Your are correct:<br><br> typedef unsigned char PixelType;<br> typedef itk::Point<PixelType, ImageDimension> PointType;<br> typedef itk::Vector<PixelType, ImageDimension> VectorType;<br>
<br>solved the problem. I looked at the examples in the itksoftwareguide and they used float for the point and vectortype so assumed incorrectly that this was unrelated.<br><br>Another thing. The deformation field looks like this:<br>
<br><a href="http://img18.imageshack.us/img18/5054/deform.jpg">http://img18.imageshack.us/img18/5054/deform.jpg</a><br><br>and like this when I open it with paraview:<br><br><a href="http://img23.imageshack.us/img23/5054/deform.jpg">http://img23.imageshack.us/img23/5054/deform.jpg</a><br>
<br>If I use the calculator to change to vector nothing happens.<br><br>In the itkSoftwareGuide it says:<br><br>"It may be also desirable to write the deformation field as an image of vectors. This can be done<br>with the following code."<br>
<br> typedef itk::ImageFileWriter< DeformationFieldType > FieldWriterType;<br> FieldWriterType::Pointer fieldWriter = FieldWriterType::New();<br> fieldWriter->SetFileName( argv[4] );<br> fieldWriter->SetInput( filter->GetOutput() );<br>
fieldWriter->Update();<br><br>"Note that the file format used for writing the deformation field must be capable of representing<br>multiple components per pixel. This is the case for the MetaImage and VTK file formats for<br>
example."<br><br><br>As I understand I need to store the deformation field in another format than PNG (unless this format supports "multiple components per pixel") to make the conversion to vectors in paraview. Is that correct?<br>
<br><br><br><br><div class="gmail_quote">2009/7/22 Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@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;">
The source code he posted shows that he is trying to write the type:<br>
<div class="im">typedef itk::Image<VectorType, ImageDimension><br>
DeformationFieldType;<br>
</div>where VectorType is float.<br>
<div class="im"><br>
2009/7/21 Ramón Casero Cañas <<a href="mailto:ramon.casero@comlab.ox.ac.uk">ramon.casero@comlab.ox.ac.uk</a>>:<br>
</div><div><div></div><div class="h5">> Bill Lorensen wrote:<br>
>><br>
>> The thrown exception is very clear...<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>
>> You must choose an output file type that supports the type you are<br>
>> trying to write. I would suggest .mhd. If you can think of a better<br>
>> exception message, please let us know.<br>
><br>
><br>
> Hi Bill,<br>
><br>
> Thaks for your reply. I don't think we have expressed any issues about the<br>
> exception itself, but motes said that he's defining the PixelType as<br>
> unsigned char/short, yet writing the data fails.<br>
><br>
> Oh! Is this a problem with any of the intermediate steps changing the pixel<br>
> type?<br>
><br>
> On a related note: Where is the method GetComponentType() called by<br>
> PNGImageIO::WriteSlice declared? I'm sure it's very obvious where it is, but<br>
> I have been searching for it in the ITK code (grep and [1]), and I couldn't<br>
> find it.<br>
><br>
> [1] <a href="http://www.itk.org/Doxygen/html/functions.html" target="_blank">http://www.itk.org/Doxygen/html/functions.html</a><br>
><br>
> Cheers,<br>
><br>
> R.<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><br>