diff --git a/Core/Code/IO/mitkIOUtil.cpp b/Core/Code/IO/mitkIOUtil.cpp index 92f8485..d671110 100644 --- a/Core/Code/IO/mitkIOUtil.cpp +++ b/Core/Code/IO/mitkIOUtil.cpp @@ -27,9 +27,6 @@ See LICENSE.txt or http://www.mitk.org for details. #include #include -#include -#include - //ITK #include @@ -317,62 +314,4 @@ bool IOUtil::SavePointSet(PointSet::Pointer pointset, const std::string path) } return true; } - -bool IOUtil::SaveBaseData( mitk::BaseData::Pointer data, const std::string& path ) -{ - std::string dir = itksys::SystemTools::GetFilenamePath( path ); - std::string baseFilename = itksys::SystemTools::GetFilenameWithoutLastExtension( path ); - std::string extension = itksys::SystemTools::GetFilenameLastExtension( path ); - std::string finalFileName = dir + "/" + baseFilename; - - mitk::CoreObjectFactory::FileWriterList fileWriters = mitk::CoreObjectFactory::GetInstance()->GetFileWriters(); - bool writerFound = false; - - for (mitk::CoreObjectFactory::FileWriterList::iterator it = fileWriters.begin() ; it != fileWriters.end() ; ++it) - { - if ( (*it)->CanWriteBaseDataType(data) ) - { - writerFound = true; - - // Ensure a valid filename - if(baseFilename=="") - { - baseFilename = (*it)->GetDefaultFilename(); - } - // Check if an extension exists already and if not, append the default extension - if (extension=="" ) - { - extension=(*it)->GetDefaultExtension(); - } - else - { - if (!(*it)->IsExtensionValid(extension)) - { - MITK_WARN << extension << " extension is unknown"; - return false; - } - } - - finalFileName = dir + "/" + baseFilename + extension; - try - { - (*it)->SetFileName( finalFileName.c_str() ); - (*it)->DoWrite( data ); - } - catch( std::exception& e ) - { - MITK_ERROR << " during attempt to write '" << finalFileName << "' Exception says:"; - MITK_ERROR << e.what(); - mitkThrow() << "An exception occured during writing the file " << finalFileName << ". Exception says " << e.what(); - } - return true; - } - } - if(!writerFound) - { - return false; - } - return true; -} - } diff --git a/Core/Code/IO/mitkIOUtil.h b/Core/Code/IO/mitkIOUtil.h index a21b282..af9d8c8 100644 --- a/Core/Code/IO/mitkIOUtil.h +++ b/Core/Code/IO/mitkIOUtil.h @@ -23,8 +23,6 @@ See LICENSE.txt or http://www.mitk.org for details. #include #include #include -#include -#include namespace mitk { @@ -117,16 +115,6 @@ public: static bool SaveImage(mitk::Image::Pointer image, const std::string path); /** - * @brief SaveBaseData Convenience method to save arbitrary baseData. - * @param path The path to the image including file name and file extension. - * If not extention is set, the default value (defined in DEFAULTIMAGEEXTENSION) is used. - * @param data The data to save. - * @throws mitk::Exception This exception is thrown when the writer is not able to write the image. - * @return Returns true for success else false. - */ - static bool SaveBaseData(mitk::BaseData::Pointer data, const std::string& path); - - /** * @brief SaveSurface Convenience method to save an arbitrary mitkSurface. * @param path The path to the surface including file name and file extension. * If not extention is set, the default value (defined in DEFAULTSURFACEEXTENSION) is used.