convert folder .vti to binary .vti

Previously I was able to use 3D Slicer to load dicom and save it as .vtk, and then use the convert-cli to convert it to .vti and use the HttpLoader to load it.

This time, I want to load a DICOM series for volume rendering and try it in this example. However the VolumeViewer example only accepts .vti as binary while the convert-cli generates a folder with manifest.

What tool, script should i use to convert the folder .vti to binary .vti to be able to drag and drop in that example? Thanks!


In Slicer you should be able to do something like this (replace Post* with a glob pattern for your volume name:

>>> i = getNode("Post*").GetImageData()
>>> w = vtk.vtkXMLImageDataWriter()
>>> w.SetInputData(i)
>>> w.SetDataModeToBinary()
>>> w.SetFileName("/tmp/b.vti")
>>> w.Write()
1 Like

This worked great! Thanks

You also have the dicom-exporter python CLI that converts a DICOM folder into .VTI or .vtkjs .

It also reorient to Axial your volume. Thinking about, it should probably be “optional” instead of automatic, especially since vtkImageReslice now support “oriented” images in VTK.js.