[vtkusers] how to minimize memory size of vtkActors?

Lawrence M. Lifshitz Lawrence.Lifshitz at umassmed.edu
Mon Jan 24 11:31:05 EST 2005


Hi,
   I'm writing an application with 100,000s of atoms (of 3 different kinds) diffusing around. I'm 
trying to minimize the
space taken up by the simulation.  Right now I have vtkSphereSource generate 3 "generic" atoms
(one for each kind of atom, they are each a different size).  Similarly I have 3 mappers and 3 
vtkProperties (each type of atom has a different color).  I then generate
one vtkActor for each atom I want to simulate (ie, 100,000s of actors),
set it's Input() to be the correct generic atom source Output() and use SetPosition() on the actor 
to move that atom.  These actors go directly to the renderer (no other levels of filtering).
I've set GlobalImmediateModeRenderingOn() and GlobalReleaseDataFlagOn().
How can I further minimize space used?  Specifically:

I'm worried that vtkActor is taking up a lot of space for each instance of it.
1). how can I tell how much space is used by an instance of vtkActor (especially in "real use" along 
with its associated default data which might get created, rather than just looking at the static 
definition in vtkProp3D.h)?

All I'm really using vtkActor for is to set the position of its associated atom.
2).  Can I create a "light weight" vtkActor which permits this (and the necessary VTK functions like
    update(), etc), but excludes unnecessary stuff (do I need vtkTransform in there? what about a lot
    of the other floats?)?
    I assume I'd do this by creating myvtkActor derived from vtkProp3D but
    without a bunch of the private data.
3). Which private data can I get rid of?  Would this be a large
    saving compared to other data which gets created with vtkActor (there are lots of ptrs to things
    that MIGHT be getting created for vtkActor, but it's hard to tell what does get created)?
    I did realize that an instance of vtkProperty gets created for each vtkActor unless explicitly
    created, that is why I've created 3 of them and set them explictly.

4). how many copies of data will be "lying around"  since I have no other filters in the system?
    I only have 3 vtkSphereSources, but I assume since I have 100,000s of Actors that I get
    100,000s of vtkPolyDatas AFTER the vtkActor stage of the pipeline (each vtkPolyData being for
    one sphere). But do I only have 3 spheres before that stage?  Thus the GlobalReleaseDataFlagOn()
    really doesn't do anything for me?

Is there a better way? I thought I might just use 3 Actors and instead create 100,000s of atoms,
each with a different position. Then I could go in and directly modify the vtkPolyData for an atom
when I need to move it (or stick in a vtkTransform filter), but I thought that would take more
space and time. would it?

Thanks.

-- 
Lawrence M. Lifshitz, Ph. D., Associate Professor
Biomedical Imaging Group (http://invitro.umassmed.edu)
University of Massachusetts Medical School (http://www.umassmed.edu)
Phone: (508) 856-3392   email: Lawrence.Lifshitz at umassmed.edu
Fax:   (508) 856-1840     web: http://invitro.umassmed.edu/lml




More information about the vtkusers mailing list