Unsuccessful with vtkClipVoume

Marcela HERNANDEZ marcela.hernandez at creatis.insa-lyon.fr
Thu Jan 27 12:21:34 EST 2000


*** To extract an arbitrary cutting plane from a volume, you can use vtkPlane.  I
show you the tcl code :

vtkPlane plane
     plane SetOrigin $xO $yO $zO
     plane SetNormal $xN $yN $zN

 vtkCutter planeCut
     planeCut SetInput [reader GetOutput]
     planeCut SetCutFunction plane

  vtkPolyDataMapper cutMapper
    cutMapper SetInput [planeCut GetOutput]
    cutMapper SetScalarRange $range
    cutMapper ImmediateModeRenderingOn

  vtkActor cutActor
    cutActor SetMapper cutMapper

  ren1 AddActor cutActor

*** And if you want intersect the plane with a sphere for example:

 vtkSphere sphere
    sphere SetRadius $r
    sphere SetCenter $xO $yO $zO

  vtkCutter sphCut
    sphCut SetInput [planeCut GetOutput]
    sphCut SetCutFunction sphereT

  vtkDataSetMapper sphcutMapper
    sphcutMapper SetInput [sphCut GetOutput]
    sphcutMapper ScalarVisibilityOff
    sphcutMapper ImmediateModeRenderingOn

  vtkActor sphcutActor
    sphcutActor SetMapper sphcutMapper

 ren1 AddActor sphcutActor


Prashanth Kini-P a écrit :

> I am trying to extract and visualize an arbitrarily oriented and/or
> nonrectangular shaped chunk of a volume (vtkExtractVOI and vtkExtractGrid appear
> to be suitable for only extracting axes-aligned sub VOIs).  My ultimate goal is
> an interactive procedure where the user moves a 3D shape to intersect with the
> volume and the intersection is returned.  I plan to implement thois as follows:
> 1. create surface by sampling implicit functions and isosurfacing it
> 2. obtain the transformation after the user has placed the actor
> 3. apply the transformation to the implicit function
> 4. and then hopefully use vtkClipVolume as below.
>
> The code below is my attempt to clip a volume using an implicit sphere. I am
> assuming that I need to resample the clipped unstructured grid onto structured
> points in order to visualize (volume render) it. I tried to use vtkProbeFilter
> to do that. In the end I get the following run-time error and segmentation
> fault:
>
> ERROR in vtkVolume.cxx, line 553
> vtkVolume(0x104b4718): Need Scalar data to volume render
>
> Where am I losing my scalars? Am I doing this right? Thanks in advance!!
>
> Prashanth Kini
> Procter & Gamble
>
> ******code excerpt*********
>
>      vtkImageReader *reader = vtkImageReader::New();
>      .........[set up the reader to read the volume]....
>
>      vtkSphere *sphere = vtkSphere::New();
>        sphere->SetRadius(maxrange/4);
>        sphere->SetCenter(xcent,ycent,zcent);
>
> //*******vtkClipVolume approach********************
>      vtkClipVolume *clip = vtkClipVolume::New();
>        clip->SetInput(reader->GetOutput());
>        clip->SetClipFunction(sphere);
>        clip->GenerateClippedOutputOn();
>        clip->GenerateClipScalarsOn();
>
>      vtkStructuredPoints *clipvolume = vtkStructuredPoints::New();
>        clipvolume->SetDimensions(xsize,ysize,zsize);          //same settings as
> used in vtkImageReader
>        clipvolume->SetSpacing(xscale,yscale,zscale);
>        clipvolume->SetOrigin(0.0,0.0,0.0);
>
>      vtkProbeFilter *probe = vtkProbeFilter::New();
>        probe->SetInput(clipvolume);
>        probe->SetSource(clip->GetClippedOutput());
>
>      vtkVolumeRayCastMapper *sphvolumemapper = vtkVolumeRayCastMapper::New();
>        sphvolumemapper->SetScalarInput(clipvolume);
>        sphvolumemapper->SetVolumeRayCastFunction(compositefunction);
>
>      vtkVolume *spherevolume = vtkVolume::New();
>        spherevolume->SetVolumeMapper(sphvolumemapper);
>        spherevolume->SetVolumeProperty(volumeproperty);
>
>      renderer->AddVolume(spherevolume);
>
> -----------------------------------------------------------------------------
> This is the private VTK discussion list.  Please keep messages on-topic.
> Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
> To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
> <majordomo at gsao.med.ge.com>.  For help, send message body containing
> "info vtkusers" to the same address.     Live long and prosper.
> -----------------------------------------------------------------------------

--
Marcela Hernandez Hoyos
Doctorat Genie Biologique et Medical
CREATIS, INSA Bat 502
69621 Villeurbanne Cedex (France)
Phone  : +33 (0)4 72 43 83 83. Poste 5359
Fax    : +33 (0)4 72 43 85 26
CREATIS WWW home page : http://www.creatis.insa-lyon.fr




-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------




More information about the vtkusers mailing list