<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
There is an example that does this. From the new vtk book -- page 181,
<br>PseudoVolumeRendering.tcl is the script.
<p> -- krs
<br>
<p>Martin Gardner wrote:
<blockquote TYPE=CITE>Hi,
<p>I want to generate lots of cut planes to slice up a volume of data.
I
<br>have got two cutplanes marking the start and end points of the slicing
<br>and I want to slice this region with N cutplanes where N is specified
at
<br>runtime.
<p>This would be similar to volume rendering with 2d texture mapping as
I
<br>want to generate and save images from the cutplanes.
<p>How do I dynamically set up the cutplanes their mappers and actors and
<br>then insert them into the pipeline? The snippet below is a first
<br>attempt at this but it doesn't work.
<p>Any Ideas that could set me on the right track would be welcomed.
<p>Cheers
<p>Martin
<br>---
<br>mglistmail@totalise.co.uk
<p><code>
<br>void vtkSurfDefWnd::ReDraw()
<br>{
<br> this->renderer->GetProps()->RemoveAllItems();
<br> this->renderer->AddActor(cutSurfaceAssembly);
<br> this->renderer->AddActor(outlineActor);
<br> this->renWin->Render();
<br>}
<p>void vtkSurfDefWnd::GenerateCutSurfaces(int num_surfs)
<br>{
<br> int i;
<p> float diff = m_pBack->GetOffset()
- m_pFront->GetOffset();
<p> float inc = diff / (float)
num_surfs;
<br> float start = 0.0f;
<br> float off = start;
<p> for(i=0;i<num_surfs;i++){
<br>
off += inc;
<br>
vtkActor *current = vtkActor::New();
<br>
vtkCutPlane *cut = vtkCutPlane::New();
<br>
vtkPolyDataMapper *cutMap = vtkPolyDataMapper::New();
<p>
cut->SetOrigin(m_pFront->GetOrigin());
<br>
cut->SetNormal(m_pFront->GetNormal());
<br>
cut->SetOffset(off);
<br>
cut->SetInput(pl3d->GetOutput());
<br>
cutMap->SetInput(cut->GetOutput());
<p>cutMap->SetScalarRange(pl3d->GetOutput()->GetPointData()->GetScalars()->GetRange());
<br>
current->SetMapper(cutMap);
<p>
cutSurfaceAssembly->AddPart(current);
<p>//
current->Delete();
<br>//
cut->Delete();
<br>//
cutMap->Delete();
<p> }
<br> ReDraw();
<br>}
<p></code>
<p>_______________________________________________
<br>This is the private VTK discussion list.
<br>Please keep messages on-topic. Check the FAQ at: <<a href="http://public.kitware.com/cgi-bin/vtkfaq">http://public.kitware.com/cgi-bin/vtkfaq</a>>
<br>Follow this link to subscribe/unsubscribe:
<br><a href="http://public.kitware.com/mailman/listinfo/vtkusers">http://public.kitware.com/mailman/listinfo/vtkusers</a></blockquote>
<pre>--
K.R.Subramanian Phone: (704) 687-4872
Department of Computer Science FAX: (704) 687-4893
UNC Charlotte, CARC 311 Email: krs@cs.uncc.edu
Charlotte, NC 28223-0001 Web: <A HREF="http://www.cs.uncc.edu/~krs">http://www.cs.uncc.edu/~krs</A></pre>
</html>