Medical Imaging Interaction Toolkit  2023.04.00
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkSurfaceVtkWriter_h
14 #define mitkSurfaceVtkWriter_h
15 
16 #include <iomanip>
17 
18 #include <vtkPolyDataWriter.h>
19 #include <vtkSTLWriter.h>
20 #include <vtkXMLPolyDataWriter.h>
21 
22 #include <MitkLegacyIOExports.h>
23 #include <itkProcessObject.h>
25 #include <mitkPointSet.h>
26 #include <mitkSurface.h>
27 
28 #include <vtkSmartPointer.h>
29 
30 class vtkTransformPolyDataFilter;
31 
32 namespace mitk
33 {
50  template <class VTKWRITER>
52  {
53  public:
55 
56  itkFactorylessNewMacro(Self);
57 
58  itkCloneMacro(Self);
59 
61 
62  typedef VTKWRITER VtkWriterType;
63 
68  itkSetStringMacro(FileName);
69 
73  itkGetStringMacro(FileName);
74 
83  itkSetStringMacro(Extension);
84 
90  itkGetStringMacro(Extension);
91 
98  void SetDefaultExtension();
99 
103  itkSetStringMacro(FilePrefix);
104 
108  itkGetStringMacro(FilePrefix);
109 
113  itkSetStringMacro(FilePattern);
114 
118  itkGetStringMacro(FilePattern);
119 
124  void SetInput(mitk::Surface *input);
125 
129  const mitk::Surface *GetInput();
130 
134  std::string GetFileExtension() override;
135 
139  bool CanWriteDataType(DataNode *) override;
140 
144  std::string GetWritenMIMEType() override;
145 
146  using Superclass::SetInput;
150  virtual void SetInput(DataNode *);
151 
152  VtkWriterType *GetVtkWriter() { return m_VtkWriter; }
156  std::vector<std::string> GetPossibleFileExtensions() override;
157 
158  std::string GetSupportedBaseData() const override { return Surface::GetStaticNameOfClass(); }
159  const char *GetDefaultFilename() override;
160  const char *GetFileDialogPattern() override;
161  const char *GetDefaultExtension() override;
162  bool CanWriteBaseDataType(BaseData::Pointer data) override;
163  void DoWrite(BaseData::Pointer data) override;
164 
165  protected:
170 
174  ~SurfaceVtkWriter() override;
175 
176  void GenerateData() override;
177 
178  void ExecuteWrite(VtkWriterType *vtkWriter);
179 
180  std::string m_FileName;
181 
182  std::string m_FilePrefix;
183 
184  std::string m_FilePattern;
185 
186  std::string m_Extension;
187 
188  std::string m_MimeType;
189 
190  vtkSmartPointer<VtkWriterType> m_VtkWriter;
191 
193  };
194 
195 #ifndef MitkLegacyIO_EXPORTS
196  extern template class SurfaceVtkWriter<vtkSTLWriter>;
197  extern template class SurfaceVtkWriter<vtkPolyDataWriter>;
198  extern template class SurfaceVtkWriter<vtkXMLPolyDataWriter>;
199 #endif
200 }
201 
202 #endif
mitk::SurfaceVtkWriter::m_FileName
std::string m_FileName
Definition: mitkSurfaceVtkWriter.h:180
mitk::SurfaceVtkWriter::m_VtkWriter
vtkSmartPointer< VtkWriterType > m_VtkWriter
Definition: mitkSurfaceVtkWriter.h:190
mitk::SurfaceVtkWriter::GetSupportedBaseData
std::string GetSupportedBaseData() const override
Definition: mitkSurfaceVtkWriter.h:158
mitk::SurfaceVtkWriter::m_FilePattern
std::string m_FilePattern
Definition: mitkSurfaceVtkWriter.h:184
itk::SmartPointer< Self >
MitkLegacyIOExports.h
mitk::FileWriter
Interface class of writers that write data to files.
Definition: mitkFileWriter.h:26
mitk::Surface
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:28
mitk::SurfaceVtkWriter::m_MimeType
std::string m_MimeType
Definition: mitkSurfaceVtkWriter.h:188
mitkPointSet.h
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitkSurface.h
mitk::SurfaceVtkWriter::VtkWriterType
VTKWRITER VtkWriterType
Definition: mitkSurfaceVtkWriter.h:62
mitk::SurfaceVtkWriter::mitkWriterMacro
mitkWriterMacro
Definition: mitkSurfaceVtkWriter.h:58
mitk::SurfaceVtkWriter::m_FilePrefix
std::string m_FilePrefix
Definition: mitkSurfaceVtkWriter.h:182
mitkFileWriterWithInformation.h
mitk::SurfaceVtkWriter
VTK-based writer for mitk::Surface.
Definition: mitkSurfaceVtkWriter.h:51
MITKLEGACYIO_EXPORT
#define MITKLEGACYIO_EXPORT
Definition: MitkLegacyIOExports.h:15
mitk::SurfaceVtkWriter::m_WriterWriteHasReturnValue
bool m_WriterWriteHasReturnValue
Definition: mitkSurfaceVtkWriter.h:192
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitk::SurfaceVtkWriter::GetVtkWriter
VtkWriterType * GetVtkWriter()
Definition: mitkSurfaceVtkWriter.h:152
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
mitk::FileWriterWithInformation
Interface for FileWriters with extra information. Should be merged into FileWriter.
Definition: mitkFileWriterWithInformation.h:27
mitk::SurfaceVtkWriter::m_Extension
std::string m_Extension
Definition: mitkSurfaceVtkWriter.h:186
mitk::Surface::GetStaticNameOfClass
static const char * GetStaticNameOfClass()
Definition: mitkSurface.h:33