Page MenuHomePhabricator

Dynamic file extension retriever for ITK supported formats
Closed, WontfixPublic

Description

The mitk::ImageWriter class returns a hard coded list of file extensions while using ITK writers to write image files. The attached patch provides a factory class which cycles through all registered ImageIO objects in ITK, collects a list of all ITK supported file extensions and returns it. This enables supporting own ITK base ImageIO classes instead of wrapping them for MITK.

The patch modifies the mitkImageWriter.cpp file as well as the Code/files.cmake and brings separate source/header file for the factory class. The patch applies to mitk trunk revision 23283. It was generated one level above the mitk root directory.

Event Timeline

cc Kwong and Sven who work on similar issues.

Reassign to Kwong, but also party bug.

Hello Sven,
thank you for the patch,it looks really good. The actual way of setting up a hard coded list of possible file extensions is pretty bad, nevertheless we currently need it that way, for we decided not to support all possible file formats from itkImageIO. Using the proposed factory would overwrite the not supported formats and add them again to the extension list. Furthermore the used mitk::FileWriter extensions should also be handled dynamically.

ToDo T8209:

  • develop a method for dynamic file extension checking, that constrains the possible file extension list from itk and also includes the mitk file extensions.

I'll add a new bug to start a discussion on how that shall be implemented.