00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision: 10863 $ 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 00019 #ifndef _MITK_UNSTRUCTURED_GRID_VTK_WRITER__H_ 00020 #define _MITK_UNSTRUCTURED_GRID_VTK_WRITER__H_ 00021 00022 #include <iomanip> 00023 00024 #include <itkProcessObject.h> 00025 #include <mitkFileWriter.h> 00026 #include <mitkPointSet.h> 00027 #include <mitkUnstructuredGrid.h> 00028 00029 class vtkTransformFilter; 00030 00031 namespace mitk 00032 { 00033 00048 template <class VTKWRITER> 00049 class UnstructuredGridVtkWriter : public mitk::FileWriter 00050 { 00051 public: 00052 00053 mitkClassMacro( UnstructuredGridVtkWriter, mitk::FileWriter ); 00054 00055 itkNewMacro( Self ); 00056 00057 mitkWriterMacro; 00058 00059 typedef VTKWRITER VtkWriterType; 00060 00065 itkSetStringMacro( FileName ); 00066 00070 itkGetStringMacro( FileName ); 00071 00080 itkSetStringMacro( Extension ); 00081 00087 itkGetStringMacro( Extension ); 00088 00095 void SetDefaultExtension(); 00096 00100 itkSetStringMacro( FilePrefix ); 00101 00105 itkGetStringMacro( FilePrefix ); 00106 00110 itkSetStringMacro( FilePattern ); 00111 00115 itkGetStringMacro( FilePattern ); 00116 00121 void SetInput( mitk::UnstructuredGrid* input ); 00122 00126 const mitk::UnstructuredGrid* GetInput(); 00127 00131 virtual std::vector<std::string> GetPossibleFileExtensions(); 00132 00136 virtual std::string GetFileExtension(); 00137 00141 virtual bool CanWriteDataType( DataNode* ); 00142 00146 virtual std::string GetWritenMIMEType(); 00147 00151 virtual void SetInput( DataNode* ); 00152 00153 VtkWriterType* GetVtkWriter() 00154 { 00155 return m_VtkWriter; 00156 } 00157 00158 protected: 00159 00163 UnstructuredGridVtkWriter(); 00164 00168 virtual ~UnstructuredGridVtkWriter(); 00169 00170 virtual void GenerateData(); 00171 00172 void ExecuteWrite( VtkWriterType* m_VtkWriter, vtkTransformFilter* transformPointSet ); 00173 00174 std::string m_FileName; 00175 00176 std::string m_FilePrefix; 00177 00178 std::string m_FilePattern; 00179 00180 std::string m_Extension; 00181 00182 std::string m_MimeType; 00183 00184 VtkWriterType* m_VtkWriter; 00185 00186 bool m_WriterWriteHasReturnValue; 00187 }; 00188 00189 } 00190 00191 #endif // _MITK_UNSTRUCTURED_GRID_VTK_WRITER__H_