21 #include "itksys/SystemTools.hxx" 32 "Default reader for the example data structure")
40 std::vector<itk::SmartPointer<mitk::BaseData>> result;
43 std::string ext = itksys::SystemTools::GetFilenameLastExtension(location);
44 ext = itksys::SystemTools::LowerCase(ext);
52 std::ifstream file(location);
53 std::string content(
"");
57 while (getline(file, line))
69 outputData->SetData(content);
70 result.push_back(outputData.GetPointer());
80 MITK_ERROR <<
"Unknown error occurred while trying to read file.";
std::vector< itk::SmartPointer< BaseData > > Read() override
Reads a path or stream and creates a list of BaseData objects.
ExampleDataStructureReaderService()
DataCollection - Class to facilitate loading/accessing structured data.
The CustomMimeType class represents a custom mime-type which may be registered as a service object...
us::ServiceRegistration< IFileReader > RegisterService(us::ModuleContext *context=us::GetModuleContext())
~ExampleDataStructureReaderService() override
An object of this class represents an exception of MITK. Please don't instantiate exceptions manually...
The reader service for the MITK example data type.
Base class for creating mitk::BaseData objects from files or streams.
std::string GetInputLocation() const override
Get the current input location.