Hi,
your code snippet looks like you want to convert a surface to an image,
is this correct? MITK has a filter for that purpose - which does more or
less the same as you do, i.e., using vtk stenciling:
mitk::SurfaceToImageFilter. If you tried it and it did not work as you
expected, please tell us ...
For more information, see
http://www.mitk.org/documentation/doxygen/classmitk_1_1SurfaceToImageFilter.html
Best regards,
Ivo

guoyanmin wrote:
> thank you so much for your quickly answer,but i have used the
> transformfilter from the index coordinates system to the world
> coordinate system, i have writed
>
> TimeSlicedGeometry *surfaceTimeGeometry =
> surface->GetTimeSlicedGeometry();
>
> TimeSlicedGeometry *imageTimeGeometry = img->GetTimeSlicedGeometry();
>
> Geometry3D* imageGeometry = imageTimeGeometry->GetGeometry3D(0);
>
> vtkPolyData * polydata = surface->GetVtkPolyData( );
>
> Geometry3D* surfacegeometry = surfaceTimeGeometry->GetGeometry3D(0);
>
> vtkLinearTransform *transform = surfacegeometry->GetVtkTransform();
>
> 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->Initialize(vtkimage);*
>
> * m_img->SetVolume( vtkimage->GetScalarPointer() );*
>
> *
> *
>
> *and this m_img is the new cut image, what i want.but it shows not in
> the right position. can you give me some ideas.*
>
> *
> *
>
> *
> *
>
> *& nbsp;
> *
>
> * *
>
> *
> *
>
> **
>
> * *
>
> *
> *
>
> *
>
> *
> ------------------------------------------------------------------------
> *Subject: AW: [mitk-users] problem about the surface and image
> Date: Wed, 6 Aug 2008 12:04:50 +0200
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]; [email protected]
>
> *
>
> *Hi Jacob,*
>
> *did you possible use the coordinates of the surface to cut the image
> and not the world coordinates of the surface?*
>
> * *
>
> *You will have to transform the surface coordinates (this way the
> transform to the center is also considered) to world coordinates and
> then to the coordinate space of the image to get the right positions.*
>
> * *
>
> *Regards,*
>
> *Ingmar*
>
> * *
>
> *Dipl.-Inform. Med. Ingmar Wegner
> DKFZ
> German Cancer Research Center (Deutsches Krebsforschungszentrum)
> Member of the Helmholtz Association
> Division Medical and Biological Informatics E130
> Im Neuenheimer Feld 280
> D-69120 Heidelberg*
>
> *Phone: 49-(0)6221-42-3543
> Fax: 49-(0)6221-42-2345
> E-Mail: [EMAIL PROTECTED]
> Web: www.dkfz.de*
>
> * *
>
> *Confidentiality Note: This message is intended only for the use of
> the named recipient(s) and may obtain confidential and/or privileged
> information. If you are not the intended recipient, please contact the
> sender and delete the message. Any unauthorized use of the information
> contained in this message is prohibited. *
>
> * *
>
> **Von:* [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] *Im Auftrag von
> *guoyanmin
> *Gesendet:* Mittwoch, 6. August 2008 11:36
> *An:* [email protected]
> *Betreff:* [mitk-users] problem about the surface and image*
>
> * *
>
> *hallo everyone, i have one question long times.
> now i want to use the surface to cut one image, i load the surface and
> image, for example this surface stay upper-left of image, i move this
> surface to the center of image, and cut this image, but this part of
> cut image is showed only upper-left position, that means, only in the
> position, where i load the surface.
> anybody can tell me, how i can put this cut image in the center of
> image, but not in the upper-left position.
>
> best regards
>
> *
>
> ------------------------------------------------------------------------
>
> *使用新一代** Windows Live Messenger **轻松交流和共享!** **立即体验!
> <http://messenger.live.cn/>*
>
> *
> *
> ------------------------------------------------------------------------
> *用 Windows Live Spaces 展示个性自我,与好友分享生活! 了解更多信息!
> <http://spaces.live.com/?page=HP>*
> *
> *
> ------------------------------------------------------------------------
> *
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/*
> *
> *
> ------------------------------------------------------------------------
> *
> _______________________________________________
> mitk-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mitk-users
> *


-- 
----------------------------------------------------------------------
Dr. Ivo Wolf, Dipl.-Phys. Phone: (+49) 6221/42-2327
Deutsches Krebsforschungszentrum Fax: (+49) 6221/42-2345
Div. Medical and Biological Informatics (E130)
Im Neuenheimer Feld 280 email: [EMAIL PROTECTED]
D-69120 Heidelberg, Germany http://mbi.dkfz-heidelberg.de
----------------------------------------------------------------------
Confidentiality Note: This message is intended only for the use of the
named
recipient(s) and may obtain confidential and/or privileged information.
If you
are not the intended recipient, please contact the sender and delete the
message.
Any unauthorized use of the information contained in this message is
prohibited.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to