Page MenuHomePhabricator

14986_fix.patch

14986_fix.patch

diff --git a/Core/Code/IO/mitkIOUtil.cpp b/Core/Code/IO/mitkIOUtil.cpp
index 92f8485..7a0f5d0 100644
--- a/Core/Code/IO/mitkIOUtil.cpp
+++ b/Core/Code/IO/mitkIOUtil.cpp
@@ -41,25 +41,25 @@ See LICENSE.txt or http://www.mitk.org for details.
namespace mitk {
-const std::string IOUtil::DEFAULTIMAGEEXTENSION = ".nrrd";
-const std::string IOUtil::DEFAULTSURFACEEXTENSION = ".stl";
-const std::string IOUtil::DEFAULTPOINTSETEXTENSION = ".mps";
+ const std::string IOUtil::DEFAULTIMAGEEXTENSION = ".nrrd";
+ const std::string IOUtil::DEFAULTSURFACEEXTENSION = ".stl";
+ const std::string IOUtil::DEFAULTPOINTSETEXTENSION = ".mps";
-int IOUtil::LoadFiles(const std::vector<std::string> &fileNames, DataStorage &ds)
-{
+ int IOUtil::LoadFiles(const std::vector<std::string> &fileNames, DataStorage &ds)
+ {
// Get the set of registered mitk::IDataNodeReader services
ModuleContext* context = mitk::GetModuleContext();
const std::list<ServiceReference> refs = context->GetServiceReferences<IDataNodeReader>();
std::vector<IDataNodeReader*> services;
services.reserve(refs.size());
for (std::list<ServiceReference>::const_iterator i = refs.begin();
- i != refs.end(); ++i)
+ i != refs.end(); ++i)
{
- IDataNodeReader* s = context->GetService<IDataNodeReader>(*i);
- if (s != 0)
- {
- services.push_back(s);
- }
+ IDataNodeReader* s = context->GetService<IDataNodeReader>(*i);
+ if (s != 0)
+ {
+ services.push_back(s);
+ }
}
mitk::ProgressBar::GetInstance()->AddStepsToDo(2*fileNames.size());
@@ -68,110 +68,110 @@ int IOUtil::LoadFiles(const std::vector<std::string> &fileNames, DataStorage &ds
// to load them.
int nodesRead = 0;
for (std::vector<std::string>::const_iterator i = fileNames.begin();
- i != fileNames.end(); ++i)
+ i != fileNames.end(); ++i)
{
- for (std::vector<IDataNodeReader*>::const_iterator readerIt = services.begin();
- readerIt != services.end(); ++readerIt)
+ for (std::vector<IDataNodeReader*>::const_iterator readerIt = services.begin();
+ readerIt != services.end(); ++readerIt)
+ {
+ try
{
- try
- {
- int n = (*readerIt)->Read(*i, ds);
- nodesRead += n;
- if (n > 0) break;
- }
- catch (const std::exception& e)
- {
- MITK_WARN << e.what();
- }
+ int n = (*readerIt)->Read(*i, ds);
+ nodesRead += n;
+ if (n > 0) break;
+ }
+ catch (const std::exception& e)
+ {
+ MITK_WARN << e.what();
}
- mitk::ProgressBar::GetInstance()->Progress(2);
+ }
+ mitk::ProgressBar::GetInstance()->Progress(2);
}
for (std::list<ServiceReference>::const_iterator i = refs.begin();
- i != refs.end(); ++i)
+ i != refs.end(); ++i)
{
- context->UngetService(*i);
+ context->UngetService(*i);
}
return nodesRead;
-}
+ }
-DataStorage::Pointer IOUtil::LoadFiles(const std::vector<std::string>& fileNames)
-{
+ DataStorage::Pointer IOUtil::LoadFiles(const std::vector<std::string>& fileNames)
+ {
mitk::StandaloneDataStorage::Pointer ds = mitk::StandaloneDataStorage::New();
LoadFiles(fileNames, *ds);
return ds.GetPointer();
-}
+ }
-DataNode::Pointer IOUtil::LoadDataNode(const std::string path)
-{
+ DataNode::Pointer IOUtil::LoadDataNode(const std::string path)
+ {
mitk::DataNodeFactory::Pointer reader = mitk::DataNodeFactory::New();
try
{
- reader->SetFileName( path );
- reader->Update();
+ reader->SetFileName( path );
+ reader->Update();
- if((reader->GetNumberOfOutputs()<1))
- {
- MITK_ERROR << "Could not find data '" << path << "'";
- mitkThrow() << "An exception occured during loading the file " << path << ". Exception says could not find data.";
- }
+ if((reader->GetNumberOfOutputs()<1))
+ {
+ MITK_ERROR << "Could not find data '" << path << "'";
+ mitkThrow() << "An exception occured during loading the file " << path << ". Exception says could not find data.";
+ }
- mitk::DataNode::Pointer node = reader->GetOutput();
+ mitk::DataNode::Pointer node = reader->GetOutput();
- if(node.IsNull())
- {
- MITK_ERROR << "Could not find path: '" << path << "'" << " datanode is NULL" ;
- mitkThrow() << "An exception occured during loading the file " << path << ". Exception says datanode is NULL.";
- }
+ if(node.IsNull())
+ {
+ MITK_ERROR << "Could not find path: '" << path << "'" << " datanode is NULL" ;
+ mitkThrow() << "An exception occured during loading the file " << path << ". Exception says datanode is NULL.";
+ }
- return reader->GetOutput( 0 );
- }
+ return reader->GetOutput( 0 );
+ }
catch ( itk::ExceptionObject & e )
{
- MITK_ERROR << "Exception occured during load data of '" << path << "': Exception: " << e.what();
- mitkThrow() << "An exception occured during loading the file " << path << ". Exception says: " << e.what();
+ MITK_ERROR << "Exception occured during load data of '" << path << "': Exception: " << e.what();
+ mitkThrow() << "An exception occured during loading the file " << path << ". Exception says: " << e.what();
}
-}
+ }
-Image::Pointer IOUtil::LoadImage(const std::string path)
-{
+ Image::Pointer IOUtil::LoadImage(const std::string path)
+ {
mitk::DataNode::Pointer node = LoadDataNode(path);
mitk::Image::Pointer image = dynamic_cast<mitk::Image*>(node->GetData());
if(image.IsNull())
{
- MITK_ERROR << "Image is NULL '" << path << "'";
- mitkThrow() << "An exception occured during loading the image " << path << ". Exception says: Image is NULL.";
+ MITK_ERROR << "Image is NULL '" << path << "'";
+ mitkThrow() << "An exception occured during loading the image " << path << ". Exception says: Image is NULL.";
}
return image;
-}
+ }
-Surface::Pointer IOUtil::LoadSurface(const std::string path)
-{
+ Surface::Pointer IOUtil::LoadSurface(const std::string path)
+ {
mitk::DataNode::Pointer node = LoadDataNode(path);
mitk::Surface::Pointer surface = dynamic_cast<mitk::Surface*>(node->GetData());
if(surface.IsNull())
{
- MITK_ERROR << "Surface is NULL '" << path << "'";
- mitkThrow() << "An exception occured during loading the file " << path << ". Exception says: Surface is NULL.";
+ MITK_ERROR << "Surface is NULL '" << path << "'";
+ mitkThrow() << "An exception occured during loading the file " << path << ". Exception says: Surface is NULL.";
}
return surface;
-}
+ }
-PointSet::Pointer IOUtil::LoadPointSet(const std::string path)
-{
+ PointSet::Pointer IOUtil::LoadPointSet(const std::string path)
+ {
mitk::DataNode::Pointer node = LoadDataNode(path);
mitk::PointSet::Pointer pointset = dynamic_cast<mitk::PointSet*>(node->GetData());
if(pointset.IsNull())
{
- MITK_ERROR << "PointSet is NULL '" << path << "'";
- mitkThrow() << "An exception occured during loading the file " << path << ". Exception says: Pointset is NULL.";
+ MITK_ERROR << "PointSet is NULL '" << path << "'";
+ mitkThrow() << "An exception occured during loading the file " << path << ". Exception says: Pointset is NULL.";
}
return pointset;
-}
+ }
-bool IOUtil::SaveImage(mitk::Image::Pointer image, const std::string path)
-{
+ bool IOUtil::SaveImage(mitk::Image::Pointer image, 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 );
@@ -181,38 +181,38 @@ bool IOUtil::SaveImage(mitk::Image::Pointer image, const std::string path)
//check if an extension is given, else use the defaul extension
if( extension == "" )
{
- MITK_WARN << extension << " extension is not set. Extension set to default: " << finalFileName
- << DEFAULTIMAGEEXTENSION;
- extension = DEFAULTIMAGEEXTENSION;
+ MITK_WARN << extension << " extension is not set. Extension set to default: " << finalFileName
+ << DEFAULTIMAGEEXTENSION;
+ extension = DEFAULTIMAGEEXTENSION;
}
// check if extension is suitable for writing image data
if (!imageWriter->IsExtensionValid(extension))
{
- MITK_WARN << extension << " extension is unknown. Extension set to default: " << finalFileName
- << DEFAULTIMAGEEXTENSION;
- extension = DEFAULTIMAGEEXTENSION;
+ MITK_WARN << extension << " extension is unknown. Extension set to default: " << finalFileName
+ << DEFAULTIMAGEEXTENSION;
+ extension = DEFAULTIMAGEEXTENSION;
}
try
{
- //write the data
- imageWriter->SetInput(image);
- imageWriter->SetFileName(finalFileName.c_str());
- imageWriter->SetExtension(extension.c_str());
- imageWriter->Write();
+ //write the data
+ imageWriter->SetInput(image);
+ imageWriter->SetFileName(finalFileName.c_str());
+ imageWriter->SetExtension(extension.c_str());
+ imageWriter->Write();
}
catch ( std::exception& e )
{
- MITK_ERROR << " during attempt to write '" << finalFileName + extension << "' Exception says:";
- MITK_ERROR << e.what();
- mitkThrow() << "An exception occured during writing the file " << finalFileName << ". Exception says " << e.what();
+ MITK_ERROR << " during attempt to write '" << finalFileName + extension << "' Exception says:";
+ MITK_ERROR << e.what();
+ mitkThrow() << "An exception occured during writing the file " << finalFileName << ". Exception says " << e.what();
}
return true;
-}
+ }
-bool IOUtil::SaveSurface(Surface::Pointer surface, const std::string path)
-{
+ bool IOUtil::SaveSurface(Surface::Pointer surface, 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 );
@@ -220,67 +220,67 @@ bool IOUtil::SaveSurface(Surface::Pointer surface, const std::string path)
if (extension == "") // if no extension has been set we use the default extension
{
- MITK_WARN << extension << " extension is not set. Extension set to default: " << finalFileName
- << DEFAULTSURFACEEXTENSION;
- extension = DEFAULTSURFACEEXTENSION;
+ MITK_WARN << extension << " extension is not set. Extension set to default: " << finalFileName
+ << DEFAULTSURFACEEXTENSION;
+ extension = DEFAULTSURFACEEXTENSION;
}
try
{
- finalFileName += extension;
- if(extension == ".stl" )
- {
- mitk::SurfaceVtkWriter<vtkSTLWriter>::Pointer surfaceWriter = mitk::SurfaceVtkWriter<vtkSTLWriter>::New();
-
- // check if surface actually consists of triangles; if not, the writer will not do anything; so, convert to triangles...
- vtkPolyData* polys = surface->GetVtkPolyData();
- if( polys->GetNumberOfStrips() > 0 )
- {
- vtkSmartPointer<vtkTriangleFilter> triangleFilter = vtkSmartPointer<vtkTriangleFilter>::New();
- triangleFilter->SetInput(polys);
- triangleFilter->Update();
- polys = triangleFilter->GetOutput();
- polys->Register(NULL);
- surface->SetVtkPolyData(polys);
- }
- surfaceWriter->SetInput( surface );
- surfaceWriter->SetFileName( finalFileName.c_str() );
- surfaceWriter->GetVtkWriter()->SetFileTypeToBinary();
- surfaceWriter->Write();
- }
- else if(extension == ".vtp")
+ finalFileName += extension;
+ if(extension == ".stl" )
+ {
+ mitk::SurfaceVtkWriter<vtkSTLWriter>::Pointer surfaceWriter = mitk::SurfaceVtkWriter<vtkSTLWriter>::New();
+
+ // check if surface actually consists of triangles; if not, the writer will not do anything; so, convert to triangles...
+ vtkPolyData* polys = surface->GetVtkPolyData();
+ if( polys->GetNumberOfStrips() > 0 )
{
- mitk::SurfaceVtkWriter<vtkXMLPolyDataWriter>::Pointer surfaceWriter = mitk::SurfaceVtkWriter<vtkXMLPolyDataWriter>::New();
- surfaceWriter->SetInput( surface );
- surfaceWriter->SetFileName( finalFileName.c_str() );
- surfaceWriter->GetVtkWriter()->SetDataModeToBinary();
- surfaceWriter->Write();
- }
- else if(extension == ".vtk")
- {
- mitk::SurfaceVtkWriter<vtkPolyDataWriter>::Pointer surfaceWriter = mitk::SurfaceVtkWriter<vtkPolyDataWriter>::New();
- surfaceWriter->SetInput( surface );
- surfaceWriter->SetFileName( finalFileName.c_str() );
- surfaceWriter->Write();
- }
- else
- {
- // file extension not suitable for writing specified data type
- MITK_ERROR << "File extension is not suitable for writing'" << finalFileName;
- mitkThrow() << "An exception occured during writing the file " << finalFileName <<
- ". File extension " << extension << " is not suitable for writing.";
+ vtkSmartPointer<vtkTriangleFilter> triangleFilter = vtkSmartPointer<vtkTriangleFilter>::New();
+ triangleFilter->SetInput(polys);
+ triangleFilter->Update();
+ polys = triangleFilter->GetOutput();
+ polys->Register(NULL);
+ surface->SetVtkPolyData(polys);
}
+ surfaceWriter->SetInput( surface );
+ surfaceWriter->SetFileName( finalFileName.c_str() );
+ surfaceWriter->GetVtkWriter()->SetFileTypeToBinary();
+ surfaceWriter->Write();
+ }
+ else if(extension == ".vtp")
+ {
+ mitk::SurfaceVtkWriter<vtkXMLPolyDataWriter>::Pointer surfaceWriter = mitk::SurfaceVtkWriter<vtkXMLPolyDataWriter>::New();
+ surfaceWriter->SetInput( surface );
+ surfaceWriter->SetFileName( finalFileName.c_str() );
+ surfaceWriter->GetVtkWriter()->SetDataModeToBinary();
+ surfaceWriter->Write();
+ }
+ else if(extension == ".vtk")
+ {
+ mitk::SurfaceVtkWriter<vtkPolyDataWriter>::Pointer surfaceWriter = mitk::SurfaceVtkWriter<vtkPolyDataWriter>::New();
+ surfaceWriter->SetInput( surface );
+ surfaceWriter->SetFileName( finalFileName.c_str() );
+ surfaceWriter->Write();
+ }
+ else
+ {
+ // file extension not suitable for writing specified data type
+ MITK_ERROR << "File extension is not suitable for writing'" << finalFileName;
+ mitkThrow() << "An exception occured during writing the file " << finalFileName <<
+ ". File extension " << extension << " is not suitable for writing.";
+ }
}
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();
+ 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;
-}
+ }
-bool IOUtil::SavePointSet(PointSet::Pointer pointset, const std::string path)
-{
+ bool IOUtil::SavePointSet(PointSet::Pointer pointset, const std::string path)
+ {
mitk::PointSetWriter::Pointer pointSetWriter = mitk::PointSetWriter::New();
std::string dir = itksys::SystemTools::GetFilenamePath( path );
@@ -290,89 +290,153 @@ bool IOUtil::SavePointSet(PointSet::Pointer pointset, const std::string path)
if (extension == "") // if no extension has been entered manually into the filename
{
- MITK_WARN << extension << " extension is not set. Extension set to default: " << finalFileName
- << DEFAULTPOINTSETEXTENSION;
- extension = DEFAULTPOINTSETEXTENSION;
+ MITK_WARN << extension << " extension is not set. Extension set to default: " << finalFileName
+ << DEFAULTPOINTSETEXTENSION;
+ extension = DEFAULTPOINTSETEXTENSION;
}
// check if extension is valid
if (!pointSetWriter->IsExtensionValid(extension))
{
- MITK_WARN << extension << " extension is unknown. Extension set to default: " << finalFileName
- << DEFAULTPOINTSETEXTENSION;
- extension = DEFAULTPOINTSETEXTENSION;
+ MITK_WARN << extension << " extension is unknown. Extension set to default: " << finalFileName
+ << DEFAULTPOINTSETEXTENSION;
+ extension = DEFAULTPOINTSETEXTENSION;
}
try
{
- pointSetWriter->SetInput( pointset );
- finalFileName += extension;
- pointSetWriter->SetFileName( finalFileName.c_str() );
- pointSetWriter->Update();
+ pointSetWriter->SetInput( pointset );
+ finalFileName += extension;
+ pointSetWriter->SetFileName( finalFileName.c_str() );
+ pointSetWriter->Update();
}
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();
+ 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;
-}
+ }
-bool IOUtil::SaveBaseData( mitk::BaseData::Pointer data, const std::string& path )
-{
+ bool IOUtil::SaveBaseData( mitk::BaseData* 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();
+ std::string className = data->GetNameOfClass();
+
+ MITK_INFO<<className;
bool writerFound = false;
- for (mitk::CoreObjectFactory::FileWriterList::iterator it = fileWriters.begin() ; it != fileWriters.end() ; ++it)
+ //########### Check if we can save as standard image type via itkImageWriter
+ mitk::Image::Pointer image = dynamic_cast<mitk::Image*>(data);
+ if ( image.IsNotNull() && (className.find("Image")==0 || (className.find("SeedsImage")==0 ) ) )
+ {
+ MITK_INFO<<"SaveImage";
+ try{
+ SaveImage(image,finalFileName + extension);
+ writerFound=true;
+ }
+ 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();
+ }
+ }
+ //########### End Check if we can save as standard image type via itkImageWriter
+
+ //########### Check if we can save as standard pointset type via mitkPointSetWriter
+ mitk::PointSet::Pointer pointset = dynamic_cast<mitk::PointSet*>(data);
+ if(pointset.IsNotNull() && (!writerFound))
{
- if ( (*it)->CanWriteBaseDataType(data) )
- {
- writerFound = true;
+ try{
+ SavePointSet(pointset, finalFileName + extension);
+ writerFound=true;
+ }
+ 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();
+ }
+ }
+ //########### End Check if we can save as standard pointset type via mitkPointSetWriter
- // 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;
- }
- }
+ //########### Check if we can save as standard surface type via mitkVtkSurfaceWriter
+ mitk::Surface::Pointer surface = dynamic_cast<mitk::Surface*>(data);
+ if(surface.IsNotNull() && (!writerFound))
+ {
+ try{
+ SaveSurface(surface, finalFileName + extension);
+ writerFound=true;
+ }
+ 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();
+ }
+ }
+ //########### End Check if we can save as standard surface type via mitkVtkSurfaceWriter
- finalFileName = dir + "/" + baseFilename + extension;
- try
- {
- (*it)->SetFileName( finalFileName.c_str() );
- (*it)->DoWrite( data );
- }
- catch( std::exception& e )
+ //########### None standard data type was found, try to save with extensions.
+ // now try the file writers provided by the CoreObjectFactory
+ if(!writerFound)
+ {
+ MITK_INFO<<"looking for writer for "<<extension;
+ mitk::CoreObjectFactory::FileWriterList fileWriters = mitk::CoreObjectFactory::GetInstance()->GetFileWriters();
+
+ for (mitk::CoreObjectFactory::FileWriterList::iterator it = fileWriters.begin() ; it != fileWriters.end() ; ++it)
+ {
+ MITK_INFO<<(*it)->GetFileExtension();
+ 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_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();
+ MITK_WARN << extension << " extension is unknown";
+ continue;
+ //return false;
}
- return true;
+ }
+
+ 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 false;
}
return true;
-}
+ }
}
diff --git a/Core/Code/IO/mitkIOUtil.h b/Core/Code/IO/mitkIOUtil.h
index a21b282..1bf6e63 100644
--- a/Core/Code/IO/mitkIOUtil.h
+++ b/Core/Code/IO/mitkIOUtil.h
@@ -124,7 +124,7 @@ public:
* @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);
+ static bool SaveBaseData(mitk::BaseData* data, const std::string& path);
/**
* @brief SaveSurface Convenience method to save an arbitrary mitkSurface.
diff --git a/Plugins/org.mitk.gui.qt.cmdlinemodules/src/internal/QmitkCmdLineModuleProgressWidget.cpp b/Plugins/org.mitk.gui.qt.cmdlinemodules/src/internal/QmitkCmdLineModuleProgressWidget.cpp
index 8387851..bc3e6b7 100644
--- a/Plugins/org.mitk.gui.qt.cmdlinemodules/src/internal/QmitkCmdLineModuleProgressWidget.cpp
+++ b/Plugins/org.mitk.gui.qt.cmdlinemodules/src/internal/QmitkCmdLineModuleProgressWidget.cpp
@@ -44,18 +44,17 @@ See LICENSE.txt or http://www.mitk.org for details.
#include <QmitkCommonFunctionality.h>
#include <QmitkCustomVariants.h>
#include "QmitkCmdLineModuleGui.h"
-#include "QmitkIOUtil.h"
//-----------------------------------------------------------------------------
QmitkCmdLineModuleProgressWidget::QmitkCmdLineModuleProgressWidget(QWidget *parent)
: QWidget(parent)
-, m_ModuleManager(NULL)
-, m_DataStorage(NULL)
-, m_TemporaryDirectoryName("")
-, m_UI(new Ui::QmitkCmdLineModuleProgressWidget)
-, m_Layout(NULL)
-, m_ModuleFrontEnd(NULL)
-, m_FutureWatcher(NULL)
+ , m_ModuleManager(NULL)
+ , m_DataStorage(NULL)
+ , m_TemporaryDirectoryName("")
+ , m_UI(new Ui::QmitkCmdLineModuleProgressWidget)
+ , m_Layout(NULL)
+ , m_ModuleFrontEnd(NULL)
+ , m_FutureWatcher(NULL)
{
m_UI->setupUi(this);
m_UI->m_RemoveButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_TitleBarCloseButton));
@@ -498,11 +497,11 @@ void QmitkCmdLineModuleProgressWidget::Run()
qDebug() << "QmitkCmdLineModuleProgressWidget::Run(), swapping " << outputFileName << " to " << newOutputFileAbsolutePath;
QMessageBox msgBox;
- msgBox.setText("The output directory is the same as the application installation directory");
- msgBox.setInformativeText(tr("Output file:\n%1\n\nwill be swapped to\n%2").arg(outputFileName).arg(newOutputFileAbsolutePath));
- msgBox.setStandardButtons(QMessageBox::Ok);
- msgBox.setIcon(QMessageBox::Warning);
- msgBox.exec();
+ msgBox.setText("The output directory is the same as the application installation directory");
+ msgBox.setInformativeText(tr("Output file:\n%1\n\nwill be swapped to\n%2").arg(outputFileName).arg(newOutputFileAbsolutePath));
+ msgBox.setStandardButtons(QMessageBox::Ok);
+ msgBox.setIcon(QMessageBox::Warning);
+ msgBox.exec();
m_ModuleFrontEnd->setValue(parameterName, newOutputFileAbsolutePath, ctkCmdLineModuleFrontend::DisplayRole);
}
@@ -551,27 +550,28 @@ void QmitkCmdLineModuleProgressWidget::Run()
bool writeSucess = false;
foreach (QString extension, parameter.fileExtensions())
{
- fileName = fileNameBase + "." + extension;
+ fileName = fileNameBase + "." + extension;
try
{
- if (mitk::IOUtil::SaveBaseData( image, fileName.toStdString() ))
- {
- writeSucess = true;
- break;
- }
+ if (mitk::IOUtil::SaveBaseData( image, fileName.toStdString() ))
+ {
+ writeSucess = true;
+ break;
+ }
}
catch(std::exception& e){}
}
if(!writeSucess)
{
fileName = fileNameBase + ".nii";
+ MITK_INFO<<fileName.toStdString();
try
{
- if (mitk::IOUtil::SaveBaseData( image, fileName.toStdString() ))
- {
- writeSucess = true;
- break;
- }
+ if (mitk::IOUtil::SaveBaseData( image, fileName.toStdString() ))
+ {
+ writeSucess = true;
+ break;
+ }
}
catch(std::exception& e){}
}

File Metadata

Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
977

Event Timeline

fixed problem