<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:΢ÈíÑźÚ
}
--></style>
</head>
<body class='hmmessage'>
Hi, David<BR>Sorry, I can not comprehend the work mechanism of vtk. I modified my code as you mentioned in reply, but it doesn't work. <BR>My code is as fellows:<BR> <BR> vtkRenderer *aRenderer = vtkRenderer::New();<BR> vtkRenderWindow *renWin = vtkRenderWindow::New();<BR> renWin->AddRenderer(aRenderer);<BR> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<BR> iren->SetRenderWindow(renWin);<BR> <BR> vtkContourFilter *contours = vtkContourFilter::New();<BR> vtkPolyDataMapper *contmap = vtkPolyDataMapper::New();<BR> vtkActor *contact = vtkActor::New();<BR> <BR> vtkCamera *aCamera = vtkCamera::New();<BR> aCamera->ParallelProjectionOn();<BR> aRenderer->SetActiveCamera(aCamera);<BR> aRenderer->ResetCamera();<BR> aRenderer->SetBackground(0.725,0.725,1);<BR> renWin->SetSize(1024, 768);<BR> aRenderer->ResetCameraClippingRange ();<BR> iren->Initialize();<BR><BR>// loop <BR>for (int i=iFirstFrame; i<iNumFrames; i++)<BR>{<BR> ......<BR> interpolate bmpimage into volumeimage;<BR> ......<BR> volumeimage->update();<BR> contours->SetInput(volumeimage);<BR> contours->SetValue(0,gval);<BR> contmap->SetInput(contours->GetOutput());<BR> contmap->SetScalarRange(100,220);<BR> contact->SetMapper(contmap);<BR> aRenderer->AddActor(contact);<BR> aRenderer->Render();<BR> iren->Render();<BR>}<BR>iren->Start();<BR> <BR>thank you.<BR><BR> <BR>
> Date: Fri, 5 Nov 2010 07:48:09 -0400<BR>> From: daviddoria@gmail.com<BR>> To: luannauk@gmail.com<BR>> CC: vtkusers@vtk.org<BR>> Subject: Re: [vtkusers] vtk can render 3d image realtime?<BR>> <BR>> On Fri, Nov 5, 2010 at 6:33 AM, kuan luan <luannauk@gmail.com> wrote:<BR>> > Dear all,<BR>> > I am a vtk beginner. I am trying to reconstruct a 3d medical image from 2d<BR>> > images with spacial coordinates. I use vtk for reconstructing and surface<BR>> > rendering.<BR>> > now, I have a program for 3d reconstruction from 2d images offline.<BR>> > My method is<BR>> > acquire a new 2d image with spacial coordiante,<BR>> > interpolate it into 3d vtkimage.<BR>> > render the 3d vtkimage with new 2d image added,<BR>> > a new vtkRenderWindow is created.<BR>> > all procedure run in a while loop.<BR>> ><BR>> > But, I want to implement it in realtime.<BR>> > My problem is I can not render 3d reconstructed image with vtk in realtime.<BR>> > How can the 3d vtkimage be rendered again in the same vtkRenderWindow<BR>> > without creating a new one? Is this possible using VTK? If so please tell<BR>> > me how to do it.<BR>> ><BR>> > I'm using VTK5.4 and Microsoft Visual C++ 2008.<BR>> > Any advice is appreciated ;)<BR>> > Thank you in advance.<BR>> <BR>> Sure, just create the vtkRenderWindow and vtkRenderer outside (before)<BR>> the loop. Then inside the loop just add your new data to the renderer<BR>> and call Render() on the renderer and renderWindow.<BR>> <BR>> David<BR>> _______________________________________________<BR>> Powered by www.kitware.com<BR>> <BR>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<BR>> <BR>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ<BR>> <BR>> Follow this link to subscribe/unsubscribe:<BR>> http://www.vtk.org/mailman/listinfo/vtkusers<BR>                                            </body>
</html>