[vtkusers] i need your help, about surface cuts image
guoyanmin
jacob_1224 at hotmail.com
Mon Aug 4 07:44:34 EDT 2008
Hallo everyone,
i need your help,
I make now one combination
between one Surface and one Image, that means i want to add one surface into the image and cut off this area from the image to store, this area is overlain between surface and image.
Ich write so that:
vtkLinearTransform
*transform =
surface->GetTimeSlicedGeometry()->GetGeometry3D(0)->GetVtkTransform();
vtkPolyData * polydata =
surface->GetVtkPolyData(0);
vtkTransformPolyDataFilter
* transformFilter=vtkTransformPolyDataFilter::New();
transformFilter->SetInput(polydata);
transformFilter->SetTransform(transform);
transformFilter->Update();
vtkPolyDataToImageStencil *
dataToStencil = vtkPolyDataToImageStencil::New();
dataToStencil->SetInput(
transformFilter->GetOutput());
vtkImageStencil * stencil =
vtkImageStencil::New();
stencil->SetStencil(dataToStencil->GetOutput());
stencil->SetBackgroundValue(
0 );
stencil->ReverseStencilOff();
vtkImageData *vtkimage =
image->GetVtkImageData();
stencil->SetInput(
vtkimage );
stencil->Update();
vtkimage =
stencil->GetOutput();
mitk::Image::Pointer
m_img;
m_img =
mitk::Image::New();
m_img->Initialize(vtkimage);
m_img->SetVolume(
vtkimage->GetScalarPointer() );
I can get one cut part of image(m_img), and i can store it in the computer, but if i load this image,it appears not in the right position in the original image. it appears only in the position, where i load the surface.
somebody knows ? please me some idea. i want to show this cut image in the right position.
Guo,Yanmin
Darmstadt Deutschland
Phone(handy):0179-4820889
_________________________________________________________________
用手机MSN聊天写邮件看空间,无限沟通,分享精彩!
http://mobile.msn.com.cn/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080804/47200969/attachment.htm>
More information about the vtkusers
mailing list