26 const std::string &category)
34 for (
auto extension : extensions)
36 if (!extension.empty() && extension[0] ==
'.')
38 extension.assign(extension.begin() + 1, extension.end());
56 std::vector<BaseData::Pointer> result;
58 std::list<IOAdapterBase::Pointer> possibleIOAdapter;
59 std::list<itk::LightObject::Pointer> allobjects = itk::ObjectFactoryBase::CreateAllInstance(
"mitkIOAdapter");
61 for (
auto i = allobjects.begin(); i != allobjects.end(); ++i)
66 possibleIOAdapter.push_back(io);
70 MITK_ERROR <<
"Error BaseDataIO factory did not return an IOAdapterBase: " << (*i)->GetNameOfClass() << std::endl;
75 for (
auto k = possibleIOAdapter.begin();
k != possibleIOAdapter.end(); ++
k)
77 bool canReadFile = (*k)->CanReadFile(path,
"",
"");
83 auto numberOfContents =
static_cast<int>(ioObject->GetNumberOfOutputs());
85 if (numberOfContents > 0)
88 for (
int i = 0; i < numberOfContents; ++i)
90 baseData =
dynamic_cast<BaseData *
>(ioObject->GetOutputs()[i].GetPointer());
93 result.push_back(baseData);
104 mitkThrow() <<
"Could not read file '" << path <<
"'";
Base of all data objects.
DataCollection - Class to facilitate loading/accessing structured data.
~LegacyFileReaderService() override
void SetMimeType(const CustomMimeType &mimeType)
The CustomMimeType class represents a custom mime-type which may be registered as a service object...
std::string GetLocalFileName() const
Get a local file name for reading.
void SetMimeTypePrefix(const std::string &prefix)
us::ServiceRegistration< IFileReader > RegisterService(us::ModuleContext *context=us::GetModuleContext())
static std::string DEFAULT_BASE_NAME()
IOAdapterBase class is an abstract adapter class for IO process objects.
void SetDescription(const std::string &description)
std::vector< itk::SmartPointer< BaseData > > Read() override
Reads a path or stream and creates a list of BaseData objects.
void AddExtension(const std::string &extension)
LegacyFileReaderService(const LegacyFileReaderService &other)
void SetCategory(const std::string &category)
Base class for creating mitk::BaseData objects from files or streams.