VTK
vtkMNIObjectReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMNIObjectReader.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 =========================================================================*/
65 #ifndef vtkMNIObjectReader_h
66 #define vtkMNIObjectReader_h
67 
68 #include "vtkIOMINCModule.h" // For export macro
69 #include "vtkPolyDataAlgorithm.h"
70 
71 class vtkProperty;
72 class vtkPolyData;
73 class vtkFloatArray;
74 class vtkIntArray;
75 class vtkPoints;
76 class vtkCellArray;
77 
78 class VTKIOMINC_EXPORT vtkMNIObjectReader : public vtkPolyDataAlgorithm
79 {
80 public:
82 
83  static vtkMNIObjectReader *New();
84  void PrintSelf(ostream& os, vtkIndent indent) override;
85 
87 
90  vtkSetStringMacro(FileName);
91  vtkGetStringMacro(FileName);
93 
97  virtual const char* GetFileExtensions() {
98  return ".obj"; }
99 
103  virtual const char* GetDescriptiveName() {
104  return "MNI object"; }
105 
109  virtual int CanReadFile(const char* name);
110 
114  virtual vtkProperty *GetProperty() { return this->Property; };
115 
116 protected:
118  ~vtkMNIObjectReader() override;
119 
120  char *FileName;
122  int FileType;
123 
124  istream *InputStream;
126  char *LineText;
127  char *CharPointer;
128 
129  int ReadLine(char *text, unsigned int length);
130  int SkipWhitespace();
131  int ParseValues(vtkDataArray *array, vtkIdType n);
132  int ParseIdValue(vtkIdType *value);
133 
134  int ReadNumberOfPoints(vtkIdType *numCells);
135  int ReadNumberOfCells(vtkIdType *numCells);
136  int ReadProperty(vtkProperty *property);
137  int ReadLineThickness(vtkProperty *property);
138  int ReadPoints(vtkPolyData *polyData, vtkIdType numPoints);
139  int ReadNormals(vtkPolyData *polyData, vtkIdType numPoints);
140  int ReadColors(vtkProperty *property, vtkPolyData *data,
141  vtkIdType numPoints, vtkIdType numCells);
142  int ReadCells(vtkPolyData *data, vtkIdType numCells, int cellType);
143 
144  int ReadPolygonObject(vtkPolyData *output);
145  int ReadLineObject(vtkPolyData *output);
146 
147  virtual int ReadFile(vtkPolyData *output);
148 
149  int RequestData(vtkInformation* request,
150  vtkInformationVector** inInfo,
151  vtkInformationVector* outInfo) override;
152 
153 private:
154  vtkMNIObjectReader(const vtkMNIObjectReader&) = delete;
155  void operator=(const vtkMNIObjectReader&) = delete;
156 
157 };
158 
159 #endif
virtual const char * GetDescriptiveName()
Get the name of this file format.
Store vtkAlgorithm input/output information.
represent surface properties of a geometric object
Definition: vtkProperty.h:60
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:35
A reader for MNI surface mesh files.
int vtkIdType
Definition: vtkType.h:347
virtual const char * GetFileExtensions()
Get the entension for this file format.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
static vtkPolyDataAlgorithm * New()
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:39
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:33
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
object to represent cell connectivity
Definition: vtkCellArray.h:44
virtual vtkProperty * GetProperty()
Get the property associated with the object.
Store zero or more vtkInformation instances.
represent and manipulate 3D points
Definition: vtkPoints.h:33
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.