Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkSurfaceVtkWriter.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef _MITK_SURFACE_VTK_WRITER__H_
18 #define _MITK_SURFACE_VTK_WRITER__H_
19 
20 #include <iomanip>
21 
22 #include <vtkPolyDataWriter.h>
23 #include <vtkSTLWriter.h>
24 #include <vtkXMLPolyDataWriter.h>
25 
26 #include <MitkLegacyIOExports.h>
27 #include <itkProcessObject.h>
29 #include <mitkPointSet.h>
30 #include <mitkSurface.h>
31 
32 #include <vtkSmartPointer.h>
33 
34 class vtkTransformPolyDataFilter;
35 
36 namespace mitk
37 {
54  template <class VTKWRITER>
56  {
57  public:
59 
60  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
61 
63 
64  typedef VTKWRITER VtkWriterType;
65 
70  itkSetStringMacro(FileName);
71 
75  itkGetStringMacro(FileName);
76 
85  itkSetStringMacro(Extension);
86 
92  itkGetStringMacro(Extension);
93 
100  void SetDefaultExtension();
101 
105  itkSetStringMacro(FilePrefix);
106 
110  itkGetStringMacro(FilePrefix);
111 
115  itkSetStringMacro(FilePattern);
116 
120  itkGetStringMacro(FilePattern);
121 
126  void SetInput(mitk::Surface *input);
127 
131  const mitk::Surface *GetInput();
132 
136  virtual std::string GetFileExtension() override;
137 
141  virtual bool CanWriteDataType(DataNode *) override;
142 
146  virtual std::string GetWritenMIMEType() override;
147 
148  using Superclass::SetInput;
152  virtual void SetInput(DataNode *);
153 
154  VtkWriterType *GetVtkWriter() { return m_VtkWriter; }
158  virtual std::vector<std::string> GetPossibleFileExtensions() override;
159 
160  virtual std::string GetSupportedBaseData() const override { return Surface::GetStaticNameOfClass(); }
161  virtual const char *GetDefaultFilename() override;
162  virtual const char *GetFileDialogPattern() override;
163  virtual const char *GetDefaultExtension() override;
164  virtual bool CanWriteBaseDataType(BaseData::Pointer data) override;
165  virtual void DoWrite(BaseData::Pointer data) override;
166 
167  protected:
172 
176  virtual ~SurfaceVtkWriter();
177 
178  virtual void GenerateData() override;
179 
180  void ExecuteWrite(VtkWriterType *vtkWriter);
181 
182  std::string m_FileName;
183 
184  std::string m_FilePrefix;
185 
186  std::string m_FilePattern;
187 
188  std::string m_Extension;
189 
190  std::string m_MimeType;
191 
192  vtkSmartPointer<VtkWriterType> m_VtkWriter;
193 
195  };
196 
197 #ifndef MitkLegacyIO_EXPORTS
198  extern template class SurfaceVtkWriter<vtkSTLWriter>;
199  extern template class SurfaceVtkWriter<vtkPolyDataWriter>;
200  extern template class SurfaceVtkWriter<vtkXMLPolyDataWriter>;
201 #endif
202 }
203 
204 #endif //_MITK_SURFACE_VTK_WRITER__H_
virtual std::string GetSupportedBaseData() const override
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:32
#define MITKLEGACYIO_EXPORT
VTK-based writer for mitk::Surface.
STL namespace.
DataCollection - Class to facilitate loading/accessing structured data.
Interface for FileWriters with extra information. Should be merged into FileWriter.
vtkSmartPointer< VtkWriterType > m_VtkWriter
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
Interface class of writers that write data to files.
itk::ProcessObject Superclass
#define mitkWriterMacro
static const char * GetStaticNameOfClass()
Definition: mitkSurface.h:37
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66