hi,Ivo and another, i tried, but it is not worked.
mitk::SurfaceToImageFilter * transformFilter
=mitk::SurfaceToImageFilter::New() ;
line 1:transformFilter->SetInput(surface);
line 2: transformFilter->SetImage(img);
transformFilter->Update();
m_img->Initialize(img->GetPixelType(),
*surface->GetTimeSlicedGeometry()->GetGeometry3D(0));
m_img->Initialize(transformFilter->GetImage());
m_img->Modified();
m_img->Update();
here the surface and the img, i got them from DataTreeNode,and this m_img is
the new cut image.
img = dynamic_cast<mitk::Image*>( node->GetData());
surface = dynamic_cast<mitk::Surface*>( node->GetData() );
there is always the error,
error:Run-Time Check Failure #0 - The value of ESP was not properly saved
across a function call. This is usually a result of calling a function
declared with one calling convention with a function pointer declared with a
different calling convention.
or error :Access violation writing location 0x003a003a.(to the line 1 and line
2)
anybody can tell me some ideas?
thank you
best regards
> Date: Wed, 6 Aug 2008 13:21:10 +0200
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> CC: [email protected]
> Subject: Re: [mitk-users] problem about the surface and image
>
> The resulting image has the same size as the input image. Thus, if
> surface is (partially) outside the input image, it will also be
> (partially) outside the output image. The reason that you need to
> provide an input image at all, is that we must somehow to determine the
> pixeltype, dimension, spacing the output image shall have - the easiest
> way to do that was just to provide an input image as example... This
> input image needs to be initialized, but does not need to contain a data
> vector.
>
> To create an image of the same size as the surface, use the following
> Initialize() variant of mitk::Image:
> http://www.mitk.org/documentation/doxygen/classmitk_1_1Image.html#a20
> mitk::Image::Pointer image = mitk::Image::New();
> image->Initialize(PixelType(unsigned char), *surface->GetGeometry3D());
>
> This image will have unit spacing. You can change this by image->SetSpacing.
>
> Now it should be possible to use it with mitk::SurfaceToImageFilter.
>
> Best regards,
>
> Ivo
>
> guoyanmin wrote:
> > one question also, if i use mitk::SurfaceToImageFilter, i need not to
> > think about the different coordinate systems between surface and
> > image, i need only image and surface as input to this filter?
> >
> > best regards
> >
> >
> >
> > > Date: Wed, 6 Aug 2008 13:00:46 +0200
> > > From: [EMAIL PROTECTED]
> > > To: [EMAIL PROTECTED]
> > > CC: [email protected]
> > > Subject: Re: [mitk-users] problem about the surface and image
> > >
> > > 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(); *
> > > > transfor! mFilter->SetInput(polydata);
> > > >
> > > > tran! sformFil ter->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(vtki! mage);*
> > > >
> > > > * 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] forge.net
> > > >
> > > > *
> > > >
> > > >! ; *Hi Ja cob,*
> > > >
> > > > *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 s! urface t o 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.
> > >
> >
> > ------------------------------------------------------------------------
> > 使用新一代 Windows Live Messenger 轻松交流和共享! 立即体验!
> > <http://messenger.live.cn/>
>
>
> --
> ----------------------------------------------------------------------
> 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.
>
_________________________________________________________________
用手机MSN聊天写邮件看空间,无限沟通,分享精彩!
http://mobile.msn.com.cn/
-------------------------------------------------------------------------
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