24 const std::string &description)
25 :
AbstractFileWriter(legacyWriter->GetSupportedBaseData()), m_LegacyWriter(legacyWriter)
31 std::vector<std::string> extensions = legacyWriter->GetPossibleFileExtensions();
32 for (std::vector<std::string>::iterator ext = extensions.begin(); ext != extensions.end(); ++ext)
37 std::string extension = *ext;
38 if (extension.size() > 1 && extension[0] ==
'*')
41 extension = extension.substr(1);
43 if (extension.size() > 1 && extension[0] ==
'.')
46 extension = extension.substr(1);
48 std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
64 if (m_LegacyWriter.IsNull())
65 mitkThrow() <<
"LegacyFileWriterService was incorrectly initialized: Has no LegacyFileWriter.";
67 ValidateOutputLocation();
71 m_LegacyWriter->SetFileName(localFile.
GetFileName().c_str());
72 m_LegacyWriter->SetInput(const_cast<BaseData *>(this->GetInput()));
73 m_LegacyWriter->Write();
81 node->SetData(const_cast<BaseData *>(this->GetInput()));
82 return m_LegacyWriter->CanWriteDataType(node) ? Supported : Unsupported;
virtual void Write() override
Write the base data to the specified location or output stream.
LegacyFileWriterService(mitk::FileWriter::Pointer legacyWriter, const std::string &description)
std::string GetFileName()
virtual ConfidenceLevel GetConfidenceLevel() const override
The confidence level of the reader or writer implementation.
virtual ConfidenceLevel GetConfidenceLevel() const override
The confidence level of the reader or writer implementation.
The CustomMimeType class represents a custom mime-type which may be registered as a service object...
static std::string DEFAULT_BASE_NAME()
A local file representation for streams.
void AddExtension(const std::string &extension)
us::ServiceRegistration< IFileWriter > RegisterService(us::ModuleContext *context=us::GetModuleContext())
void SetMimeType(const CustomMimeType &mimeType)
ConfidenceLevel
A confidence level describing the confidence of the reader or writer in handling the given data...
void SetMimeTypePrefix(const std::string &prefix)
Base class for writing mitk::BaseData objects to files or streams.
~LegacyFileWriterService()
void SetDescription(const std::string &description)
Sets a human readable description of this writer.