[vtkusers] How to save multiple (polydata) objects together with their props into one single file?

Andras Lasso lasso at queensu.ca
Mon Feb 26 12:16:50 EST 2018

You can also insert your meshes into a vtkMultiBlockDataSet and use vtkXMLMultiBlockDataWriter/vtkXMLMultiBlockDataReader. The advantage compared to 3DS/OBJ/VRML exporters that all polydata point/cell arrays are preserved and you can optionally also store metadata for the whole dataset or for each block. Actor properties (such as color, opacity) are not written to the file, unless you store them in the polydata object.

See example of how this is used in 3D Slicer for storing segmentation consisting of potentially overlapping segments.

-          Reading: https://github.com/Slicer/Slicer/blob/f5128eae6aebfbce9bc4fb1a3a5804e545452d57/Libs/MRML/Core/vtkMRMLSegmentationStorageNode.cxx#L756-L930

-          Writing: https://github.com/Slicer/Slicer/blob/f5128eae6aebfbce9bc4fb1a3a5804e545452d57/Libs/MRML/Core/vtkMRMLSegmentationStorageNode.cxx#L1140-L1282


From: vtkusers [mailto:vtkusers-bounces at vtk.org] On Behalf Of David Gobbi
Sent: Monday, February 26, 2018 12:07 PM
To: normanius <juch at zhaw.ch>
Cc: VTK Users <vtkusers at vtk.org>
Subject: Re: [vtkusers] How to save multiple (polydata) objects together with their props into one single file?

On Mon, Feb 26, 2018 at 9:57 AM, normanius <juch at zhaw.ch<mailto:juch at zhaw.ch>> wrote:

Do I have to define my own "file format", or does something like this
already exist in vtk?

VTK can use a few different file formats for scenes.  I doubt that all features of each file format are supported, but if your basic requirement is just to save multiple polydata in a file, these should work for you:


I don't think VTK has a native file format for this, but I could be wrong.

 - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180226/0a0051f5/attachment.html>

More information about the vtkusers mailing list