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