If you have an object above or floating in the water, it will probably intersect with the above function.
I would have to give it a try ... I think, that you would need two renders for imagemaps (under water-render, transparency-mask (which is calculated on the fly in the above function)) and the final render with water.
This is getting quite complex but ,-)