The HD5ImageIO is overly optimistic in it's CanReadFile method. It reports it can read any file which passes H5::H5File::isHdf5, or any file with data. It does not consider if the file contains an ITK HDF5 image. There is already special code to ensure it does not try to read MINC files [1].
I have encountered problems trying to read IMS or Imaris files, which SCIFIO can read, but HDF5ImageIO tries to read and fails. I am currently explicitly setting the ImageIO to SCIFIOImageIO, but it is cumbersome.
Perhaps HDF5 should restrict what is "can read" to having the same file extensions it "can write" or the IO should verify that the file has the ITK information and/or group name.
[1] https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/IO/HDF5/src/itkHDF5ImageIO.cxx#L690-L743
The HD5ImageIO is overly optimistic in it's
CanReadFilemethod. It reports it can read any file which passesH5::H5File::isHdf5, or any file with data. It does not consider if the file contains an ITK HDF5 image. There is already special code to ensure it does not try to read MINC files [1].I have encountered problems trying to read IMS or Imaris files, which SCIFIO can read, but HDF5ImageIO tries to read and fails. I am currently explicitly setting the ImageIO to SCIFIOImageIO, but it is cumbersome.
Perhaps HDF5 should restrict what is "can read" to having the same file extensions it "can write" or the IO should verify that the file has the ITK information and/or group name.
[1] https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/IO/HDF5/src/itkHDF5ImageIO.cxx#L690-L743