00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision: 10025 $ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #include "mitkUnstructuredGridVtkWriter.h" 00019 #include "mitkUnstructuredGridVtkWriter.txx" 00020 00021 #include <vtkUnstructuredGridWriter.h> 00022 #include <vtkXMLUnstructuredGridWriter.h> 00023 00024 namespace mitk { 00025 00026 00027 template<> 00028 void UnstructuredGridVtkWriter<vtkUnstructuredGridWriter>::SetDefaultExtension() 00029 { 00030 m_Extension = ".vtk"; 00031 m_WriterWriteHasReturnValue = false; 00032 } 00033 00034 template<> 00035 void UnstructuredGridVtkWriter<vtkXMLUnstructuredGridWriter>::SetDefaultExtension() 00036 { 00037 m_Extension = ".vtu"; 00038 m_WriterWriteHasReturnValue = true; 00039 } 00040 00041 template<> 00042 void UnstructuredGridVtkWriter<vtkXMLUnstructuredGridWriter>::ExecuteWrite( VtkWriterType* m_VtkWriter, vtkTransformFilter* transformPointSet ) 00043 { 00044 if (!m_VtkWriter->Write()) 00045 { 00046 transformPointSet->Delete(); 00047 throw std::ios_base::failure("Error during unstructured grid writing."); 00048 } 00049 } 00050 00051 template<> 00052 std::vector<std::string> UnstructuredGridVtkWriter<vtkUnstructuredGridWriter>::GetPossibleFileExtensions() 00053 { 00054 std::vector<std::string> possibleFileExtensions; 00055 possibleFileExtensions.push_back(".vtk"); 00056 return possibleFileExtensions; 00057 } 00058 00059 template<> 00060 std::vector<std::string> UnstructuredGridVtkWriter<vtkXMLUnstructuredGridWriter>::GetPossibleFileExtensions() 00061 { 00062 std::vector<std::string> possibleFileExtensions; 00063 possibleFileExtensions.push_back(".vtu"); 00064 return possibleFileExtensions; 00065 } 00066 00067 template class MitkExt_EXPORT UnstructuredGridVtkWriter<vtkUnstructuredGridWriter>; 00068 00069 template class MitkExt_EXPORT UnstructuredGridVtkWriter<vtkXMLUnstructuredGridWriter>; 00070 00071 } 00072