<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2716.2200" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial color=#800080 size=2><SPAN class=062281016-07022003>Dear
Lisa,</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#800080 size=2><SPAN class=062281016-07022003>I
tried to use mapper to realize clip. The following is the part of the code. It
is very strange that the rendering of the clipped mapper is only the cover. The
inside of the data is empty. I don't know why dose mapper only show the surface
of the data. And now the clipping is quite faster than before. How can I
show the solid clipped data?</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#800080 size=2><SPAN
class=062281016-07022003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#800080 size=2><SPAN
class=062281016-07022003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#800080 size=2><SPAN
class=062281016-07022003> Origin[0]=10.7;Origin[1]=10.3;Origin[2]=15.3;<BR> Normal[0]=0.6;Normal[1]=0.6;Normal[2]=0;<BR> CutPlane1=vtkPlane::New();<BR> CutPlane1->SetOrigin(Origin);<BR> CutPlane1->SetNormal(Normal);</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial color=#800080 size=2><SPAN
class=062281016-07022003> PlaneCo=vtkPlaneCollection::New();<BR> PlaneCo->AddItem(CutPlane1);</SPAN></FONT></DIV>
<DIV> </DIV><FONT face=Arial color=#800080 size=2><SPAN
class=062281016-07022003>
<DIV> DataMapper=vtkDataSetMapper::New();<BR> DataMapper->SetInput(importer->GetOutput());</DIV>
<DIV> DataMapper->SetClippingPlanes(PlaneCo);</DIV>
<DIV><BR> DataActor=vtkActor::New();<BR> DataActor->SetMapper(mapper);<BR></DIV></SPAN></FONT>
<DIV><FONT face=Arial color=#800080 size=2><SPAN
class=062281016-07022003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#800080 size=2><SPAN
class=062281016-07022003>Chunyan</SPAN></FONT></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Ursprüngliche Nachricht-----<BR><B>Von:</B> Kitware (Lisa Avila)
[mailto:kitware@kitware.com]<BR><B>Gesendet:</B> Freitag, 7. Februar 2003
16:17<BR><B>An:</B> Chunyan Jiang; kitware@kitware.com<BR><B>Betreff:</B> Re:
vtkClipVolume is slow<BR><BR></FONT></DIV>Hello,<BR><BR>You may be able to
achieve the same results faster by setting a clipping plane on the mapper of
the data. These are implemented in hardware in OpenGL. If you want to clip
parallel to the viewing plane then you can also set the clipping range (the
near plane and the far plane) of the camera.<BR><BR>You may wish to purchase a
VTK Professional Subscription which would provide support for questions such
as this with a 1 day response time. Without a support contract, the best place
to report VTK bugs / questions is on the VTK Users mailing list. More
information on this list can be found at:<BR><BR><FONT color=#0000ff><U><A
href="http://public.kitware.com/mailman/listinfo/vtkusers"
eudora="autourl">http://public.kitware.com/mailman/listinfo/vtkusers</A><BR><BR><BR></U></FONT>For
your information, the following VTK-related products and services are
available from Kitware, Inc:<BR><BR><B>The VTK User's Guide<BR></B>Everything
you need to install, use, and extend VTK. Detailed examples, installation
procedures, developers guide, file format descriptions, how to write imaging
and graphics filters, plus data object API details for VTK version 4.0.
Includes source code, updated HTML documentation, release notes, data, and PC
binaries. Users Guide is 378 pages, CD-ROM. $60 + shipping.
<BR><BR><B>ActiViz / COM<BR></B>A complete Microsoft COM interface to The
Visualization Toolkit. Using Visual Basic for Applications (VBA) and the
included render window controller, you can build compelling 3D documents with
Excel, Word, PowerPoint, Outlook, Explorer, and Visual Basic. $350 single user
license, $5000 distribution license.<BR><BR><B>Professional Subscription /
1-Year Support & Releases<BR></B>One year, single contact support for Unix
and PC systems, plus The <I>VTK Users Guide</I>, release notes, and a years
worth of software updates. Support is via e-mail and phone and includes
installation assistance, bug fixes, limited development support, and one
working day response time. If you or your small organization depend on VTK to
get your work done, this is the choice for you. $1,500.<BR><BR><B>Custom
Consulting Support<BR></B>The VTK Custom Consulting support provides you with
24 hours of consulting labor to use as you need it over the course of one
year. This contract may be used for example to have Kitware Inc. extend
existing VTK classes, develop new customized or higher-level classes, or to
improve and extend your proprietary VTK-based projects. $3,000.<FONT
face="Arial, Helvetica"> <BR><BR></FONT><B>Gold Site Support<BR></B>Gold site
support is designed for advanced sites which need the benefits of site license
support plus potential VTK customizations to meet the needs of their working
environment. Gold site support provides for any number of Unix and PC systems
and is priced based on an evaluation of the site and its projected
needs.<BR><BR><B>Consulting and Training<BR></B>Per hour and fixed-fee
consulting and VTK training. We will help you create your next imaging,
graphics, or visualization application, or teach you how to use VTK to build
your own. Courses can be held on-site, if desired. Work with the developers of
VTK to build high performance, professional VTK applications! Please call for
pricing and information.<BR><BR>For more information, visit the Kitware, Inc.
site at <A href="http://www.kitware.com/" eudora="autourl"><FONT
color=#0000ff><U>http</A></U></FONT>://<A href="http://www.kitware.com/"
eudora="autourl"><FONT color=#0000ff><U>www.kitware.com/</A></U></FONT> or
contact us at kitware@kitware.com.<BR><BR><BR>Sincerely,<BR><BR>Lisa S.
Avila<BR>Kitware, Inc.<BR>518-371-3971 x103<BR><BR>At 09:19 AM 2/7/2003,
Chunyan Jiang wrote:<BR>
<BLOCKQUOTE class=cite cite="" type="cite">Dear kitware,<BR>I use vtk to
render some data. Vtk is really good tool to do rendering. And<BR>I want to
use a plane to cut the data volume in order to observe the<BR>insight. By
moving the cut plane, I can fly-in and fly-out the volume. The<BR>following
is my example code. However, every time, when I change the<BR>parameter of
the cut plane, the Render() function runs very slow. How can I<BR>speed it
up? Or there are some other method to realize the fly-in, fly-out<BR>of the
data volume?<BR>I'm looking forward to getting your suggestion.<BR>Thank you
very
much!<BR><BR><BR>***************<BR><X-TAB> </X-TAB>vtkPlane
*CutPlane1;<BR><X-TAB> </X-TAB>vtkClipVolume
*clip;<BR><X-TAB> </X-TAB>vtkDataSetMapper
*DataMapper;<BR><X-TAB> </X-TAB>vtkActor
*DataActor;<BR><X-TAB> </X-TAB>vtkRenderer
*ren1;<BR><X-TAB> </X-TAB>vtkRenderWindow
*renWin;<BR><X-TAB> </X-TAB>vtkRenderWindowInteractor
*iren;<BR><BR><X-TAB> </X-TAB>float
Origin[3],Normal[3];<BR><BR>void
CMyVTK1View::OnClip()<BR>{<BR><X-TAB> </X-TAB>unsigned
short
*data;<BR><X-TAB> </X-TAB>int
dimensions[3];<BR><X-TAB> </X-TAB>int
i,j,k,s;<BR><BR><X-TAB> </X-TAB>dimensions[0]=150;<BR><X-TAB> </X-TAB>dimensions[1]=50;<BR><X-TAB> </X-TAB>dimensions[2]=50;<BR><BR><X-TAB> </X-TAB>data=new
unsigned
short[150*50*50];<BR><BR><X-TAB> </X-TAB>s=0;<BR><X-TAB> </X-TAB>for
(i = 0; i < dimensions[2]; i++)<BR>
{<BR><X-TAB> </X-TAB><X-TAB> </X-TAB>for
(j = 0; j < dimensions[1];
j++)<BR><X-TAB> </X-TAB><X-TAB> </X-TAB>{<BR><X-TAB> </X-TAB><X-TAB> </X-TAB>for
(k = 0; k < dimensions[0];
k++)<BR><X-TAB> </X-TAB><X-TAB> </X-TAB>
{<BR><X-TAB> </X-TAB><X-TAB> </X-TAB><X-TAB> </X-TAB>data[k
+ dimensions[0]*(j + dimensions[1]*i)] =
s;<BR><X-TAB> </X-TAB><X-TAB> </X-TAB><X-TAB> </X-TAB>s=s+5;<BR><X-TAB> </X-TAB><X-TAB> </X-TAB><X-TAB> </X-TAB>if(s>255)<BR><X-TAB> </X-TAB><X-TAB> </X-TAB><X-TAB> </X-TAB><X-TAB> </X-TAB>s=0;<BR><BR><X-TAB> </X-TAB><X-TAB> </X-TAB>
}<BR><X-TAB> </X-TAB><X-TAB> </X-TAB>}<BR>
}<BR><BR><BR><X-TAB> </X-TAB>vtkImageImport
*importer =
vtkImageImport::New();<BR><BR>importer->SetWholeExtent(0,dimensions[0]-1,0,dimensions[1]-1,0,dimensions[2]<BR>-1);<BR><X-TAB> </X-TAB>importer->SetDataExtentToWholeExtent();<BR><X-TAB> </X-TAB>importer->SetDataScalarTypeToUnsignedChar();<BR><BR><X-TAB> </X-TAB>importer->SetDataOrigin(3,3,3);<BR>
importer->SetDataSpacing(1.0,1.0,1.0);<BR><BR><BR><X-TAB> </X-TAB>importer->SetImportVoidPointer(data);<BR><BR><X-TAB> </X-TAB>Origin[0]=10.7;Origin[1]=10.3;Origin[2]=15.3;<BR><X-TAB> </X-TAB>Normal[0]=0.6;Normal[1]=0.6;Normal[2]=0;<BR><X-TAB> </X-TAB>CutPlane1=vtkPlane::New();<BR>
CutPlane1->SetOrigin(Origin);<BR>
CutPlane1->SetNormal(Normal);<BR><BR><BR><X-TAB> </X-TAB>clip=vtkClipVolume::New();<BR><X-TAB> </X-TAB>clip->SetInput(importer->GetOutput());<BR><X-TAB> </X-TAB>clip->SetClipFunction(CutPlane1);<BR><X-TAB> </X-TAB>clip->GenerateClipScalarsOff();<BR><BR><X-TAB> </X-TAB>DataMapper=vtkDataSetMapper::New();<BR><X-TAB> </X-TAB>DataMapper->SetInput(clip->GetOutput());<BR><BR><X-TAB> </X-TAB>DataActor=vtkActor::New();<BR><X-TAB> </X-TAB>DataActor->SetMapper(DataMapper);<BR><BR><X-TAB> </X-TAB>ren1=vtkRenderer::New();<BR><X-TAB> </X-TAB>renWin=vtkRenderWindow::New();<BR>
renWin->AddRenderer(ren1);<BR><BR><X-TAB> </X-TAB>renWin->SetParentId(m_hWnd);<BR><BR>
iren = vtkRenderWindowInteractor::New();<BR>
iren->SetRenderWindow(renWin);<BR><BR><X-TAB> </X-TAB>ren1->AddActor(DataActor);<BR><BR><X-TAB> </X-TAB>ren1->SetBackground(
0.1, 0.2,
0.4);<BR><X-TAB> </X-TAB>LPRECT
rect = new
CRect;<BR><X-TAB> </X-TAB>this->GetWindowRect(rect);<BR><X-TAB> </X-TAB>renWin->SetSize(rect->right-rect->left,rect->bottom-rect->top);<BR><BR><X-TAB> </X-TAB>//interact
with
data.<BR><X-TAB> </X-TAB>renWin->Render();<BR><BR><BR>}<BR><BR>void
CMyVTK1View::OnKeyDown(UINT nChar, UINT nRepCnt, UINT
nFlags)<BR>{<BR><X-TAB> </X-TAB>//
TODO: Add your message handler code here and/or call
default<BR><X-TAB> </X-TAB>switch
(nChar)
{<BR><X-TAB> </X-TAB>case
VK_UP:<BR><X-TAB> </X-TAB><X-TAB> </X-TAB>Origin[0]=Normal[0]*0.5+Origin[0];<BR><X-TAB> </X-TAB><X-TAB> </X-TAB>Origin[1]=Normal[1]*0.5+Origin[1];<BR><X-TAB> </X-TAB><X-TAB> </X-TAB>Origin[2]=Normal[2]*0.5+Origin[2];<BR><BR><X-TAB> </X-TAB><X-TAB> </X-TAB>CutPlane1->SetOrigin(Origin);<BR><BR><X-TAB> </X-TAB><X-TAB> </X-TAB>clip->SetClipFunction(CutPlane1);<BR><BR><BR><X-TAB> </X-TAB><X-TAB> </X-TAB>renWin->Render();<BR><X-TAB> </X-TAB><X-TAB> </X-TAB>break;<BR><X-TAB> </X-TAB>case
VK_DOWN:<BR><X-TAB> </X-TAB><X-TAB> </X-TAB>Origin[0]=Origin[0]-Normal[0]*0.5;<BR><X-TAB> </X-TAB><X-TAB> </X-TAB>Origin[1]=Origin[1]-Normal[1]*0.5;<BR><X-TAB> </X-TAB><X-TAB> </X-TAB>Origin[2]=Origin[2]-Normal[2]*0.5;<BR><BR><X-TAB> </X-TAB><X-TAB> </X-TAB>CutPlane1->SetOrigin(Origin);<BR><BR><X-TAB> </X-TAB><X-TAB> </X-TAB>clip->SetClipFunction(CutPlane1);<BR><BR><BR><X-TAB> </X-TAB><X-TAB> </X-TAB>renWin->Render();<BR><X-TAB> </X-TAB><X-TAB> </X-TAB>break;<BR><BR><X-TAB> </X-TAB>default:<BR><BR><X-TAB> </X-TAB><X-TAB> </X-TAB>break;<BR><X-TAB> </X-TAB>}<BR><X-TAB> </X-TAB>CView::OnKeyDown(nChar,
nRepCnt,
nFlags);<BR>}<BR><BR><BR><BR>Chunyan<BR>***********************************************************************<BR>Chunyan
Jiang, Dipl.-Inform.,<BR>Institut for Telematic<BR>Bahnhofstrasse 30-32,
D-54292 Trier, Germany<BR>Phone: (+49) (0)651-97551-34<BR>Fax: (+49)
(0)651-97551-12<BR>***********************************************************************</BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>