[vtkusers] How to write a collection of vtkSphereSource on a .vtk file?

Massimiliano Folco massimiliano.folco at gmail.com
Fri Jul 15 04:42:51 EDT 2011


Hi to all,

I am an Italian student of Bioengineering and I have to complete a project
for the last exam before my Master Degree.

I'm working in C++ to render a certain number of electrodes, each one
composed by a certain number of contacts, in the right position into a
volume rendered after having read it from a .nifti file, deriving from a MRI
of the head of a patient suffering from epilepsy.

I have created two different classes, one for electrodes and and one for
contacts...
every electrode is represented by an instance of the corresponding class and
has, as class member,  one vector<contact>  (C++ object) containing
instances of contact class, corresponding to the contacts forming the real
electrode. Every contact contains a vtkSphereSource, used for rendering
every contact like a sphere with desired radius and color, in the right
position.

I have obtained the result expected by adding to the same renderer a
vtkVolume representing the MRI and one vtkActor for every contact, after
having modified the center of the vtkSphereSource to adapt it to the
internal coordinates of the vtkVolume (contact_pos_mri = mri_origin +
contact_pos*mri_spacing) : in this way, I have obtained the right position
for the contacts system into the MRI.

Now,I would write a .vtk file for every electrode, or better, for the
collection of vtkSphereSource that is contained into the electrode instance,
so that these files can be opened by another visualization program,like
3Dslicer, and used for other elaboration and analysis.

Could anyone of you tell me how to do this?
I read documentation about vtkWriter, vtkImageWriter adn vtkPolydatawriter,
but I don't think that these could be useful for my purposes, or better, i
don't understand how to use them to reach my goal.

Thanks

Massimiliano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110715/8ef98eaf/attachment.htm>


More information about the vtkusers mailing list