[vtkusers] Strange problem! AW: vtkClipVolume is slow
Chunyan Jiang
jiang at Telematik-Institut.de
Fri Feb 7 11:17:24 EST 2003
Dear Lisa,
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?
Origin[0]=10.7;Origin[1]=10.3;Origin[2]=15.3;
Normal[0]=0.6;Normal[1]=0.6;Normal[2]=0;
CutPlane1=vtkPlane::New();
CutPlane1->SetOrigin(Origin);
CutPlane1->SetNormal(Normal);
PlaneCo=vtkPlaneCollection::New();
PlaneCo->AddItem(CutPlane1);
DataMapper=vtkDataSetMapper::New();
DataMapper->SetInput(importer->GetOutput());
DataMapper->SetClippingPlanes(PlaneCo);
DataActor=vtkActor::New();
DataActor->SetMapper(mapper);
Chunyan
-----Ursprungliche Nachricht-----
Von: Kitware (Lisa Avila) [mailto:kitware at kitware.com]
Gesendet: Freitag, 7. Februar 2003 16:17
An: Chunyan Jiang; kitware at kitware.com
Betreff: Re: vtkClipVolume is slow
Hello,
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.
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:
http://public.kitware.com/mailman/listinfo/vtkusers
For your information, the following VTK-related products and services are
available from Kitware, Inc:
The VTK User's Guide
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.
ActiViz / COM
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.
Professional Subscription / 1-Year Support & Releases
One year, single contact support for Unix and PC systems, plus The VTK
Users Guide, 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.
Custom Consulting Support
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.
Gold Site Support
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.
Consulting and Training
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.
For more information, visit the Kitware, Inc. site at
http://www.kitware.com/ or contact us at kitware at kitware.com.
Sincerely,
Lisa S. Avila
Kitware, Inc.
518-371-3971 x103
At 09:19 AM 2/7/2003, Chunyan Jiang wrote:
Dear kitware,
I use vtk to render some data. Vtk is really good tool to do rendering.
And
I want to use a plane to cut the data volume in order to observe the
insight. By moving the cut plane, I can fly-in and fly-out the volume.
The
following is my example code. However, every time, when I change the
parameter of the cut plane, the Render() function runs very slow. How
can I
speed it up? Or there are some other method to realize the fly-in,
fly-out
of the data volume?
I'm looking forward to getting your suggestion.
Thank you very much!
***************
vtkPlane *CutPlane1;
vtkClipVolume *clip;
vtkDataSetMapper *DataMapper;
vtkActor *DataActor;
vtkRenderer *ren1;
vtkRenderWindow *renWin;
vtkRenderWindowInteractor *iren;
float Origin[3],Normal[3];
void CMyVTK1View::OnClip()
{
unsigned short *data;
int dimensions[3];
int i,j,k,s;
dimensions[0]=150;
dimensions[1]=50;
dimensions[2]=50;
data=new unsigned short[150*50*50];
s=0;
for (i = 0; i < dimensions[2]; i++)
{
for (j = 0; j < dimensions[1]; j++)
{
for (k = 0; k < dimensions[0]; k++)
{
data[k + dimensions[0]*(j + dimensions[1]*i)] =
s;
s=s+5;
if(s>255)
s=0;
}
}
}
vtkImageImport *importer = vtkImageImport::New();
importer->SetWholeExtent(0,dimensions[0]-1,0,dimensions[1]-1,0,dimensions[2]
-1);
importer->SetDataExtentToWholeExtent();
importer->SetDataScalarTypeToUnsignedChar();
importer->SetDataOrigin(3,3,3);
importer->SetDataSpacing(1.0,1.0,1.0);
importer->SetImportVoidPointer(data);
Origin[0]=10.7;Origin[1]=10.3;Origin[2]=15.3;
Normal[0]=0.6;Normal[1]=0.6;Normal[2]=0;
CutPlane1=vtkPlane::New();
CutPlane1->SetOrigin(Origin);
CutPlane1->SetNormal(Normal);
clip=vtkClipVolume::New();
clip->SetInput(importer->GetOutput());
clip->SetClipFunction(CutPlane1);
clip->GenerateClipScalarsOff();
DataMapper=vtkDataSetMapper::New();
DataMapper->SetInput(clip->GetOutput());
DataActor=vtkActor::New();
DataActor->SetMapper(DataMapper);
ren1=vtkRenderer::New();
renWin=vtkRenderWindow::New();
renWin->AddRenderer(ren1);
renWin->SetParentId(m_hWnd);
iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
ren1->AddActor(DataActor);
ren1->SetBackground( 0.1, 0.2, 0.4);
LPRECT rect = new CRect;
this->GetWindowRect(rect);
renWin->SetSize(rect->right-rect->left,rect->bottom-rect->top);
//interact with data.
renWin->Render();
}
void CMyVTK1View::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
switch (nChar) {
case VK_UP:
Origin[0]=Normal[0]*0.5+Origin[0];
Origin[1]=Normal[1]*0.5+Origin[1];
Origin[2]=Normal[2]*0.5+Origin[2];
CutPlane1->SetOrigin(Origin);
clip->SetClipFunction(CutPlane1);
renWin->Render();
break;
case VK_DOWN:
Origin[0]=Origin[0]-Normal[0]*0.5;
Origin[1]=Origin[1]-Normal[1]*0.5;
Origin[2]=Origin[2]-Normal[2]*0.5;
CutPlane1->SetOrigin(Origin);
clip->SetClipFunction(CutPlane1);
renWin->Render();
break;
default:
break;
}
CView::OnKeyDown(nChar, nRepCnt, nFlags);
}
Chunyan
***********************************************************************
Chunyan Jiang, Dipl.-Inform.,
Institut for Telematic
Bahnhofstrasse 30-32, D-54292 Trier, Germany
Phone: (+49) (0)651-97551-34
Fax: (+49) (0)651-97551-12
***********************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030207/1b4137b3/attachment.htm>
More information about the vtkusers
mailing list