RF: Handle a couple of edge cases
Fix a couple of edge cases:
-
NewNiftiwill attempt to read from files that are already at EOF, but the bzip2 API will return an error code on attempts to do so. Thebzip2Plugin::readfunction has been adjusted to check for EOF before attempting to read any more data. -
NewNiftimay create an empty file, and then close/re-open it for writing. To accommodate this, theguessFormatfunction has been adjusted so that, if the file is empty, it falls back to guessing the format from the file extension.