[vtkusers] multiple isosurface?
Amy Henderson
amy.henderson at kitware.com
Tue Mar 11 10:42:04 EST 2003
Hi Radim,
To create multiple isosurfaces with a single instance of vtkMarchingCubes,
call the SetValue method of vtkMarchingCubes once per isosurface with the
value of that isosurface.
Please take a look at the documentation (in the header files or on-line VTK
documentation) for vtkMarchingCubes (or other classes you are trying to
use) before posting questions like this to the vtkusers list. You may be
able to answer such questions on your own, and people on the list are
generally more willing to help if they can see that you've tried to resolve
the issue yourself first.
- Amy
At 04:01 PM 3/11/2003 +0100, Radim Kolár wrote:
>thanks.
>I have another problem:) How to generate a multiple isosurface with
>Marching cubes in one render window?
>thanks radim
>----- Original Message -----
>From: <mailto:amy.henderson at kitware.com>Amy Henderson
>To: <mailto:kolarr at feec.vutbr.cz>Radim Koláø ;
><mailto:vtkusers at public.kitware.com>VTK
>Sent: Tuesday, March 11, 2003 3:15 PM
>Subject: Re: [vtkusers] rendering a sphere problem
>
>The main reason this won't work is that vtkSphereSource produces
>vtkPolyData output, not vtkImageData, so you can't volume render it in
>VTK. You should use a vtkPolyDataMapper and a vtkActor to render the
>output of vtkSphereSource instead.
>
>- Amy
>
>At 09:16 AM 3/11/2003 +0100, Radim Koláø wrote:
>>Hi all,
>>please could you help me with this simple problem?
>>I want to render the sphere with the vtkVolumeRayCastMapper. So I create
>>sphere, mapper, volume properties and finally vtkVolume and I render it
>>with vtkRenderWindowInteractor. But the program crash when I call
>>iren->Render(). Bellow is the short C++ code. Are there some mistakes?
>>I'm using VTK 4.0 and Borland C++ 6
>>Thanks a lot.
>>Radim
>>
>>//---------------------------------------------------------------------------
>>
>>#include "vtkSphereSource.h"
>>#include "vtkVolumeRayCastMapper.h"
>>#include "vtkActor.h"
>>#include "vtkRenderer.h"
>>#include "vtkRenderWindowInteractor.h"
>>#include "vtkRenderWindow.h"
>>#include "vtkVolumeRayCastMIPFunction.h"
>>#include "vtkImageData.h"
>>#include "vtkVolumeProperty.h"
>>#include "vtkPiecewiseFunction.h"
>>
>>#include <vcl.h>
>>#pragma hdrstop
>>//---------------------------------------------------------------------------
>>
>>
>>#pragma argsused
>>int main(int argc, char* argv[])
>>{
>> vtkSphereSource *sphere; sphere = vtkSphereSource::New();
>>
>> vtkVolumeRayCastMIPFunction *RayCastMethod =
>> vtkVolumeRayCastMIPFunction::New();
>> vtkVolumeRayCastMapper *mapper = vtkVolumeRayCastMapper::New();
>>
>> mapper->SetVolumeRayCastFunction( RayCastMethod );
>>
>> vtkImageData *vol; vol = vtkImageData::New();
>> vol->SetSource( sphere );
>> mapper->SetInput( vol );
>>
>> vtkColorTransferFunction *colorF = vtkColorTransferFunction::New();
>> colorF->AddRGBSegment( 0, 0.0, 0.0, 0.0, 255, 0.5, 0.1, 1.0 );
>>
>> //-------- Mapping from scalar -> opacity ------------
>> vtkPiecewiseFunction *opacityF = vtkPiecewiseFunction::New();
>> opacityF->AddPoint( 10, 0.1 );
>> opacityF->AddPoint( 200, 0.9 );
>> opacityF->ClampingOff();
>>
>>vtkVolumeProperty *volumeP = vtkVolumeProperty::New();
>> volumeP->SetColor( colorF );
>> volumeP->SetScalarOpacity( opacityF );
>>
>> vtkVolume *volume = vtkVolume::New();
>> volume->SetMapper( mapper );
>> volume->SetProperty( volumeP );
>>
>>vtkRenderer *ren1; ren1 = vtkRenderer::New();
>> ren1->AddProp( volume );
>>
>>vtkRenderWindow *renWin; renWin = vtkRenderWindow::New();
>> renWin->AddRenderer( ren1 );
>>
>>vtkRenderWindowInteractor *iren; iren = vtkRenderWindowInteractor::New();
>> iren->SetRenderWindow( renWin );
>>
>> iren->Render(); //here it crash
>> iren->Start();
>>
>> iren->Delete();
>> renWin->Delete();
>> ren1->Delete();
>> RayCastMethod->Delete();
>> volume->Delete();
>> vol->Delete();
>> mapper->Delete();
>> sphere->Delete();
>>
>> return 0;
>>}
>>//---------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030311/deffe130/attachment.htm>
More information about the vtkusers
mailing list