[Insight-users] Read a .VTK vector image?

Brian Eastwood beastwoo at email.unc.edu
Tue Jul 27 13:20:13 EDT 2004


Hi there,

I was wondering if ITK can read ".vtk" vector images.  I've used ITK to 
write a .vtk image containing vectors at each pixel location.  But, when 
I try to read this image my program crashes with a Microsoft error 
report dialog (like something illegal happened, but no exception was 
thrown).  What is the right way to read such an image.  My code is:

        typedef itk::Vector<float, 2> VectorType;
        typedef itk::Image<VectorType, 2> ImageType;
        typedef itk::ImageFileReader<ImageType> ReaderType;

        ReaderType::Pointer reader = ReaderType::New();

        std::string inFile = "VectorField.vtk";
        reader->SetFileName(inFile.c_str());
        reader->Update();

Incidently, I can use the same code to read a .mha file, but if I try to 
write my vector data to a .mha file the data is not correct--vectors are 
rescaled and pointed in odd directions.  I'm working from a CVS build, 
updated today.

Thanks,
Brian

-- 
________________________________________
                      < brian eastwood >



More information about the Insight-users mailing list