[Insight-users] ITK to VTK: MHD Vector Fields

Hari Sundar mudrarakshasha at yahoo.com
Wed Oct 19 11:40:49 EDT 2005


Hi,

I know this problem has been discussed earlier ... but the answers were
not helpful, and I am still having trouble.

I have a vector field, 3D float image with 3 components at each voxel.
I need to get it into VTK so that I can visualize this using glyphs.

This is what I do ...

const unsigned int ImageDimension = 3;
  typedef float PixelType;

  typedef itk::Image <PixelType, ImageDimension> ImageType; 
  typedef itk::Vector < float, ImageDimension > VectorType;
  typedef itk::Image <VectorType, ImageDimension >
DeformationFieldType;
  typedef itk::ImageFileReader < DeformationFieldType >
FieldReaderType;
  typedef itk::ImageToVTKImageFilter <DeformationFieldType >
ITK2VTKAdaptorFilterType;
  

  FieldReaderType::Pointer fieldReader = FieldReaderType::New (); 

  if (argc >= 1) {
	  fieldReader->SetFileName (argv[1]);
      try {
		  fieldReader->Update ();
      } catch (itk::ExceptionObject & excp) {
		  std::cerr << "Exception thrown " << std::endl;
		  std::cerr << excp << std::endl;
		  return EXIT_FAILURE;
      }
  }

  std::cout << "Finished reading file" << std::endl;
  ITK2VTKAdaptorFilterType *m_ITK2VTKAdaptor  =
ITK2VTKAdaptorFilterType::New();
  m_ITK2VTKAdaptor->SetInput( fieldReader->GetOutput() );
  m_ITK2VTKAdaptor->Update();
  
  std::cout << "Finished converting to VTK" << std::endl;
... Rest follows ...

I get a segmentation fault within ITK2VTKAdaptorFilterType::Update().

The mhd file I am testing with is correct, since I am able to load it
within paraview and visualize it.

what am I doing wrong here ?

thanks,
~Hari

bhogaa na bhuktaa vayameva bhuktaaH
tapo na tapta.n vayameva taptaaH |
kaalo na yaato vayameva yaataaH
tR^ishhNaa na jiirNaa vayameva jiirNaaH ||


		
__________________________________ 
Yahoo! Music Unlimited 
Access over 1 million songs. Try it free.
http://music.yahoo.com/unlimited/


More information about the Insight-users mailing list