Improved image stack import dialog

Now predicts the prefix and extensions more reliably when a directory
has been chosen.