go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkParameterFileParser.h
Go to the documentation of this file.
1 /*======================================================================
2 
3 This file is part of the elastix software.
4 
5 Copyright (c) University Medical Center Utrecht. All rights reserved.
6 See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
7 details.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notices for more information.
12 
13 ======================================================================*/
14 #ifndef __itkParameterFileParser_h
15 #define __itkParameterFileParser_h
16 
17 #include "itkObject.h"
18 #include "itkObjectFactory.h"
19 #include "itkMacro.h"
20 
21 #include <map>
22 #include <string>
23 #include <vector>
24 #include <fstream>
25 
26 namespace itk
27 {
28 
75 class ParameterFileParser : public Object
76 {
77 public:
78 
81  typedef Object Superclass;
82  typedef SmartPointer< Self > Pointer;
83  typedef SmartPointer< const Self > ConstPointer;
84 
86  itkNewMacro( Self );
87 
89  itkTypeMacro( ParameterFileParser, Object );
90 
92  typedef std::vector< std::string > ParameterValuesType;
93  typedef std::map<
94  std::string,
96 
98  itkSetStringMacro( ParameterFileName );
99  itkGetStringMacro( ParameterFileName );
100 
102  virtual const ParameterMapType & GetParameterMap( void ) const;
103 
105  void ReadParameterFile( void );
106 
110  std::string ReturnParameterFileAsString( void );
111 
112 protected:
113 
115  virtual ~ParameterFileParser();
116 
117 private:
118 
119  ParameterFileParser( const Self & ); // purposely not implemented
120  void operator=( const Self & ); // purposely not implemented
121 
128  void BasicFileChecking( void ) const;
129 
135  bool CheckLine( const std::string & line, std::string & lineOut ) const;
136 
138  void GetParameterFromLine( const std::string & fullLine,
139  const std::string & line );
140 
142  void SplitLine( const std::string & fullLine, const std::string & line,
143  std::vector< std::string > & splittedLine ) const;
144 
148  void ThrowException( const std::string & line, const std::string & hint ) const;
149 
151  std::string m_ParameterFileName;
152  std::ifstream m_ParameterFile;
154 
155 };
156 
157 } // end of namespace itk
158 
159 #endif // end __itkParameterFileParser_h
std::map< std::string, ParameterValuesType > ParameterMapType
std::string ReturnParameterFileAsString(void)
void BasicFileChecking(void) const
bool CheckLine(const std::string &line, std::string &lineOut) const
void GetParameterFromLine(const std::string &fullLine, const std::string &line)
Implements functionality to read a parameter file.
void ThrowException(const std::string &line, const std::string &hint) const
void operator=(const Self &)
std::vector< std::string > ParameterValuesType
virtual const ParameterMapType & GetParameterMap(void) const
SmartPointer< Self > Pointer
void SplitLine(const std::string &fullLine, const std::string &line, std::vector< std::string > &splittedLine) const
SmartPointer< const Self > ConstPointer


Generated on 27-04-2014 for elastix by doxygen 1.8.6 elastix logo