[Insight-users] converting from vtkPoints to itkPointSet

Manuel Ricardo Galindo Moreno mrgalindo at puj.edu.co
Wed Jan 17 11:54:27 EST 2007


Hello,

Ive been trying to converting from vtkPoint to itkPointSet i order to use a pointset registration algorithm.

im using VC2003 and i get the 0xc000005 error code, besides i know that the problem is when i called itkPS->SetPoints(itkPContainer); 

im aware of the vtkFloatingPointType be defined as double. I had read the vtk2itkDouble.cxx and vtk2itk.cxx and using that type of coding still gets me error.

Here is my code (i know its not the same as vtk2itkDouble.cxx or vtk2itk.cxx)i think it should work. if i missed something i would appreciate that you can tell me.

itk::PointSet< double, 3 >::Pointer vtkPoints2itkPointSet(vtkPoints* vtkPS)
{
    typedef itk::PointSet< double, 3 > PointSetType; 
	PointSetType::Pointer itkPS;
	
	typedef PointSetType::PointType PointType;
	PointType itkP;

	typedef PointSetType::PointsContainer PointsContainer;
	PointsContainer::Pointer itkPContainer = PointsContainer::New();

	itkPContainer->Reserve(vtkPS->GetNumberOfPoints());

	unsigned int i;
	double* tmp;

    for(i=0;i<vtkPS->GetNumberOfPoints();i++)
	{
		tmp=vtkPS->GetPoint(i);
		
		itkP[0]=tmp[0];
		itkP[1]=tmp[1];
		itkP[2]=tmp[2];
		itkPContainer->InsertElement( i, itkP );	
		
	}

	itkPS->SetPoints(itkPContainer);

	return itkPS;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070117/c647df04/attachment.htm


More information about the Insight-users mailing list