VTK  9.7.1
vtkMNIObjectWriter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright (c) 2006 Atamai, Inc.
3 // SPDX-License-Identifier: BSD-3-Clause
24 #ifndef vtkMNIObjectWriter_h
25 #define vtkMNIObjectWriter_h
26 
27 #include "vtkIOMINCModule.h" // For export macro
28 #include "vtkWriter.h"
29 
30 VTK_ABI_NAMESPACE_BEGIN
31 class vtkMapper;
32 class vtkProperty;
33 class vtkLookupTable;
34 class vtkPolyData;
35 class vtkFloatArray;
36 class vtkIntArray;
37 class vtkPoints;
38 struct vtkMNIObjectWriterFunctor;
39 
40 class VTKIOMINC_EXPORT vtkMNIObjectWriter : public vtkWriter
41 {
42 public:
43  vtkTypeMacro(vtkMNIObjectWriter, vtkWriter);
44 
45  static vtkMNIObjectWriter* New();
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
51  virtual const char* GetFileExtensions() { return ".obj"; }
52 
56  virtual const char* GetDescriptiveName() { return "MNI object"; }
57 
59 
63  virtual void SetProperty(vtkProperty* property);
64  virtual vtkProperty* GetProperty() { return this->Property; }
66 
68 
73  virtual void SetMapper(vtkMapper* mapper);
74  virtual vtkMapper* GetMapper() { return this->Mapper; }
76 
78 
82  virtual void SetLookupTable(vtkLookupTable* table);
83  virtual vtkLookupTable* GetLookupTable() { return this->LookupTable; }
85 
87 
93 
95 
98  vtkSetFilePathMacro(FileName);
99  vtkGetFilePathMacro(FileName);
101 
103 
106  vtkSetClampMacro(FileType, int, VTK_ASCII, VTK_BINARY);
107  vtkGetMacro(FileType, int);
108  void SetFileTypeToASCII() { this->SetFileType(VTK_ASCII); }
109  void SetFileTypeToBinary() { this->SetFileType(VTK_BINARY); }
111 
112 protected:
114  ~vtkMNIObjectWriter() override;
115 
119 
120  ostream* OutputStream;
121 
122  int WriteObjectType(int objType);
123  int WriteValues(vtkDataArray* array);
124  int WriteIdValue(vtkIdType value);
125  int WriteNewline();
126 
127  int WriteProperty(vtkProperty* property);
128  int WriteLineThickness(vtkProperty* property);
129  int WritePoints(vtkPolyData* polyData);
130  int WriteNormals(vtkPolyData* polyData);
131  int WriteColors(vtkProperty* property, vtkMapper* mapper, vtkPolyData* data);
132  int WriteCells(vtkPolyData* data, int cellType);
133 
134  int WritePolygonObject(vtkPolyData* output);
135  int WriteLineObject(vtkPolyData* output);
136 
137  bool WriteDataAndReturn() override;
138 
139  char* FileName;
140 
141  int FileType;
142 
143  int FillInputPortInformation(int port, vtkInformation* info) override;
144 
145  ostream* OpenFile();
146  void CloseFile(ostream* fp);
147 
148 private:
149  vtkMNIObjectWriter(const vtkMNIObjectWriter&) = delete;
150  void operator=(const vtkMNIObjectWriter&) = delete;
151 
152  friend struct vtkMNIObjectWriterFunctor;
153 };
154 
155 VTK_ABI_NAMESPACE_END
156 #endif
Store vtkAlgorithm input/output information.
represent surface properties of a geometric object
Definition: vtkProperty.h:59
virtual vtkLookupTable * GetLookupTable()
Set the lookup table associated with the object.
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:31
map scalar values into colors via a lookup table
virtual const char * GetFileExtensions()
Get the extension for this file format.
int vtkIdType
Definition: vtkType.h:363
virtual vtkProperty * GetProperty()
Set the property associated with the object.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
#define VTK_ASCII
Definition: vtkWriter.h:32
virtual const char * GetDescriptiveName()
Get the name of this file format.
A writer for MNI surface mesh files.
abstract class to write data to file(s)
Definition: vtkWriter.h:35
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:35
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkDataObject * GetInput()
vtkLookupTable * LookupTable
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
#define VTK_BINARY
Definition: vtkWriter.h:33
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:77
void SetFileTypeToBinary()
Specify file type (ASCII or BINARY) for vtk data file.
virtual vtkMapper * GetMapper()
Set the mapper associated with the object.
static vtkAlgorithm * New()
virtual bool WriteDataAndReturn()
void SetFileTypeToASCII()
Specify file type (ASCII or BINARY) for vtk data file.
represent and manipulate 3D points
Definition: vtkPoints.h:30