[vtkusers]ask about vtkIterativeClosestPointTransform
John Doe
vtkuser at yahoo.com
Thu Sep 13 13:54:30 EDT 2007
i want to do 2d medical image registration on two images and i think i can use vtkIterativeClosestPointTransform to find the correspondence point between the two images. the first question is can i use the images as input? because i read that the input must be vtkPolyData type.
i have tried it but still fail to get the right result..
please help me..
this is part of my code(still wrong)
//
vtkRenderer *aRenderer = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
renWin->AddRenderer(aRenderer);
iren->SetRenderWindow(renWin);
vtkDICOMImageReader *source=vtkDICOMImageReader::New();
source->SetFileName("source.dcm");
source->Update();
vtkDICOMImageReader *target=vtkDICOMImageReader ::New();
target->SetFileName("target.dcm");
target->Update();
vtkIterativeClosestPointTransform*icp=vtkIterativeClosestPointTransform::New();
icp->SetSource(source->GetOutput());
icp->SetTarget(target->GetOutput());
/////////dont understand these parts!! i just copied it from the references i found
icp->SetCheckMeanDistance(1);
icp->SetMaximumMeanDistance(0.01);
icp->SetMaximumNumberOfIterations(30);
icp->SetMaximumNumberOfLandmarks(50);
icp->GetLandmarkTransform()->SetModeToRigidBody();
icp->CheckMeanDistanceOn();
icp->StartByMatchingCentroidsOn();
icp->Update();
/////////////////////////////////
vtkTransformPolyDataFilter *filter=vtkTransformPolyDataFilter::New();
filter->SetTransform(icp);
filter->SetInput(source->GetOutput());
vtkPolyDataMapper *map=vtkPolyDataMapper::New();
map->SetInput(filter->GetOutput());
vtkActor *actor=vtkActor::New();
actor->SetMapper(map);
aRenderer->AddActor(actor);
renWin->Render();
iren->Start();
//
thanx a lot =)
Regards, John.
---------------------------------
Check out the hottest 2008 models today at Yahoo! Autos.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070913/60d6e905/attachment.htm>
More information about the vtkusers
mailing list