If you change the getMinimum and getMaximum functions below, you'll want to be sure that for each channel, max > min, so you don't get divide by zero errors in the shader.  It might be worth checking that explicitly here.