VTK
vtkMNIObjectWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMNIObjectWriter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*=========================================================================
16 
17 Copyright (c) 2006 Atamai, Inc.
18 
19 Use, modification and redistribution of the software, in source or
20 binary forms, are permitted provided that the following terms and
21 conditions are met:
22 
23 1) Redistribution of the source code, in verbatim or modified
24  form, must retain the above copyright notice, this license,
25  the following disclaimer, and any notices that refer to this
26  license and/or the following disclaimer.
27 
28 2) Redistribution in binary form must include the above copyright
29  notice, a copy of this license and the following disclaimer
30  in the documentation or with other materials provided with the
31  distribution.
32 
33 3) Modified copies of the source code must be clearly marked as such,
34  and must not be misrepresented as verbatim copies of the source code.
35 
36 THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS"
37 WITHOUT EXPRESSED OR IMPLIED WARRANTY INCLUDING, BUT NOT LIMITED TO,
38 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39 PURPOSE. IN NO EVENT SHALL ANY COPYRIGHT HOLDER OR OTHER PARTY WHO MAY
40 MODIFY AND/OR REDISTRIBUTE THE SOFTWARE UNDER THE TERMS OF THIS LICENSE
41 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES
42 (INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA OR DATA BECOMING INACCURATE
43 OR LOSS OF PROFIT OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF
44 THE USE OR INABILITY TO USE THE SOFTWARE, EVEN IF ADVISED OF THE
45 POSSIBILITY OF SUCH DAMAGES.
46 
47 =========================================================================*/
68 #ifndef vtkMNIObjectWriter_h
69 #define vtkMNIObjectWriter_h
70 
71 #include "vtkIOMINCModule.h" // For export macro
72 #include "vtkWriter.h"
73 
74 class vtkMapper;
75 class vtkProperty;
76 class vtkLookupTable;
77 class vtkPolyData;
78 class vtkFloatArray;
79 class vtkIntArray;
80 class vtkPoints;
81 
82 class VTKIOMINC_EXPORT vtkMNIObjectWriter : public vtkWriter
83 {
84 public:
86 
88  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
89 
93  virtual const char* GetFileExtensions() {
94  return ".obj"; }
95 
99  virtual const char* GetDescriptiveName() {
100  return "MNI object"; }
101 
103 
107  virtual void SetProperty(vtkProperty *property);
108  virtual vtkProperty *GetProperty() { return this->Property; };
110 
112 
117  virtual void SetMapper(vtkMapper *mapper);
118  virtual vtkMapper *GetMapper() { return this->Mapper; };
120 
122 
126  virtual void SetLookupTable(vtkLookupTable *table);
127  virtual vtkLookupTable *GetLookupTable() { return this->LookupTable; };
129 
131 
137 
139 
142  vtkSetStringMacro(FileName);
143  vtkGetStringMacro(FileName);
145 
147 
150  vtkSetClampMacro(FileType,int,VTK_ASCII,VTK_BINARY);
151  vtkGetMacro(FileType,int);
152  void SetFileTypeToASCII() {this->SetFileType(VTK_ASCII);};
153  void SetFileTypeToBinary() {this->SetFileType(VTK_BINARY);};
155 
156 protected:
159 
163 
164  ostream *OutputStream;
165 
166  int WriteObjectType(int objType);
170 
171  int WriteProperty(vtkProperty *property);
173  int WritePoints(vtkPolyData *polyData);
174  int WriteNormals(vtkPolyData *polyData);
175  int WriteColors(vtkProperty *property, vtkMapper *mapper, vtkPolyData *data);
177 
180 
181  void WriteData();
182 
183  char* FileName;
184 
185  int FileType;
186 
188 
189  ostream *OpenFile();
190  void CloseFile(ostream *fp);
191 
192 private:
193  vtkMNIObjectWriter(const vtkMNIObjectWriter&) VTK_DELETE_FUNCTION;
194  void operator=(const vtkMNIObjectWriter&) VTK_DELETE_FUNCTION;
195 
196 };
197 
198 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:42
a simple class to control print indentation
Definition: vtkIndent.h:40
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:46
map scalar values into colors via a lookup table
A writer for MNI surface mesh files.
vtkPolyData * GetInput(int port)
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
virtual void SetMapper(vtkMapper *mapper)
Set the mapper associated with the object.
int WriteLineObject(vtkPolyData *output)
int WritePolygonObject(vtkPolyData *output)
int WriteObjectType(int objType)
int WriteNormals(vtkPolyData *polyData)
virtual vtkMapper * GetMapper()
ostream * OpenFile()
int WriteProperty(vtkProperty *property)
virtual vtkLookupTable * GetLookupTable()
virtual void SetProperty(vtkProperty *property)
Set the property associated with the object.
virtual void SetLookupTable(vtkLookupTable *table)
Set the lookup table associated with the object.
int WritePoints(vtkPolyData *polyData)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkMNIObjectWriter * New()
vtkPolyData * GetInput()
Get the input to this writer.
int WriteValues(vtkDataArray *array)
virtual const char * GetDescriptiveName()
Get the name of this file format.
int WriteIdValue(vtkIdType value)
int WriteLineThickness(vtkProperty *property)
void CloseFile(ostream *fp)
virtual vtkProperty * GetProperty()
int WriteCells(vtkPolyData *data, int cellType)
virtual const char * GetFileExtensions()
Get the entension for this file format.
int WriteColors(vtkProperty *property, vtkMapper *mapper, vtkPolyData *data)
vtkLookupTable * LookupTable
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:92
represent and manipulate 3D points
Definition: vtkPoints.h:40
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
represent surface properties of a geometric object
Definition: vtkProperty.h:65
abstract class to write data to file(s)
Definition: vtkWriter.h:43
CellTypeInDataSet cellType(vtkDataSet *input)
@ info
Definition: vtkX3D.h:376
@ value
Definition: vtkX3D.h:220
@ port
Definition: vtkX3D.h:447
@ data
Definition: vtkX3D.h:315
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
int vtkIdType
Definition: vtkType.h:287
#define VTK_BINARY
Definition: vtkWriter.h:40
#define VTK_ASCII
Definition: vtkWriter.h:39