Introduction to the new IO System - MITK
Transcript of Introduction to the new IO System - MITK
![Page 1: Introduction to the new IO System - MITK](https://reader033.fdocuments.in/reader033/viewer/2022060810/6298517c31ce1e570d03b055/html5/thumbnails/1.jpg)
3/5/2015
Introduction to the new
IO System
![Page 2: Introduction to the new IO System - MITK](https://reader033.fdocuments.in/reader033/viewer/2022060810/6298517c31ce1e570d03b055/html5/thumbnails/2.jpg)
3/5/2015 | Author
Today‘s session is gonna take a little longer
1. Features
2. The IO Architecture
3. Quick HowTo
![Page 3: Introduction to the new IO System - MITK](https://reader033.fdocuments.in/reader033/viewer/2022060810/6298517c31ce1e570d03b055/html5/thumbnails/3.jpg)
3/5/2015 |
Features
1. Common Interface for all Reader/Writer
2. Reader/Writer implementation in one file….
3. …and one method
4. User-defineable options while reading/writing files
5. Automatic handling of file location and streaming
6. Core needs no fiddeling
7. Reader/Writer can be superceded externally
8. Confidence level
9. Usage of MIME-Types
10. Fetches coffee if asked nicely
![Page 4: Introduction to the new IO System - MITK](https://reader033.fdocuments.in/reader033/viewer/2022060810/6298517c31ce1e570d03b055/html5/thumbnails/4.jpg)
3/5/2015 |
It’s like Christmas all over again!
![Page 5: Introduction to the new IO System - MITK](https://reader033.fdocuments.in/reader033/viewer/2022060810/6298517c31ce1e570d03b055/html5/thumbnails/5.jpg)
3/5/2015 |
The IO Architecture
![Page 6: Introduction to the new IO System - MITK](https://reader033.fdocuments.in/reader033/viewer/2022060810/6298517c31ce1e570d03b055/html5/thumbnails/6.jpg)
3/5/2015 |
The IO Architecture
![Page 7: Introduction to the new IO System - MITK](https://reader033.fdocuments.in/reader033/viewer/2022060810/6298517c31ce1e570d03b055/html5/thumbnails/7.jpg)
3/5/2015 |
The IO Architecture
![Page 8: Introduction to the new IO System - MITK](https://reader033.fdocuments.in/reader033/viewer/2022060810/6298517c31ce1e570d03b055/html5/thumbnails/8.jpg)
3/5/2015 |
IFileIO
General concepts shared between Reader and Writer
1) The Confidence Level
2) Options
3) Progress Callbacks (Future Work)
![Page 9: Introduction to the new IO System - MITK](https://reader033.fdocuments.in/reader033/viewer/2022060810/6298517c31ce1e570d03b055/html5/thumbnails/9.jpg)
3/5/2015 |
IFileIO:Confidence Level
Concept to rank Reader and Writer
enum ConfidenceLevel
{
Unsupported = 0,
PartiallySupported = 8,
Supported = 16
};
• Your reader should return one of these values when
presented with a file
• Higher confidence is preferred by the system
![Page 10: Introduction to the new IO System - MITK](https://reader033.fdocuments.in/reader033/viewer/2022060810/6298517c31ce1e570d03b055/html5/thumbnails/10.jpg)
3/5/2015 |
IFileIO:Options
Concept to control Reader/Writer behaviour
typedef std::map<std::string, us::Any> Options;
virtual Options GetOptions();
virtual void SetOptions(const Options& options);
virtual us::Any GetOption(const std::string& name);
virtual void SetOptions(const Options& options);
• Reader/Writer should define their default options
• Example Implementation: RawImageFileReaderService
![Page 11: Introduction to the new IO System - MITK](https://reader033.fdocuments.in/reader033/viewer/2022060810/6298517c31ce1e570d03b055/html5/thumbnails/11.jpg)
3/5/2015 |
IFileIO:Options
Options are
Automagically
Converted into a form when
opening a file via a GUI!
![Page 12: Introduction to the new IO System - MITK](https://reader033.fdocuments.in/reader033/viewer/2022060810/6298517c31ce1e570d03b055/html5/thumbnails/12.jpg)
3/5/2015 |
IFileReader & IFileWriter
General concepts specific to Reader and Writer
1) Defining locations and abstracting from location to streams
2) Read / Write methods
![Page 13: Introduction to the new IO System - MITK](https://reader033.fdocuments.in/reader033/viewer/2022060810/6298517c31ce1e570d03b055/html5/thumbnails/13.jpg)
3/5/2015 |
Locations and Streams
• Reader/Writer should be indifferent towards Stream/FilePath
• Interfaces require Reader/Writer to handle both!
![Page 14: Introduction to the new IO System - MITK](https://reader033.fdocuments.in/reader033/viewer/2022060810/6298517c31ce1e570d03b055/html5/thumbnails/14.jpg)
3/5/2015 |
Implement own IO: Use Abstract Classes
mitk::MyFileReader mitk::MyFileWriter
mitk::MyFileReaderAndWriter
![Page 15: Introduction to the new IO System - MITK](https://reader033.fdocuments.in/reader033/viewer/2022060810/6298517c31ce1e570d03b055/html5/thumbnails/15.jpg)
3/5/2015 |
Benefits: Deriving from Abstract Classes
• Handels Stream / Filepath abstraction
• Registration in Reader/Writer registry system
• Sensible default implementations
• Avoid code duplication
• Fast and easy IO implementation
?
![Page 16: Introduction to the new IO System - MITK](https://reader033.fdocuments.in/reader033/viewer/2022060810/6298517c31ce1e570d03b055/html5/thumbnails/16.jpg)
3/5/2015 |
Reader/Writer Registry
• Abstract Classes implemented as Microservice
• Reader/Writer globally available
• Available from GUI
• Easy-Peasy file reading from code via IOUtil
std::vector<mitk::BaseData::Pointer> result;
result = IOUtil::Load(“/Path/To/My/Unicorn”);
![Page 17: Introduction to the new IO System - MITK](https://reader033.fdocuments.in/reader033/viewer/2022060810/6298517c31ce1e570d03b055/html5/thumbnails/17.jpg)
3/5/2015 |
Reader/Writer Registry
• Supercession of Readers
• Use Confidence and Priority to select best reader
• Reader/Writer globally available
• Available from GUI
• Easy-Peasy file reading from code via IOUtil
std::vector<mitk::BaseData::Pointer> result;
result = IOUtil::Load(“/Path/To/My/Unicorn”);
![Page 18: Introduction to the new IO System - MITK](https://reader033.fdocuments.in/reader033/viewer/2022060810/6298517c31ce1e570d03b055/html5/thumbnails/18.jpg)
3/5/2015 |
Further Reading
• For more detailed info, please consult the concept page!
![Page 19: Introduction to the new IO System - MITK](https://reader033.fdocuments.in/reader033/viewer/2022060810/6298517c31ce1e570d03b055/html5/thumbnails/19.jpg)
Thank you for
your attention!
Further
information
on www.dkfz.de