VTK  9.2.6
vtkMNITagPointReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMNITagPointReader.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 vtkMNITagPointReader_h
69 #define vtkMNITagPointReader_h
70 
71 #include "vtkIOMINCModule.h" // For export macro
72 #include "vtkPolyDataAlgorithm.h"
73 #include "vtkStdString.h" // needed for std::string
74 
75 class vtkPolyData;
76 class vtkPoints;
77 class vtkStringArray;
78 class vtkDoubleArray;
79 class vtkIntArray;
80 
81 class VTKIOMINC_EXPORT vtkMNITagPointReader : public vtkPolyDataAlgorithm
82 {
83 public:
85 
86  static vtkMNITagPointReader* New();
87  void PrintSelf(ostream& os, vtkIndent indent) override;
88 
90 
93  vtkSetFilePathMacro(FileName);
94  vtkGetFilePathMacro(FileName);
96 
100  virtual const char* GetFileExtensions() { return ".tag"; }
101 
105  virtual const char* GetDescriptiveName() { return "MNI tags"; }
106 
110  virtual int CanReadFile(VTK_FILEPATH const char* name);
111 
118  virtual int GetNumberOfVolumes();
119 
125  virtual vtkPoints* GetPoints(int port);
126  virtual vtkPoints* GetPoints() { return this->GetPoints(0); }
127 
133  virtual vtkStringArray* GetLabelText();
134 
140  virtual vtkDoubleArray* GetWeights();
141 
147  virtual vtkIntArray* GetStructureIds();
148 
154  virtual vtkIntArray* GetPatientIds();
155 
159  virtual const char* GetComments();
160 
161 protected:
163  ~vtkMNITagPointReader() override;
164 
165  char* FileName;
167 
169  char* Comments;
170 
171  int ReadLine(istream& infile, std::string& linetext, std::string::iterator& pos);
172  int ReadLineAfterComments(istream& infile, std::string& linetext, std::string::iterator& pos);
173  int SkipWhitespace(istream& infile, std::string& linetext, std::string::iterator& pos, int nl);
174  int ParseLeftHandSide(
175  istream& infile, std::string& linetext, std::string::iterator& pos, std::string& identifier);
176  int ParseStringValue(
177  istream& infile, std::string& linetext, std::string::iterator& pos, std::string& data);
178  int ParseIntValues(
179  istream& infile, std::string& linetext, std::string::iterator& pos, int* values, int count);
180  int ParseFloatValues(
181  istream& infile, std::string& linetext, std::string::iterator& pos, double* values, int count);
182 
183  virtual int ReadFile(vtkPolyData* output1, vtkPolyData* output2);
184 
185  int RequestData(
186  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
187 
188 private:
190  void operator=(const vtkMNITagPointReader&) = delete;
191 };
192 
193 #endif
virtual vtkPoints * GetPoints()
virtual const char * GetDescriptiveName()
Get the name of this file format.
Store vtkAlgorithm input/output information.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
A reader for MNI tag files.
a vtkAbstractArray subclass for strings
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
dynamic, self-adjusting array of double
static vtkPolyDataAlgorithm * New()
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:45
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:39
#define VTK_FILEPATH
virtual const char * GetFileExtensions()
Get the extension for this file format.
Store zero or more vtkInformation instances.
represent and manipulate 3D points
Definition: vtkPoints.h:39
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.