HomogenizeData[data,mask]
tries to homoginize the data within the mask by removing intensity gradients.