Loading...
Searching...
No Matches
itk::ParameterFileParser Class Reference

`#include <itkParameterFileParser.h>`

## Detailed Description

Implements functionality to read a parameter file.

A parameter file is a text file that contains parameters and their values. Parameters should be specified obeying certain rules.
1) A single parameter should be on a single line
2) A parameter should be specified between brackets: (...)
3) Parameters are specified by a single name, followed by one or more values, all separated by spaces
4) Values that are strings should be quoted using "\n 5) Values that are numbers should be unquoted\n For example: \n (ParameterName1 "string1" "string2")\n (ParameterName2 3 5.8)\n (ParameterName3 "true" "false" "true")
The parameter file is read, and parameter name-value combinations are stored in an std::map< std::string, std::vector<std:string> >, where the string is the parameter name, and the vector of strings are the values. Exceptions are raised in case:

- the parameter text file cannot be opened,
- rule 2 or 3 is not satisfied,
- the parameter name or value contains invalid characters.
  Here is an example on how to use this class:
  itk::ParameterFileParser::Pointer parser = itk::ParameterFileParser::New(); parser->SetParameterFileName( parameterFileName ); try { parser->Initialize(); } catch ( itk::ExceptionObject & e ) { ... }

The resulting map can be accessed via:
parser->GetParameterMap();

See also
  itk::ParameterMapInterface

Definition at line 78 of file itkParameterFileParser.h.

Inheritance diagram for itk::ParameterFileParser:
[legend]

## Public Types

using | ConstPointer = SmartPointer<const Self>
using | ParameterMapType = std::map<std::string, ParameterValuesType>
using | ParameterValuesType = std::vector<std::string>
using | Pointer = SmartPointer<Self>
using | Self = ParameterFileParser
using | Superclass = Object

## Public Member Functions

virtual const char * | GetClassName () const
virtual const char * | GetParameterFileName () const
const ParameterMapType & | GetParameterMap () const
| ITK_DISALLOW_COPY_AND_MOVE (ParameterFileParser)
void | ReadParameterFile ()
std::string | ReturnParameterFileAsString ()
virtual void | SetParameterFileName (const char *_arg)

## Static Public Member Functions

static ParameterMapType | ConvertToParameterMap (const std::string &text)
static Pointer | New ()
static ParameterMapType | ReadParameterMap (const std::string &fileName)

## Protected Member Functions

| ParameterFileParser ()
| ~ParameterFileParser () override

## Private Attributes

std::string | m_ParameterFileName {}
ParameterMapType | m_ParameterMap {}

## Member Typedef Documentation

## ConstPointer

using itk::ParameterFileParser::ConstPointer = SmartPointer<const Self>

Definition at line 87 of file itkParameterFileParser.h.

## ParameterMapType

using itk::ParameterFileParser::ParameterMapType = std::map<std::string, ParameterValuesType>

Definition at line 97 of file itkParameterFileParser.h.

## ParameterValuesType

using itk::ParameterFileParser::ParameterValuesType = std::vector<std::string>

Typedefs.

Definition at line 96 of file itkParameterFileParser.h.

## Pointer

using itk::ParameterFileParser::Pointer = SmartPointer<Self>

Definition at line 86 of file itkParameterFileParser.h.

## Self

using itk::ParameterFileParser::Self = ParameterFileParser

Standard ITK typedefs.

Definition at line 84 of file itkParameterFileParser.h.

## Superclass

using itk::ParameterFileParser::Superclass = Object

Definition at line 85 of file itkParameterFileParser.h.

## Constructor & Destructor Documentation

## ParameterFileParser()

itk::ParameterFileParser::ParameterFileParser | ( |  | ) |

protected

## ~ParameterFileParser()

itk::ParameterFileParser::~ParameterFileParser | ( |  | ) |

override protected

## Member Function Documentation

## ConvertToParameterMap()

ParameterMapType itk::ParameterFileParser::ConvertToParameterMap | ( | const std::string & | text | ) |

static

Converts the specified text string to the corresponding parameter map, assuming that the text is formatted according to the elastix parameter text file format.

## GetClassName()

virtual const char * itk::ParameterFileParser::GetClassName | ( |  | ) | const

virtual

Run-time type information (and related methods).

## GetParameterFileName()

virtual const char * itk::ParameterFileParser::GetParameterFileName | ( |  | ) | const

virtual

## GetParameterMap()

const ParameterMapType & itk::ParameterFileParser::GetParameterMap | ( |  | ) | const

Return the parameter map.

## ITK_DISALLOW_COPY_AND_MOVE()

itk::ParameterFileParser::ITK_DISALLOW_COPY_AND_MOVE | ( | ParameterFileParser |  | ) |

## New()

Pointer itk::ParameterFileParser::New | ( |  | ) |

static

Method for creation through the object factory.

## ReadParameterFile()

void itk::ParameterFileParser::ReadParameterFile | ( |  | ) |

Read the parameters in the parameter map.

## ReadParameterMap()

ParameterMapType itk::ParameterFileParser::ReadParameterMap | ( | const std::string & | fileName | ) |

static

Read the specified file into a parameter map and return the map.

## ReturnParameterFileAsString()

std::string itk::ParameterFileParser::ReturnParameterFileAsString | ( |  | ) |

Read the parameter file and return the content as a string. Useful for printing the content.

## SetParameterFileName()

virtual void itk::ParameterFileParser::SetParameterFileName | ( | const char * | _arg | ) |

virtual

Set the name of the file containing the parameters.

## Field Documentation

## m_ParameterFileName

std::string itk::ParameterFileParser::m_ParameterFileName {}

private

Member variables.

Definition at line 132 of file itkParameterFileParser.h.

## m_ParameterMap

ParameterMapType itk::ParameterFileParser::m_ParameterMap {}

private

Definition at line 133 of file itkParameterFileParser.h.

Generated on 1768596610 for elastix by 1.15.0 |