I am attempting to use the vtkImageMarchingSquares class to generate isodose lines for some dose data. This is working great, until the marching squares gets to certain slices. I am using K-slicing, which is the only direction the marching squares implementation currently supports.
(The isodose lines don’t show up in the screenshot above as the error happens pretty quickly, almost before the first render of the lines.)
After doing some debugging on my own, it appears that when the marching squares tries the ambiguous cases (case 5 and case 10), the algorithm will error out because it fails to get the edge.
(Debugging in ImageMarchingSquares.js)
(This is where the error happens, when looking into the
edgeVertsvariable. Could even fail earlier if
Is this an issue with the implementation of the marching squares algorithm in vtk.js, or is it possible I am doing something wrong? It doesn’t appear that the algorithm tries to distinguish between the ambiguous cases (select the right edge?).
For reference, here is the data used in the scene (from SlicerRT Data):
If it would help, I can create a reproduction using stackblitz, or something similar, but figured I would just start with laying things out first.