VTK  9.3.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 
39 class VTKIOMINC_EXPORT vtkMNIObjectWriter : public vtkWriter
40 {
41 public:
42  vtkTypeMacro(vtkMNIObjectWriter, vtkWriter);
43 
44  static vtkMNIObjectWriter* New();
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
50  virtual const char* GetFileExtensions() { return ".obj"; }
51 
55  virtual const char* GetDescriptiveName() { return "MNI object"; }
56 
58 
62  virtual void SetProperty(vtkProperty* property);
63  virtual vtkProperty* GetProperty() { return this->Property; }
65 
67 
72  virtual void SetMapper(vtkMapper* mapper);
73  virtual vtkMapper* GetMapper() { return this->Mapper; }
75 
77 
81  virtual void SetLookupTable(vtkLookupTable* table);
82  virtual vtkLookupTable* GetLookupTable() { return this->LookupTable; }
84 
86 
92 
94 
97  vtkSetFilePathMacro(FileName);
98  vtkGetFilePathMacro(FileName);
100 
102 
105  vtkSetClampMacro(FileType, int, VTK_ASCII, VTK_BINARY);
106  vtkGetMacro(FileType, int);
107  void SetFileTypeToASCII() { this->SetFileType(VTK_ASCII); }
108  void SetFileTypeToBinary() { this->SetFileType(VTK_BINARY); }
110 
111 protected:
113  ~vtkMNIObjectWriter() override;
114 
118 
119  ostream* OutputStream;
120 
121  int WriteObjectType(int objType);
122  int WriteValues(vtkDataArray* array);
123  int WriteIdValue(vtkIdType value);
124  int WriteNewline();
125 
126  int WriteProperty(vtkProperty* property);
127  int WriteLineThickness(vtkProperty* property);
128  int WritePoints(vtkPolyData* polyData);
129  int WriteNormals(vtkPolyData* polyData);
130  int WriteColors(vtkProperty* property, vtkMapper* mapper, vtkPolyData* data);
131  int WriteCells(vtkPolyData* data, int cellType);
132 
133  int WritePolygonObject(vtkPolyData* output);
134  int WriteLineObject(vtkPolyData* output);
135 
136  void WriteData() override;
137 
138  char* FileName;
139 
140  int FileType;
141 
142  int FillInputPortInformation(int port, vtkInformation* info) override;
143 
144  ostream* OpenFile();
145  void CloseFile(ostream* fp);
146 
147 private:
148  vtkMNIObjectWriter(const vtkMNIObjectWriter&) = delete;
149  void operator=(const vtkMNIObjectWriter&) = delete;
150 };
151 
152 VTK_ABI_NAMESPACE_END
153 #endif
Store vtkAlgorithm input/output information.
represent surface properties of a geometric object
Definition: vtkProperty.h:56
virtual vtkLookupTable * GetLookupTable()
Set the lookup table associated with the object.
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:30
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:315
virtual vtkProperty * GetProperty()
Set the property associated with the object.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
#define VTK_ASCII
Definition: vtkWriter.h:31
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:34
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:34
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:32
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:76
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 void WriteData()=0
void SetFileTypeToASCII()
Specify file type (ASCII or BINARY) for vtk data file.
represent and manipulate 3D points
Definition: vtkPoints.h:28