VTK
dox/Hybrid/vtkMNITransformReader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkMNITransformReader.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 =========================================================================*/
00066 #ifndef __vtkMNITransformReader_h
00067 #define __vtkMNITransformReader_h
00068 
00069 #include "vtkAlgorithm.h"
00070 
00071 class vtkAbstractTransform;
00072 class vtkDoubleArray;
00073 class vtkCollection;
00074 
00075 class VTK_HYBRID_EXPORT vtkMNITransformReader : public vtkAlgorithm
00076 {
00077 public:
00078   vtkTypeMacro(vtkMNITransformReader,vtkAlgorithm);
00079 
00080   static vtkMNITransformReader *New();
00081   virtual void PrintSelf(ostream& os, vtkIndent indent);
00082 
00084 
00085   vtkSetStringMacro(FileName);
00086   vtkGetStringMacro(FileName);
00088 
00090 
00091   virtual const char* GetFileExtensions() {
00092     return ".xfm"; }
00094 
00096 
00097   virtual const char* GetDescriptiveName() {
00098     return "MNI Transform"; }
00100 
00102   virtual int CanReadFile(const char* name);
00103 
00105   virtual int GetNumberOfTransforms();
00106 
00108   virtual vtkAbstractTransform *GetNthTransform(int i);
00109 
00113   virtual vtkAbstractTransform *GetTransform();
00114 
00116   virtual const char *GetComments();
00117 
00118 protected:
00119   vtkMNITransformReader();
00120   ~vtkMNITransformReader();
00121 
00122   char *FileName;
00123   vtkAbstractTransform *Transform;
00124   vtkCollection *Transforms;
00125   int LineNumber;
00126   char *Comments;
00127 
00128   void SetTransform(vtkAbstractTransform *transform);
00129 
00130   int ReadLine(istream &infile, char result[256]);
00131   int ReadLineAfterComments(istream &infile, char result[256]);
00132   int SkipWhitespace(istream &infile, char linetext[256], char **cpp);
00133   int ParseLeftHandSide(istream &infile, char linetext[256], char **cpp,
00134                         char identifier[256]);
00135   int ParseStringValue(istream &infile, char linetext[256], char **cpp,
00136                        char data[256]);
00137   int ParseFloatValues(istream &infile, char linetext[256], char **cpp,
00138                        vtkDoubleArray *array);
00139   int ParseInvertFlagValue(istream &infile, char linetext[256], char **cpp,
00140                            int *invertFlag);
00141 
00142   int ReadLinearTransform(istream &infile, char linetext[256], char **cp);
00143   int ReadThinPlateSplineTransform(istream &infile, char linetext[256],
00144                                    char **cp);
00145   int ReadGridTransform(istream &infile, char linetext[256], char **cp);
00146 
00147   virtual int ReadNextTransform(istream &infile, char linetext[256]);
00148 
00149   virtual int ReadFile();
00150 
00151   virtual int ProcessRequest(vtkInformation* request,
00152                              vtkInformationVector** inInfo,
00153                              vtkInformationVector* outInfo);
00154 
00155 private:
00156   vtkMNITransformReader(const vtkMNITransformReader&); // Not implemented
00157   void operator=(const vtkMNITransformReader&);  // Not implemented
00158 
00159 };
00160 
00161 #endif