[vtkusers] Please help : Cross-platform VTK rendering

Veerapuram Varadhan v.varadhan at gmail.com
Thu Dec 16 00:15:42 EST 2004


IIRC, Paraview already does that.  I assume IDL buttons are no
different than Paraview buttons.  I would suggest looking at the
paraview code.

HTH,

V. Varadhan.

On Wed, 15 Dec 2004 10:04:32 +0530, Shastry, Anand C (Research)
<anand.shastry at ge.com> wrote:
> Hello,
> 
> I'm able to delete few more objects by using ->Delete() and setting it to NULL. What is the command to access reference counts ?
> 
> As long as the VTK window is open, none of the IDL buttons work, though I can click them & move the mouse. These IDL GUI clicks take effect on closing the VTK window.
> Can I program some key to transfer/toggle control between IDL/VTK ?
> 
> Ultimately I want to be able to refresh the rendered image (in existing window) with the new transfer function & opacity values passed from IDL. Is there some command in the rendering pipeline to refresh existing window ? I'll need the previous instance of the dll for this!
> 
> ImageJ VTK plugin (http://ij-plugins.sourceforge.net/ij-vtk/) claims (in future?) to achieve interactive setting of VTK transfer functions from Java, so it should be possible from IDL also.
> 
> Thanks :)
> Anand
> 
> 
> -----Original Message-----
> From: Veerapuram Varadhan [mailto:v.varadhan at gmail.com]
> Sent: Tuesday, December 14, 2004 12:45 PM
> To: Shastry, Anand C (Research)
> Cc: vtkusers at vtk.org
> Subject: Re: [vtkusers] Please help : Cross-platform VTK rendering
> 
> Please find my replies inline, I may be wrong as its been a while
> since I worked on VTK ;-).  So, the thought is given "as is" and use
> it at your own risk.. ;-)
> 
> On Tue, 14 Dec 2004 11:46:56 +0530, Shastry, Anand C (Research)
> <anand.shastry at ge.com> wrote:
> > Hi,
> >
> > I have a GUI built using RSI IDL. The VTK volume rendering algorithm is in the form of a dll. From the IDL GUI, the dll gets called, the data passed by means of pointers.
> > I'm using vtkRenderWindowInteractor to interact with the rendering. I encounter 3 problems :
> >
> > 1. Deletion of objects created in the dll. The VTK memory is required as long as the rendered window is active. I dont know how to free this memory (for the window, renderer, volume object, etc of a standard rendering pipeline) on closing the render window. Tried putting it in the destructor, but doesn't seem to work.
> >
> 
> VTK objects use "reference counts" to keep/free any memory
> allocations.  A memory associate with a VTK object is free iff its
> "ref-count" is zero.
> 
> So, you can easily verify this by placing breakpoints in the
> destructor of your render window.  Whenever a render window is
> destructed, it calls the "Delete() method of appropriate renderers
> associated with it and renderer calls "Delete()" of all vtkProps and
> so on.  In case if you have any memory leaks, it might be because of
> some vtk objects having a non-zero positive reference count.
> 
> > 2. Mouse/keyboard control transfer. Once the render window is created, the interaction is taken over by VTK. None of the IDL GUI buttons work till the VTK window is closed.
> > I want to be able to change rendering parameters (opacity, etc) from the IDL GUI & refresh the render window to reflect these.
> > Right now, this is only possible by closing the VTK window & popping up a new rendering window (another dll call).
> >
> Are you able to "click" on the IDL buttons/ move your mouse over the
> VTK window, etc?
> 
> > 3. The IDL GUI display does not refresh, when I drag or move the VTK render window. May be related to above problem.
> >
> > The rendering pipeline I follow within the exec loop used to create the dll is :
> >
> > vtkRenderer *renderer = vtkRenderer::New();
> > vtkVolume* volume = vtkVolume::New();
> > vtkRenderWindow *renWin = vtkRenderWindow::New();
> > vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
> > vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();
> > vtkVolumeRayCastMapper *volMapper = vtkVolumeRayCastMapper::New();
> > vtkPiecewiseFunction *opacityTransferFunction = vtkPiecewiseFunction::New();
> > vtkColorTransferFunction *colorTransferFunction = vtkColorTransferFunction::New();
> > vtkVolumeRayCastCompositeFunction *compFunc = vtkVolumeRayCastCompositeFunction::New();
> >
> > opacityTransferFunction->AddPoint(...)
> > colorTransferFunction->AddRGBPoint(..)
> > //set volume properties
> > volumeProperty->SetColor(...)
> > volumeProperty->SetScalarOpacity(...)
> > volMapper->SetInput (pImageIn);
> > volMapper->SetVolumeRayCastFunction (compFunc);
> >
> > renWin->AddRenderer(renderer);
> > iren->SetRenderWindow(renWin);
> > iren->Initialize();
> > renderer->AddVolume(volume);
> > volMapper->Update();
> > iren->Start();
> > iren->Render();
> >
> > renWin->Delete();
> > iren->Delete(); //Cannot delete any other object, as it's required
> 
> I think you can still delete few more objects like
> 
> pImageIn->Delete(); // should be possible because volMapper->SetInput()
>                                    // would have incremented its
> reference count by 1.
>                                    //  I may be wrong, just verify
> this with some other
>                                    //  vtk examples.
> 
> >
> > Any help is greatly appreciated, as I'm stuck here.
> >
> Hope this helps, if not, kindly correct me. ;-)
> 
> > -Anand
> 
> V. Varadhan.
>



More information about the vtkusers mailing list