VTK
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 =========================================================================*/
67 #ifndef __vtkMNITagPointReader_h
68 #define __vtkMNITagPointReader_h
69 
70 #include "vtkPolyDataAlgorithm.h"
71 #include "vtkStdString.h" // needed for vtkstd::string
72 
73 class vtkPolyData;
74 class vtkPoints;
75 class vtkStringArray;
76 class vtkDoubleArray;
77 class vtkIntArray;
78 
80 {
81 public:
83 
84  static vtkMNITagPointReader *New();
85  virtual void PrintSelf(ostream& os, vtkIndent indent);
86 
88 
89  vtkSetStringMacro(FileName);
90  vtkGetStringMacro(FileName);
92 
94 
95  virtual const char* GetFileExtensions() {
96  return ".tag"; }
98 
100 
101  virtual const char* GetDescriptiveName() {
102  return "MNI tags"; }
104 
106  virtual int CanReadFile(const char* name);
107 
112  virtual int GetNumberOfVolumes();
113 
115 
118  virtual vtkPoints *GetPoints(int port);
119  virtual vtkPoints *GetPoints() { return this->GetPoints(0); }
121 
125  virtual vtkStringArray *GetLabelText();
126 
130  virtual vtkDoubleArray *GetWeights();
131 
135  virtual vtkIntArray *GetStructureIds();
136 
140  virtual vtkIntArray *GetPatientIds();
141 
143  virtual const char *GetComments();
144 
145 protected:
148 
149  char *FileName;
151 
153  char *Comments;
154 
155  int ReadLine(istream &infile, vtkstd::string &linetext,
156  vtkstd::string::iterator &pos);
157  int ReadLineAfterComments(istream &infile, vtkstd::string &linetext,
158  vtkstd::string::iterator &pos);
159  int SkipWhitespace(istream &infile, vtkstd::string &linetext,
160  vtkstd::string::iterator &pos, int nl);
161  int ParseLeftHandSide(istream &infile, vtkstd::string &linetext,
162  vtkstd::string::iterator &pos,
163  vtkstd::string &identifier);
164  int ParseStringValue(istream &infile, vtkstd::string &linetext,
165  vtkstd::string::iterator &pos,
167  int ParseIntValues(istream &infile, vtkstd::string &linetext,
168  vtkstd::string::iterator &pos,
169  int *values, int count);
170  int ParseFloatValues(istream &infile, vtkstd::string &linetext,
171  vtkstd::string::iterator &pos,
172  double *values, int count);
173 
174  virtual int ReadFile(vtkPolyData *output1, vtkPolyData *output2);
175 
176  virtual int RequestData(vtkInformation* request,
177  vtkInformationVector** inInfo,
178  vtkInformationVector* outInfo);
179 
180 private:
181  vtkMNITagPointReader(const vtkMNITagPointReader&); // Not implemented
182  void operator=(const vtkMNITagPointReader&); // Not implemented
183 
184 };
185 
186 #endif