Extended depth-of-field imaging and ranging in microscopy