[Insight-users] reading a vtk image

Will Schroeder will.schroeder@kitware.com
Thu, 11 Apr 2002 07:14:32 -0400


Hi Pieter-

I am going to try and patch the beta release today. Before I do that, could 
you send me a small file that demonstrates the problem. I'd like to make 
sure that the changes work for your data set.

Will


At 09:42 AM 4/11/2002 +0200, Pieter Vos wrote:
>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
>
>_______________________________________________
>Insight-users mailing list
>Insight-users@public.kitware.com
>http://public.kitware.com/mailman/listinfo/insight-users