Just trying to keep a log here. I added the zfp .5 to VTK 7 to allow lossy compression to 3D datasets. It works, but you do have to specify the extent of the data to the compressor separately. I may be able to avoid this in the future, but this is what you get with object oriented design sometimes. Check it out here: https://gitlab.kitware.com/stephenshamilton/vtk/tree/zfp
Last week I was asked to figure out how to embed 3D objects into PDF. This seemed like it would be simple once I figured out which tools to use. This is partially true, however Adobe decided to use U3D format for its internal 3D viewer, which seems less than universal in my opinion. The only path I could find to get .vtp files into the u3d format was to convert the .vtp to x3d files in Paraview, save it, then use meshlab to convert it to U3D. The export in meshlab even provides a .tex file so you can generate a PDF with it from any laTeX program. There were a couple of pieces that weren’t entirely clear that I was able to work through. It was obscure enough to warrant this post for sure. Here are the steps for Ubuntu 15.04:
1. Get VTP file you want to convert (should be able to get these from turbulence cutout service soon!)
2. Load into Paraview, then export scene as x3d.
3. Install mesh lab using sudo apt-get install meshlab
4. Mesh lab does not have the “universal” converter built in, so you have to get it and install it separate.
5. Download the latest converter from http://www2.iaas.msu.ru/tmp/u3d/u3d-1.4.5_current.zip. This is the only version I found that compiled and worked without anything special in Ubuntu.
6. Unzip the converter, and then use ccmake-gui (sudo apt-get install ccmake-qt-gui if you don’t have it) to configure it and setup the build directory.
7. Generate the build files.
8. Go to that directory of build files and do a make;sudo make install. This should put them in /usr/local/bin, which normally is ok, but meshlab has a hardcoded link to the IDTFConverter in /usr/bin, so I just symlinked it with: ln -s /usr/local/bin/IDTFConverter /usr/bin
9. Once this is done, you are set and you can load the x3d file, and export to u3d. It will create two files, the x3d file and the tex file. Load the tex up in your favorite LaTeX editor and make any changes and export to PDF, and you are done!
After a few days of understanding the VTK pipeline, I’ve finally figured out how to generate a vorticity cube from velocity cutout from the JHU Turbuelence database. So here is the code!
h5file = h5py.File(“temp.h5”, ‘r’)
vtkdata = numpy_support.numpy_to_vtk(h5file[“u00000”][:,:,:,:].ravel(), deep=True, array_type=vtk.VTK_FLOAT)
vtkdata.SetNumberOfComponents(3) #We have an x,y,z vector so reform it accordingly
image = vtk.vtkImageData() #Create initial Image data
vorticity = vtk.vtkCellDerivatives()
#We don’t need tensors now
More to be posted in the future!