[vtkusers] stl to Ensite dif conversion

Sebastian Hilbert sebastian.hilbert at gmx.net
Mon Sep 28 13:42:16 EDT 2015


Hi,

I have a stl file which get produced by a medical software. I need to convert 
this to another formal which is very similar to the vtk ascii format with 
polygonal dataset.

The target format is like this:

 <DIFBody>
    <Volumes number="1">
      <Volume name="Left Atrium" color="eae0b2">
        <Vertices number="3984">
           32.4603  6.0825  -40.3249 
           13.9858  7.9016  -41.0501 
           16.6287  7.6514  -40.4356 
           30.7806  7.9503  -41.1414  
        </Vertices>
        <Normals number="3984">
           0.220882  -0.586701  -0.779098 
           -0.082953  -0.169572  -0.982021 
           0.393210  -0.647443  -0.652842 
           -0.106461  -0.248735  -0.962703  
        </Normals>
        <Polygons number="7968">
          3 40 8
          17 10 13
          41 13 42
          4 36 43
          </Polygons>
      </Volume>
    </Volumes>
    <Labels number="0">
    </Labels>
   </DIFBody>
</DIF>


What would be the best way to go about converting stl to Ensite dif ?

I have a sample target file and converted it to stl and vtk with a tool called 
3D object converter (http://3doc.i3dconverter.com/formats.html) which seems to 
be the only tool able to load Einsite dif files. 

Looking at the vtk file the polygons are different from the ones in the xml 
(dif) file. Looking at the stl file (ascii) I can see some vertex lines that 
match a line in the vertices section of the xml (dif) file but there are a lot 
more vertex lines in the stl file then there are in the xml (dif file).

I would prefer to use python if that is an option.

Any help is appreciated.

Sebastian


More information about the vtkusers mailing list