Open bcipolli opened 9 years ago
My current workaround: if, after decimating, I call explode_scalars
to simply read/rewrite the file, it works (edit: workaround using read_vtk
/write_vtk
is also good):
I'm not sure if the file format is not compatible with three.js, or if the vtk loading code is simply more robust to errors.
@bcipolli -- So that I'm clear, do you believe that the decimation function is saving the files in a format not compatible with three.js, and that reading/rewriting (with explode_scalars() or with read_vtk()/write_vtk()) results in a three.js-amenable format?
@binarybottle Yes, that's my belief.
Perhaps writing out the vtk file using vtk.vtkPolyDataWriter() in the decimate() function might not be the way to go. I'm not sure what to replace it with, but given that you found a workaround, would you mind submitting a pull request to include the read/rewrite so that the output of the function will behave well for future roygbiv/three.js work? Were you able to do so for files with multiple labels?
If I
decimate
the individual ROI surfaces, parse usingVTKLoader.js
and try to display viathree.js
, I get about 33% of the surfaces having invalid vertex indices that cause a javascript error (see below):(note: If I
decimate
the label vtk beforeexploding
into ROIs, I don't have the problem, but the result doesn't look great):This is either an issue with
decimate
or theVTKLoader
code. @binarybottle could you help debug? A script to reproduce this issue is attached at the bottom (requiresflask
)