[vtkusers] how to crop imagedata after a registration?
yehe_008
yehe_008 at 163.com
Wed Apr 24 05:34:45 EDT 2013
Hello,
I'm making a registration between 3D MRI and 3D US data. The size of US data is much bigger than MRI.
I take some landmarks on both images.
Then I use "vtkLandmarkTransform" to get a transform between these landmark points.
At last I apply the transform to MRI data by using "vtkImageReslice".
So I get a huge size MRI data. How can I crop the data to make the new MRI data have same size and almost same content as US data?
Please give me some tips. Thank you for your attention :)
Here's my code
vtkSmartPointer<vtkPoints> sourcePoints = vtkSmartPointer<vtkPoints>::New();//Input source points
for ( int t = 0; t < 6; t++ )
{
float sourcePoint[3] = {inital_points_mri[t][0], inital_points_mri[t][1], inital_points_mri[t][2]};
sourcePoints->InsertNextPoint(sourcePoint);
}
vtkSmartPointer<vtkPoints> targetPoints = vtkSmartPointer<vtkPoints>::New();//Input target points
for ( int t = 0; t < 6; t++ )
{
float targetPoint[3] = {inital_points_us[t][0], inital_points_us[t][1], inital_points_us[t][2]};
targetPoints->InsertNextPoint(targetPoint);
}
vtkSmartPointer<vtkLandmarkTransform> landmarkTransform = vtkSmartPointer<vtkLandmarkTransform>::New();//get landmark transform
landmarkTransform->SetSourceLandmarks(sourcePoints);
landmarkTransform->SetTargetLandmarks(targetPoints);
landmarkTransform->SetModeToSimilarity ();
landmarkTransform->Update();
vtkSmartPointer<vtkImageReslice> transform2 = vtkSmartPointer<vtkImageReslice>::New(); // Apply transform
transform2->SetInput(MRIimagedata); // Input MRI image
transform2->AutoCropOutputOn(); // I'm not sure I need it or not?
// transform2->SetOutputExtent(0,499,0,389,0,358); // set the extent as US data, but not the same content
landmarkTransform->Inverse();
transform2->SetResliceTransform(landmarkTransform);
transform2->Update();
vtkImageData* transformImage = transform2->GetOutput();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130424/c10bfe35/attachment.htm>
More information about the vtkusers
mailing list