[vtkusers] Problem displaying actors when volume is being renderer

abhishek gattani abhishekg4u at gmail.com
Tue Aug 16 17:38:49 EDT 2005


Hello Lisa, 

Thank you so much for finally replying to my post :)

You are right about the cone being too small. However, my real goal is to be 
able to move the cone inside the volume? In that case as you mention my cone 
won't be visible. What are my options if I want to move a cone, or any other 
object inside the volume? I am trying to highlight a point in 3D space which 
would change dynamically based on user-interaction and this point will most 
likely lie within the 3D volume I render. Any suggestions or workarounds 
that can help achieve this, will be deeply appreciated. Thanks,

Cheers, Abhi

On 8/16/05, Lisa Avila <lisa.avila at kitware.com> wrote:
> 
> 
> Hello Abhi,
> 
> Are you sure your cone is not just 1) inside the volume and therefore not
> visible or 2) so small in relation to the volume that you do not see it?
> I'd vote for option two - your cone is only 3 units high - which is only
> about the size of 1 voxel....
> 
> Lisa
> 
> At 02:09 PM 8/16/2005, abhishek gattani wrote:
> 
> >In refrence to my recent post I am pasting the source code so that it can
> >better help in understanding my problem. My vtkActor object is not 
> visible
> >when vtkVolume is rendered. Is this a vtk limitation? are there any
> >workarounds? I tired using a vtkTextActor and that did get overlayed over
> >the volume. However,I want to be able to highlight points inside the
> >volume dynamically. Any pointers will be deeply appreciated. Thanks,
> >
> >vtkRenderer *aRenderer = vtkRenderer::New();
> > vtkRenderWindow *renWin = vtkRenderWindow::New();
> > renWin->AddRenderer(aRenderer);
> > vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
> > iren->SetRenderWindow(renWin);
> >
> > vtkVolume16Reader *v16 = vtkVolume16Reader::New();
> > v16->SetDataDimensions (64,64);
> > v16->SetImageRange (1,93);
> > v16->SetDataByteOrderToLittleEndian();
> > v16->SetFilePrefix (argv[1]); //this is the
> > VTKData-release-4-2\Data\headsq\quarter data set
> > v16->SetDataSpacing (3.2, 3.2, 1.5);
> >
> > //Volume Rendering the dataset
> > vtkPiecewiseFunction* opacityTF = vtkPiecewiseFunction::New();
> >
> > opacityTF->AddPoint(0,0);
> > opacityTF->AddPoint(255,1);
> > //create the volume property to describe how the volume would look like
> > vtkVolumeProperty* volumeProperty = vtkVolumeProperty::New();
> > //set the color and opacity transfer function to the volume property
> > volumeProperty->SetScalarOpacity(opacityTF);
> > volumeProperty->ShadeOn();
> > volumeProperty->SetAmbient(0.1);
> > volumeProperty->SetDiffuse(0.7);
> > volumeProperty->SetSpecular(.2);
> > volumeProperty->SetSpecularPower(10);
> > //create the ray cast function to render the data
> > vtkVolumeRayCastCompositeFunction* compositeFunction =
> > vtkVolumeRayCastCompositeFunction::New();
> > //create the volume mapper
> > vtkVolumeRayCastMapper* volumeMapper = vtkVolumeRayCastMapper::New();
> > //set the ray cast function to be used by the volume mapper
> > volumeMapper->SetVolumeRayCastFunction(compositeFunction);
> > volumeMapper->SetInput(v16->GetOutput());
> > volumeMapper->IntermixIntersectingGeometryOn();
> > //create the volume to hold the volume mapper and the volume property
> > vtkVolume* volume = vtkVolume::New();
> > //set the volume mapper and the property
> > volume->SetMapper(volumeMapper);
> > volume->SetProperty(volumeProperty);
> > //add the volume prop to the renderer
> >
> > //Add a cone
> > vtkConeSource *cone = vtkConeSource::New();
> > cone->SetHeight( 3.0 );
> > cone->SetRadius( 1.0 );
> > cone->SetResolution( 10 );
> >
> > vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
> > coneMapper->SetInput( cone->GetOutput() );
> > vtkActor *coneActor = vtkActor::New();
> > coneActor->SetMapper( coneMapper );
> > vtkCamera *aCamera = vtkCamera::New();
> > aCamera->SetViewUp (0, 0, -1);
> > aCamera->SetPosition (0, 1, 0);
> > aCamera->SetFocalPoint (0, 0, 0);
> > aCamera->ComputeViewPlaneNormal();
> >
> >
> > aRenderer->AddVolume(volume);
> > aRenderer->AddActor(coneActor );
> >
> > aRenderer->SetActiveCamera(aCamera);
> > aRenderer->ResetCamera ();
> > aCamera->Dolly(1.5);
> >
> > // Set a background color for the renderer and set the size of the
> > // render window (expressed in pixels).
> > aRenderer->SetBackground(1,1,1);
> > renWin->SetSize(640, 480);
> >
> > aRenderer->ResetCameraClippingRange ();
> >
> > // Initialize the event loop and then start it.
> > iren->Initialize();
> > iren->Start();
> >
> >Cheers,
> >Abhishek
> >_______________________________________________
> >This is the private VTK discussion list.
> >Please keep messages on-topic. Check the FAQ at:
> >http://www.vtk.org/Wiki/VTK_FAQ
> >Follow this link to subscribe/unsubscribe:
> >http://www.vtk.org/mailman/listinfo/vtkusers
> 
> 
> 


-- 
Abhishek Gattani
Web: http://s92687473.onlinehome.us/blog/
Email: gattani at gmx.net / abhishekg4u at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050816/b5fc98a5/attachment.htm>


More information about the vtkusers mailing list