IOUtils::LoadSurface(filename) currently does:
- use the first reader that claims to load given filename
- verify that the result is mitk::Surface, else return a nullptr
This is not sufficient in cases where there are multiple competing MIME types available for the specified file. Imagine that somebody implemented a new mitk::BaseData such as mitk::PrintableModel and provides a MIME type along with a reader for STL file for this new data type. When this new data type is registered with a higher service ranking, LoadSurface will subsequently fail to load STL files. Other methods like LoadImage, LoadPointSet exhibit identical behavior.
I am not sure about the best solution for this, would need input by the designers of the current system. Just two ideas:
- IOUtil could filter MIME type candidates for _both_ "applies to this file" and "is in that category".
- I am not sure about the relation between "category" and actually provided BaseData sub-class. If there is no fixed relation between them, IOUtil should probably continue with alternative readers if the first reader fails to provide the expected data type. This could lead to loading a file multiple times in multiple formats but would at least succeed in finally finding one reader that works.
If someone is available to advance this subject I could potentially provide some support.