[Insight-users] Problems with fixedReader->Update();

motes motes mort.motes at gmail.com
Wed Jul 22 05:25:56 EDT 2009


Your are correct:

  typedef unsigned char
PixelType;
  typedef itk::Point<PixelType, ImageDimension>            PointType;
  typedef itk::Vector<PixelType, ImageDimension>          VectorType;

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.

Another thing. The deformation field looks like this:

http://img18.imageshack.us/img18/5054/deform.jpg

and like this when I open it with paraview:

http://img23.imageshack.us/img23/5054/deform.jpg

If I use the calculator to change to vector nothing happens.

In the itkSoftwareGuide it says:

"It may be also desirable to write the deformation field as an image of
vectors. This can be done
with the following code."

        typedef itk::ImageFileWriter< DeformationFieldType >
FieldWriterType;
        FieldWriterType::Pointer fieldWriter = FieldWriterType::New();
        fieldWriter->SetFileName( argv[4] );
        fieldWriter->SetInput( filter->GetOutput() );
        fieldWriter->Update();

"Note that the file format used for writing the deformation field must be
capable of representing
multiple components per pixel. This is the case for the MetaImage and VTK
file formats for
example."


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?




2009/7/22 Bill Lorensen <bill.lorensen at gmail.com>

> The source code he posted shows that he is trying to write the type:
> typedef itk::Image<VectorType, ImageDimension>
>                 DeformationFieldType;
> where VectorType is float.
>
> 2009/7/21 Ramón Casero Cañas <ramon.casero at comlab.ox.ac.uk>:
> > Bill Lorensen wrote:
> >>
> >> The thrown exception is very clear...
> >> Exception thrown
> >>
> >> itk::ExceptionObject (00CAE438)
> >> Location: "void __thiscall itk::PNGImageIO::WriteSlice(const class
> >> std::basic_string<char,struct std::char_traits<c
> >> har>,class std::allocator<char> > &,const void *)"
> >> File: ..\..\..\Code\IO\itkPNGImageIO.cxx
> >> Line: 473
> >> Description: PNG supports unsigned char and unsigned short
> >>
> >> You must choose an output file type that supports the type you are
> >> trying to write. I would suggest .mhd. If you can think of a better
> >> exception message, please let us know.
> >
> >
> > Hi Bill,
> >
> > Thaks for your reply. I don't think we have expressed any issues about
> the
> > exception itself, but motes said that he's defining the PixelType as
> > unsigned char/short, yet writing the data fails.
> >
> > Oh! Is this a problem with any of the intermediate steps changing the
> pixel
> > type?
> >
> > On a related note: Where is the method GetComponentType() called by
> > PNGImageIO::WriteSlice declared? I'm sure it's very obvious where it is,
> but
> > I have been searching for it in the ITK code (grep and [1]), and I
> couldn't
> > find it.
> >
> > [1] http://www.itk.org/Doxygen/html/functions.html
> >
> > Cheers,
> >
> > R.
> >
> > --
> > Ramón Casero Cañas, DPhil
> >
> > Computational Biology, Computing Laboratory
> > University of Oxford
> > Wolfson Building, Parks Rd
> > Oxford OX1 3QD
> >
> > tlf     +44 (0) 1865 610807
> > web     http://web.comlab.ox.ac.uk/people/Ramon.CaseroCanas
> > photos  http://www.flickr.com/photos/rcasero/
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090722/0c450fe7/attachment.htm>


More information about the Insight-users mailing list