I thought about that. The "problem" is that I would move more logic outside than I am comfortable with. Your solution would require that the dialog from where this is called already reads the raster files and I'd rather leave the dialogs as bare as possible.
I could add another method which takes a vector of rasters, so we have both possibilities. Then the method taking the raster file names would just read the rasters and then call this other method. How about that?