Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
mitkPlanarFigureWriter.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 _MITK_PlanarFigure_WRITER__H_
14 #define _MITK_PlanarFigure_WRITER__H_
15 
17 #include <itkProcessObject.h>
19 #include <mitkPlanarFigure.h>
20 
21 class TiXmlElement;
22 namespace mitk
23 {
31  {
32  public:
34 
36 
37  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
38 
40 
41  typedef InputType::Pointer InputTypePointer;
42 
47  itkSetStringMacro(FileName);
48 
52  itkGetStringMacro(FileName);
53 
57  itkSetStringMacro(FilePrefix);
58 
62  itkGetStringMacro(FilePrefix);
63 
67  itkSetStringMacro(FilePattern);
68 
72  itkGetStringMacro(FilePattern);
73 
74  using Superclass::SetInput;
75 
80  void SetInput(InputType *input);
81 
88  void SetInput(const unsigned int &num, InputType *input);
89 
93  PlanarFigure *GetInput();
94 
99  PlanarFigure *GetInput(const unsigned int &num);
100 
104  std::vector<std::string> GetPossibleFileExtensions() override;
105 
109  std::string GetFileExtension() override;
110 
114  bool CanWriteDataType(DataNode *) override;
115 
119  std::string GetWritenMIMEType() override;
120 
124  virtual void SetInput(DataNode *);
125 
126  std::string GetSupportedBaseData() const override;
127 
131  itkGetConstMacro(Success, bool);
132 
133  const char *GetDefaultFilename() override { return "PlanarFigure.pf"; }
134  const char *GetFileDialogPattern() override { return "Planar Figure Files (*.pf)"; }
135  const char *GetDefaultExtension() override { return ".pf"; }
137  {
138  return dynamic_cast<mitk::PlanarFigure *>(data.GetPointer());
139  }
140  void DoWrite(BaseData::Pointer data) override
141  {
142  if (CanWriteBaseDataType(data))
143  {
144  this->SetInput(dynamic_cast<mitk::PlanarFigure *>(data.GetPointer()));
145  this->Update();
146  }
147  }
148 
153  void ReleaseMemory() override;
154 
155  protected:
160 
164  ~PlanarFigureWriter() override;
165 
169  void GenerateData() override;
170 
176  virtual void ResizeInputs(const unsigned int &num);
177 
185  TiXmlElement *CreateXMLVectorElement(const char *name, itk::FixedArray<mitk::ScalarType, 3> v);
186 
187  std::string m_FileName;
188  std::string m_FilePrefix;
189  std::string m_FilePattern;
190  std::string m_Extension;
191  std::string m_MimeType;
192  bool m_Success;
193  };
194 }
195 
196 #endif
const char * GetFileDialogPattern() override
XML-based writer for mitk::PlanarFigures.
const char * GetDefaultExtension() override
static void Update(vtkPolyData *)
Definition: mitkSurface.cpp:31
STL namespace.
DataCollection - Class to facilitate loading/accessing structured data.
Interface for FileWriters with extra information. Should be merged into FileWriter.
bool CanWriteBaseDataType(BaseData::Pointer data) override
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
Interface class of writers that write data to files.
void DoWrite(BaseData::Pointer data) override
itk::ProcessObject Superclass
#define MITKPLANARFIGURE_EXPORT
Base-class for geometric planar (2D) figures, such as lines, circles, rectangles, polygons...
Class for nodes of the DataTree.
Definition: mitkDataNode.h:64