I want to check if a given point is inside of the space drawn inside of a irregular path - inside of the brain (the path is below).
I don't seem to be able to use CanvasRenderingContext2D.isPointInPath(path, x, y) because it only returns true if the point is literally inside the path (the white outline).
I also don't think I can use the odd polygon rule, given that it is possible for a point not to be in the edge and its line still hit the shape wall an even number of times...

As you're working with a SVG, here's a workaround which doesn't involve any abstract calculations.
(1)
Make the inside of your shape, thus the area you want to detect a color completely different from the rest of the shape or any other visuals. In your case for example it would be nothing (or black) to red.
This is controlled by the svg's
fillattribute, which takes a hex#ff0000or a rgb valuergb(255,0,0). Well for reasons that will be important later we make it argba(255,0,0,1)value though it ignores the alpha value.As we don't want the fill to be visible, we also need to set the
fill-opacityvalue to0.005. This is the lowest value possible and equals the CanvasRenderingContext2D value of 1 in a range from 0-255.(2)
Now we need to turn the svg into an Image object that can be drawn onto a canvas. This can be done using the following lines:
svgis just a string representation of your svg's data.(3)
The final step involves getting the pixel color at a specific position on the canvas. For this we utilize the
.getImageData(x, y, width, height)method, which returns an object consisting of aUint8ClampedArraywhich holds four values per pixel. If we set bothwidthandheightto 1 we get exactly the four color components for a single pixel -red,green,blueandalpha.Now we simply compare the color with the red we've used in step (1) and if it's equal, we know it's inside the shape.
Here's a working example (hover your mouse over the image):