How do I generate mipmaps with a custom function?

It would be extremely useful to, for example, be able to calculate a heightmap texture’s mipmaps using a max() operation for the sake of quadtree displacement mapping. Is there currently any way to do this short of writing a plugin for it?