implementation with planeIndex taken into account. generateBinaryImage still does not work when the current orientation is not the same one as the bezier curve. I have removed a line that delete the previous toolBox it is a hack for the moment to prevent a bug. A better solution needs to be found
Now the generateBinaryImage works for all orientations