[Insight-users] reading a vtk image
Pieter Vos
pieterv@radiology.azn.nl
Thu, 11 Apr 2002 09:42:50 +0200 (CEST)
Hi,
It seems that when a vtk image is read by itkImageFileReader with IO
itkVTKImageIO, the function
void::VTKImageIO::ReadImageInformation() (Implemented in
itk::MetaImageIO) doesn't do it's work
correctly, the function should set the number of dimension to 3 but it
stays to 2, when a vtk file is being read. I looked into the code of void
MetaImageIO::ReadImageInformation(). In this function a string
compare is
done with a line of the vtk file. However, none of them matches since it
looks for a meta image header(for example:strcmp(key,"NDims")==0). So the
function goes to codelinenumber 00520:
00519 // Unknown code, get the rest of the line
00520 m_Ifstream.getline( restOfTheLine, maxLineLength );
So, the number of dimensions stays at 2, while it should have been set to
3. After this the function
template <class TOutputImage, class ConvertPixelTraits> void
ImageFileReader<TOutputImage, ConvertPixelTraits>::GenerateData()
gives an exception since it does the check
if( m_ImageIO->GetNumberOfDimensions() < TOutputImage::ImageDimension )
which fails.
The problem can be diverted by first writing a 3D vtk file and then
reading the vtk file.
My question is:
Is there a better solution, or will there be a fix?
Thanks for the time.
--
Pieter Vos
AZN Radboud
The Netherlands
mailto:pieterv@radiology.azn.nl