[Insight-developers] MetaImageWriter pixel type limitation

David Doria daviddoria at gmail.com
Sun Nov 7 19:23:04 EST 2010


It seems I can write (using itkImageFileWriter) a:
itk::Image<itk::CovariantVector<double, 7>, 2>

but not a:
itk::Image<itk::CovariantVector<double, 8>, 2>

I get a "MetaImageIO: Pixel type currently not supported. typeid.name
= N3itk15CovariantVectorIdLj8EEE" error.

I looked around and found in itkImageIOBase.cxx that the Vector and
CovariantVector pixel types are manually checked to be between length
2 and 7. I'm assuming this was arbitrarily chosen because of the way
the pixel types are checked:

...
  else if ( ptype == typeid( Vector< T, 5 > ) )
    {
    This->SetNumberOfComponents(5);
    This->SetPixelType(ImageIOBase::VECTOR);
    This->SetComponentType(ntype);
    return true;
    }
...

Is there a way to do something more like "check the length of the
vector, then set the number of components to the length" so we can
allow images with arbitrary length vector pixels to be written?

It seems hacky (and I don't know if this varies machine to machine or
build to build), but could you extract the length from the mangled
name:

N3itk15CovariantVectorIdLj8EEE -> length 8 ?

David


More information about the Insight-developers mailing list