I am interested in the vtk-js library, and would like to learn more about it. Before I investigate more on it’s various applications, I want to know if the library has APIs to load .vtk file.
I found some examples, and they can only load .vti, .vtp and .vtkjs files.
*.vtk files are VTK legacy format which can encapsulate any kind of vtkDataSets.
We currently have partial support for vtkPolyData inside *.vtk file.
But the key aspect with vtk.js is that we mainly focus on PolyData or ImageData for the rendering aspect. Therefore what should drive your reflexion is what to aim to do with vtk.js, not really what it can read at a given point in time.
So I guess my question to you would be: “What are you looking to do with vtk.js?”
Thank you for your reply. Yes, .vtk is a legacy format. Previously we used C++ VTK library to do volume rendering. Now we want to use vtk-js library to develop web application that also needs to do volume rendering. We are currently evaluate the libraries and tools to see if they can meet our needs. We have some data from CT scan that are saved in .vtk format.
Actually itk.js may already have a version of that reader wrapped in WebAssembly which might work directly work inside ParaView Glance.
You can always use that path rather than creating a 100% JS reader for that file format.
@Sebastien_Jourdain is correct – you can use the vtk.js ITKImageReader to read in a volume in VTK legacy file format (binary or ascii) via itk.js.
As a side note, it is now also possible to read it a vtk.js PolyData from a binary or ascii .vtk polydata or unstructured grid file via VTK C++ WebAssembly / itk.js with the vtk.js ITKPolyDataReader.
can vtk.js properly read legacy vtk files under version 5.1 ?
I was successfully using vtkPolyDataReader with version 4.2 but it is not working anymore now that I have to deal with version 5.1 files.
The legacy format was added at the very beginning of vtk.js with very bare functionalities. I would suggest creating an issue Add support for reading Legacy VTK format of version 5.1 with maybe a sample dummy file (small) just to validate.
I’m not expecting that too much work is required to make it work again.