Brain segmentation on .VTK head surface

Thank you, yes what you wrote is more simple and better, image.getPointData().getDataType() is not a function in vtk.js, it doesn’t work, I didn’t use it.
The result that I’ve obtained is better than the previous, but I don’t get the total of the head