VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkMNITagPointReader.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 /*========================================================================= 00016 00017 Copyright (c) 2006 Atamai, Inc. 00018 00019 Use, modification and redistribution of the software, in source or 00020 binary forms, are permitted provided that the following terms and 00021 conditions are met: 00022 00023 1) Redistribution of the source code, in verbatim or modified 00024 form, must retain the above copyright notice, this license, 00025 the following disclaimer, and any notices that refer to this 00026 license and/or the following disclaimer. 00027 00028 2) Redistribution in binary form must include the above copyright 00029 notice, a copy of this license and the following disclaimer 00030 in the documentation or with other materials provided with the 00031 distribution. 00032 00033 3) Modified copies of the source code must be clearly marked as such, 00034 and must not be misrepresented as verbatim copies of the source code. 00035 00036 THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" 00037 WITHOUT EXPRESSED OR IMPLIED WARRANTY INCLUDING, BUT NOT LIMITED TO, 00038 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00039 PURPOSE. IN NO EVENT SHALL ANY COPYRIGHT HOLDER OR OTHER PARTY WHO MAY 00040 MODIFY AND/OR REDISTRIBUTE THE SOFTWARE UNDER THE TERMS OF THIS LICENSE 00041 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES 00042 (INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA OR DATA BECOMING INACCURATE 00043 OR LOSS OF PROFIT OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF 00044 THE USE OR INABILITY TO USE THE SOFTWARE, EVEN IF ADVISED OF THE 00045 POSSIBILITY OF SUCH DAMAGES. 00046 00047 =========================================================================*/ 00067 #ifndef __vtkMNITagPointReader_h 00068 #define __vtkMNITagPointReader_h 00069 00070 #include "vtkIOMINCModule.h" // For export macro 00071 #include "vtkPolyDataAlgorithm.h" 00072 #include "vtkStdString.h" // needed for std::string 00073 00074 class vtkPolyData; 00075 class vtkPoints; 00076 class vtkStringArray; 00077 class vtkDoubleArray; 00078 class vtkIntArray; 00079 00080 class VTKIOMINC_EXPORT vtkMNITagPointReader : public vtkPolyDataAlgorithm 00081 { 00082 public: 00083 vtkTypeMacro(vtkMNITagPointReader,vtkPolyDataAlgorithm); 00084 00085 static vtkMNITagPointReader *New(); 00086 virtual void PrintSelf(ostream& os, vtkIndent indent); 00087 00089 00090 vtkSetStringMacro(FileName); 00091 vtkGetStringMacro(FileName); 00093 00095 00096 virtual const char* GetFileExtensions() { 00097 return ".tag"; } 00099 00101 00102 virtual const char* GetDescriptiveName() { 00103 return "MNI tags"; } 00105 00107 virtual int CanReadFile(const char* name); 00108 00113 virtual int GetNumberOfVolumes(); 00114 00116 00119 virtual vtkPoints *GetPoints(int port); 00120 virtual vtkPoints *GetPoints() { return this->GetPoints(0); } 00122 00126 virtual vtkStringArray *GetLabelText(); 00127 00131 virtual vtkDoubleArray *GetWeights(); 00132 00136 virtual vtkIntArray *GetStructureIds(); 00137 00141 virtual vtkIntArray *GetPatientIds(); 00142 00144 virtual const char *GetComments(); 00145 00146 protected: 00147 vtkMNITagPointReader(); 00148 ~vtkMNITagPointReader(); 00149 00150 char *FileName; 00151 int NumberOfVolumes; 00152 00153 int LineNumber; 00154 char *Comments; 00155 00156 int ReadLine(istream &infile, std::string &linetext, 00157 std::string::iterator &pos); 00158 int ReadLineAfterComments(istream &infile, std::string &linetext, 00159 std::string::iterator &pos); 00160 int SkipWhitespace(istream &infile, std::string &linetext, 00161 std::string::iterator &pos, int nl); 00162 int ParseLeftHandSide(istream &infile, std::string &linetext, 00163 std::string::iterator &pos, 00164 std::string &identifier); 00165 int ParseStringValue(istream &infile, std::string &linetext, 00166 std::string::iterator &pos, 00167 std::string &data); 00168 int ParseIntValues(istream &infile, std::string &linetext, 00169 std::string::iterator &pos, 00170 int *values, int count); 00171 int ParseFloatValues(istream &infile, std::string &linetext, 00172 std::string::iterator &pos, 00173 double *values, int count); 00174 00175 virtual int ReadFile(vtkPolyData *output1, vtkPolyData *output2); 00176 00177 virtual int RequestData(vtkInformation* request, 00178 vtkInformationVector** inInfo, 00179 vtkInformationVector* outInfo); 00180 00181 private: 00182 vtkMNITagPointReader(const vtkMNITagPointReader&); // Not implemented 00183 void operator=(const vtkMNITagPointReader&); // Not implemented 00184 00185 }; 00186 00187 #endif