[vtkusers] Generating lots of cutplanes dynamically

K.R.Subramanian krs at cs.uncc.edu
Mon Mar 17 14:26:02 EST 2003


There is an example that does this. From the new vtk book -- page 181,
PseudoVolumeRendering.tcl is the script.

    -- krs


Martin Gardner wrote:

> Hi,
>
> I want to generate lots of cut planes to slice up a volume of data. I
> have got two cutplanes marking the start and end points of the slicing
> and I want to slice this region with N cutplanes where N is specified at
> runtime.
>
> This would be similar to volume rendering with 2d texture mapping as I
> want to generate and save images from the cutplanes.
>
> How do I dynamically set up the cutplanes their mappers and actors and
> then insert them into the pipeline?  The snippet below is a first
> attempt at this but it doesn't work.
>
> Any Ideas that could set me on the right track would be welcomed.
>
> Cheers
>
> Martin
> ---
> mglistmail at totalise.co.uk
>
> <code>
> void vtkSurfDefWnd::ReDraw()
> {
>         this->renderer->GetProps()->RemoveAllItems();
>         this->renderer->AddActor(cutSurfaceAssembly);
>         this->renderer->AddActor(outlineActor);
>         this->renWin->Render();
> }
>
> void vtkSurfDefWnd::GenerateCutSurfaces(int num_surfs)
> {
>         int i;
>
>         float diff = m_pBack->GetOffset() - m_pFront->GetOffset();
>
>         float inc = diff / (float) num_surfs;
>         float start = 0.0f;
>         float off = start;
>
>         for(i=0;i<num_surfs;i++){
>                 off += inc;
>                 vtkActor *current = vtkActor::New();
>                 vtkCutPlane *cut = vtkCutPlane::New();
>                 vtkPolyDataMapper *cutMap = vtkPolyDataMapper::New();
>
>                 cut->SetOrigin(m_pFront->GetOrigin());
>                 cut->SetNormal(m_pFront->GetNormal());
>                 cut->SetOffset(off);
>                 cut->SetInput(pl3d->GetOutput());
>                 cutMap->SetInput(cut->GetOutput());
>
> cutMap->SetScalarRange(pl3d->GetOutput()->GetPointData()->GetScalars()->GetRange());
>                 current->SetMapper(cutMap);
>
>                 cutSurfaceAssembly->AddPart(current);
>
> //              current->Delete();
> //              cut->Delete();
> //              cutMap->Delete();
>
>         }
>         ReDraw();
> }
>
> </code>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers

--
K.R.Subramanian                        Phone: (704) 687-4872
Department of Computer Science         FAX:   (704) 687-4893
UNC Charlotte, CARC 311                Email: krs at cs.uncc.edu
Charlotte, NC 28223-0001               Web: http://www.cs.uncc.edu/~krs


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030317/18a22447/attachment.htm>


More information about the vtkusers mailing list