Medical Imaging Interaction Toolkit  2016.11.0
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,
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_PlanarFigure_WRITER__H_
18 #define _MITK_PlanarFigure_WRITER__H_
19 
21 #include <itkProcessObject.h>
23 #include <mitkPlanarFigure.h>
24 
25 class TiXmlElement;
26 namespace mitk
27 {
35  {
36  public:
38 
40 
41  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
42 
44 
45  typedef InputType::Pointer InputTypePointer;
46 
51  itkSetStringMacro(FileName);
52 
56  itkGetStringMacro(FileName);
57 
61  itkSetStringMacro(FilePrefix);
62 
66  itkGetStringMacro(FilePrefix);
67 
71  itkSetStringMacro(FilePattern);
72 
76  itkGetStringMacro(FilePattern);
77 
78  using Superclass::SetInput;
79 
84  void SetInput(InputType *input);
85 
92  void SetInput(const unsigned int &num, InputType *input);
93 
97  PlanarFigure *GetInput();
98 
103  PlanarFigure *GetInput(const unsigned int &num);
104 
108  virtual std::vector<std::string> GetPossibleFileExtensions() override;
109 
113  virtual std::string GetFileExtension() override;
114 
118  virtual bool CanWriteDataType(DataNode *) override;
119 
123  virtual std::string GetWritenMIMEType() override;
124 
128  virtual void SetInput(DataNode *);
129 
130  virtual std::string GetSupportedBaseData() const override;
131 
135  itkGetConstMacro(Success, bool);
136 
137  virtual const char *GetDefaultFilename() override { return "PlanarFigure.pf"; }
138  virtual const char *GetFileDialogPattern() override { return "Planar Figure Files (*.pf)"; }
139  virtual const char *GetDefaultExtension() override { return ".pf"; }
140  virtual bool CanWriteBaseDataType(BaseData::Pointer data) override
141  {
142  return dynamic_cast<mitk::PlanarFigure *>(data.GetPointer());
143  }
144  virtual void DoWrite(BaseData::Pointer data) override
145  {
146  if (CanWriteBaseDataType(data))
147  {
148  this->SetInput(dynamic_cast<mitk::PlanarFigure *>(data.GetPointer()));
149  this->Update();
150  }
151  }
152 
157  virtual void ReleaseMemory() override;
158 
159  protected:
164 
168  virtual ~PlanarFigureWriter();
169 
173  virtual void GenerateData() override;
174 
180  virtual void ResizeInputs(const unsigned int &num);
181 
189  TiXmlElement *CreateXMLVectorElement(const char *name, itk::FixedArray<mitk::ScalarType, 3> v);
190 
191  std::string m_FileName;
192  std::string m_FilePrefix;
193  std::string m_FilePattern;
194  std::string m_Extension;
195  std::string m_MimeType;
196  bool m_Success;
197  };
198 }
199 
200 #endif
virtual bool CanWriteBaseDataType(BaseData::Pointer data) override
XML-based writer for mitk::PlanarFigures.
static void Update(vtkPolyData *)
Definition: mitkSurface.cpp:35
STL namespace.
DataCollection - Class to facilitate loading/accessing structured data.
Interface for FileWriters with extra information. Should be merged into FileWriter.
virtual const char * GetDefaultExtension() override
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
virtual const char * GetFileDialogPattern() override
Interface class of writers that write data to files.
itk::ProcessObject Superclass
#define MITKPLANARFIGURE_EXPORT
virtual void DoWrite(BaseData::Pointer data) override
Base-class for geometric planar (2D) figures, such as lines, circles, rectangles, polygons...
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66