go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes
elastix::Configuration Class Reference

#include <elxConfiguration.h>

Detailed Description

A class that deals with user given parameters and command line arguments.

The Configuration class provides the functions ReadParameter() (to read parameters from the parameter file) and ReadCommandLineArgument(), and provides an easy way to get the current elastix level.

Parameters:
PrintErrorMessages: defines if warnings and errors should be printed to screen, e.g. when a parameter cannot be found and the default is used. example: (PrintErrorMessages "false")
Default: "true"

Definition at line 50 of file elxConfiguration.h.

Inheritance diagram for elastix::Configuration:
Inheritance graph
[legend]

Public Types

using CommandLineArgumentMapType = std::map< std::string, std::string >
 
using CommandLineEntryType = CommandLineArgumentMapType::value_type
 
using ConstPointer = itk::SmartPointer< const Self >
 
using Pointer = itk::SmartPointer< Self >
 
using Self = Configuration
 
using Superclass1 = itk::Object
 
using Superclass2 = BaseComponent
 

Public Member Functions

int BeforeAll () override
 
virtual int BeforeAllTransformix ()
 
std::vcl_size_t CountNumberOfParameterEntries (const std::string &parameterName) const
 
virtual const char * GetClassName () const
 
std::string GetCommandLineArgument (const std::string &key) const
 
virtual unsigned int GetElastixLevel () const
 
virtual const char * GetParameterFileName () const
 
virtual bool GetPrintErrorMessages ()
 
virtual unsigned int GetTotalNumberOfElastixLevels () const
 
std::vector< std::string > GetValuesOfParameter (const std::string &parameterName) const
 
bool HasParameter (const std::string &parameterName) const
 
virtual int Initialize (const CommandLineArgumentMapType &_arg)
 
virtual int Initialize (const CommandLineArgumentMapType &_arg, const itk::ParameterFileParser::ParameterMapType &inputMap)
 
virtual bool IsInitialized () const
 
 ITK_DISALLOW_COPY_AND_MOVE (Configuration)
 
template<class T >
bool ReadParameter (std::vector< T > &parameterValues, const std::string &parameterName, const unsigned int entry_nr_start, const unsigned int entry_nr_end, const bool printThisErrorMessage) const
 
template<class T >
bool ReadParameter (T &parameterValue, const std::string &parameterName, const std::string &prefix, const unsigned int entry_nr, const int default_entry_nr) const
 
template<class T >
bool ReadParameter (T &parameterValue, const std::string &parameterName, const std::string &prefix, const unsigned int entry_nr, const int default_entry_nr, const bool printThisErrorMessage) const
 
template<class T >
bool ReadParameter (T &parameterValue, const std::string &parameterName, const unsigned int entry_nr) const
 
template<class T >
bool ReadParameter (T &parameterValue, const std::string &parameterName, const unsigned int entry_nr, const bool printThisErrorMessage) const
 
std::string RetrieveParameterStringValue (const std::string &defaultParameterValue, const std::string &parameterName, const unsigned int entry_nr, const bool printThisErrorMessage) const
 
template<typename T >
RetrieveParameterValue (const T &defaultParameterValue, const std::string &parameterName, const unsigned int entry_nr, const bool printThisErrorMessage) const
 
template<typename T >
std::unique_ptr< std::vector< T > > RetrieveValuesOfParameter (const std::string &parameterName) const
 
void SetCommandLineArgument (const std::string &key, const std::string &value)
 
virtual void SetElastixLevel (unsigned int _arg)
 
virtual void SetParameterFileName (const char *_arg)
 
virtual void SetTotalNumberOfElastixLevels (unsigned int _arg)
 
- Public Member Functions inherited from elastix::BaseComponent
virtual void AfterEachIteration ()
 
virtual void AfterEachIterationBase ()
 
virtual void AfterEachResolution ()
 
virtual void AfterEachResolutionBase ()
 
virtual void AfterRegistration ()
 
virtual void AfterRegistrationBase ()
 
virtual int BeforeAll ()
 
virtual int BeforeAllBase ()
 
virtual void BeforeEachResolution ()
 
virtual void BeforeEachResolutionBase ()
 
virtual void BeforeRegistration ()
 
virtual void BeforeRegistrationBase ()
 
virtual const char * elxGetClassName () const
 
const char * GetComponentLabel () const
 
 ITK_DISALLOW_COPY_AND_MOVE (BaseComponent)
 
 itkTypeMacroNoParent (BaseComponent)
 
void SetComponentLabel (const char *label, unsigned int idx)
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from elastix::BaseComponent
template<typename TBaseComponent >
static auto AsITKBaseType (TBaseComponent *const baseComponent) -> decltype(baseComponent->GetAsITKBaseType())
 
static void InitializeElastixExecutable ()
 
static bool IsElastixLibrary ()
 

Protected Member Functions

 Configuration ()
 
virtual void PrintParameterFile () const
 
 ~Configuration () override=default
 
- Protected Member Functions inherited from elastix::BaseComponent
 BaseComponent ()=default
 
virtual ~BaseComponent ()=default
 

Private Attributes

CommandLineArgumentMapType m_CommandLineArgumentMap {}
 
unsigned int m_ElastixLevel { 0 }
 
bool m_IsInitialized { false }
 
std::string m_ParameterFileName {}
 
itk::ParameterFileParser::Pointer m_ParameterFileParser { itk::ParameterFileParser::New() }
 
itk::ParameterMapInterface::Pointer m_ParameterMapInterface { itk::ParameterMapInterface::New() }
 
unsigned int m_TotalNumberOfElastixLevels { 1 }
 

Member Typedef Documentation

◆ CommandLineArgumentMapType

using elastix::Configuration::CommandLineArgumentMapType = std::map<std::string, std::string>

Typedefs for the command line arguments.

Definition at line 71 of file elxConfiguration.h.

◆ CommandLineEntryType

using elastix::Configuration::CommandLineEntryType = CommandLineArgumentMapType::value_type

Definition at line 72 of file elxConfiguration.h.

◆ ConstPointer

using elastix::Configuration::ConstPointer = itk::SmartPointer<const Self>

Definition at line 62 of file elxConfiguration.h.

◆ Pointer

using elastix::Configuration::Pointer = itk::SmartPointer<Self>

Definition at line 61 of file elxConfiguration.h.

◆ Self

Standard itk.

Definition at line 58 of file elxConfiguration.h.

◆ Superclass1

Definition at line 59 of file elxConfiguration.h.

◆ Superclass2

Definition at line 60 of file elxConfiguration.h.

Constructor & Destructor Documentation

◆ Configuration()

elastix::Configuration::Configuration ( )
protected

◆ ~Configuration()

elastix::Configuration::~Configuration ( )
overrideprotecteddefault

Member Function Documentation

◆ BeforeAll()

int elastix::Configuration::BeforeAll ( )
overridevirtual

Set/Get whether warnings are allowed to be printed, when reading a parameter. * itkSetMacro( Silent, bool ); itkGetConstMacro( Silent, bool ); Methods that is called at the very beginning of elastixTemplate::Run.

  • Prints the parameter file

Reimplemented from elastix::BaseComponent.

◆ BeforeAllTransformix()

virtual int elastix::Configuration::BeforeAllTransformix ( )
virtual

Methods that is called at the very beginning of elastixTemplate::ApplyTransform.

  • Prints the parameter file

◆ CountNumberOfParameterEntries()

std::vcl_size_t elastix::Configuration::CountNumberOfParameterEntries ( const std::string &  parameterName) const
inline

Interface to the ParameterMapInterface. Count the number of parameters.

Definition at line 141 of file elxConfiguration.h.

◆ GetClassName()

virtual const char * elastix::Configuration::GetClassName ( ) const
virtual

Standard part of all itk objects.

◆ GetCommandLineArgument()

std::string elastix::Configuration::GetCommandLineArgument ( const std::string &  key) const

Get and Set CommandLine arguments into the argument map.

◆ GetElastixLevel()

virtual unsigned int elastix::Configuration::GetElastixLevel ( ) const
virtual

◆ GetParameterFileName()

virtual const char * elastix::Configuration::GetParameterFileName ( ) const
virtual

Get/Set the name of the parameterFileName.

◆ GetPrintErrorMessages()

virtual bool elastix::Configuration::GetPrintErrorMessages ( )
inlinevirtual

Definition at line 114 of file elxConfiguration.h.

◆ GetTotalNumberOfElastixLevels()

virtual unsigned int elastix::Configuration::GetTotalNumberOfElastixLevels ( ) const
virtual

◆ GetValuesOfParameter()

std::vector< std::string > elastix::Configuration::GetValuesOfParameter ( const std::string &  parameterName) const
inline

Returns the values of the specified parameter (from the parameter file).

Definition at line 236 of file elxConfiguration.h.

◆ HasParameter()

bool elastix::Configuration::HasParameter ( const std::string &  parameterName) const
inline

Tells whether its parameter map has the parameter with the given name.

Definition at line 228 of file elxConfiguration.h.

◆ Initialize() [1/2]

virtual int elastix::Configuration::Initialize ( const CommandLineArgumentMapType _arg)
virtual

Pass the command line arguments as a map. One of the command line arguments should be either: -p <parameter_file> or -tp <transform_parameter_file>. The specified (transform) parameter file is read by the itk::ParameterFileParser and passed to the itk::ParameterMapInterface.

◆ Initialize() [2/2]

virtual int elastix::Configuration::Initialize ( const CommandLineArgumentMapType _arg,
const itk::ParameterFileParser::ParameterMapType inputMap 
)
virtual

◆ IsInitialized()

virtual bool elastix::Configuration::IsInitialized ( ) const
virtual

True, if Initialize was successfully called.

◆ ITK_DISALLOW_COPY_AND_MOVE()

elastix::Configuration::ITK_DISALLOW_COPY_AND_MOVE ( Configuration  )

◆ New()

static Pointer elastix::Configuration::New ( )
static

Method for creation through the object factory.

◆ PrintParameterFile()

virtual void elastix::Configuration::PrintParameterFile ( ) const
protectedvirtual

Print the parameter file to the log file. Called by BeforeAll(). This function is not really generic. It's just added because it needs to be called by both BeforeAll and BeforeAllTransformix.

◆ ReadParameter() [1/5]

template<class T >
bool elastix::Configuration::ReadParameter ( std::vector< T > &  parameterValues,
const std::string &  parameterName,
const unsigned int  entry_nr_start,
const unsigned int  entry_nr_end,
const bool  printThisErrorMessage 
) const
inline

Read a range of parameters from the parameter file.

Definition at line 284 of file elxConfiguration.h.

◆ ReadParameter() [2/5]

template<class T >
bool elastix::Configuration::ReadParameter ( T &  parameterValue,
const std::string &  parameterName,
const std::string &  prefix,
const unsigned int  entry_nr,
const int  default_entry_nr 
) const
inline

Read a parameter from the parameter file.

Definition at line 208 of file elxConfiguration.h.

◆ ReadParameter() [3/5]

template<class T >
bool elastix::Configuration::ReadParameter ( T &  parameterValue,
const std::string &  parameterName,
const std::string &  prefix,
const unsigned int  entry_nr,
const int  default_entry_nr,
const bool  printThisErrorMessage 
) const
inline

Read a parameter from the parameter file.

Definition at line 186 of file elxConfiguration.h.

◆ ReadParameter() [4/5]

template<class T >
bool elastix::Configuration::ReadParameter ( T &  parameterValue,
const std::string &  parameterName,
const unsigned int  entry_nr 
) const
inline

Read a parameter from the parameter file.

Definition at line 170 of file elxConfiguration.h.

◆ ReadParameter() [5/5]

template<class T >
bool elastix::Configuration::ReadParameter ( T &  parameterValue,
const std::string &  parameterName,
const unsigned int  entry_nr,
const bool  printThisErrorMessage 
) const
inline

Read a parameter from the parameter file.

Definition at line 150 of file elxConfiguration.h.

◆ RetrieveParameterStringValue()

std::string elastix::Configuration::RetrieveParameterStringValue ( const std::string &  defaultParameterValue,
const std::string &  parameterName,
const unsigned int  entry_nr,
const bool  printThisErrorMessage 
) const
inline

Retrieves the string value of the specified parameter (from the parameter file). Returns the specified default parameter value if the parameter cannot be found.

Definition at line 272 of file elxConfiguration.h.

◆ RetrieveParameterValue()

template<typename T >
T elastix::Configuration::RetrieveParameterValue ( const T &  defaultParameterValue,
const std::string &  parameterName,
const unsigned int  entry_nr,
const bool  printThisErrorMessage 
) const
inline

Retrieves the value of the specified parameter (from the parameter file). Returns the specified default parameter value if the parameter cannot be found.

Definition at line 258 of file elxConfiguration.h.

◆ RetrieveValuesOfParameter()

template<typename T >
std::unique_ptr< std::vector< T > > elastix::Configuration::RetrieveValuesOfParameter ( const std::string &  parameterName) const
inline

Retrieves the values of the specified parameter (from the parameter file). Returns null when the parameter map does not contain the specified parameter. Throws an exception when it fails to convert each of the parameter values to the specified type T.

Definition at line 249 of file elxConfiguration.h.

◆ SetCommandLineArgument()

void elastix::Configuration::SetCommandLineArgument ( const std::string &  key,
const std::string &  value 
)

◆ SetElastixLevel()

virtual void elastix::Configuration::SetElastixLevel ( unsigned int  _arg)
virtual

Other elastix related information. Get and Set the elastix level.

◆ SetParameterFileName()

virtual void elastix::Configuration::SetParameterFileName ( const char *  _arg)
virtual

◆ SetTotalNumberOfElastixLevels()

virtual void elastix::Configuration::SetTotalNumberOfElastixLevels ( unsigned int  _arg)
virtual

Get and Set the total number of elastix levels.

Field Documentation

◆ m_CommandLineArgumentMap

CommandLineArgumentMapType elastix::Configuration::m_CommandLineArgumentMap {}
private

Definition at line 314 of file elxConfiguration.h.

◆ m_ElastixLevel

unsigned int elastix::Configuration::m_ElastixLevel { 0 }
private

Definition at line 320 of file elxConfiguration.h.

◆ m_IsInitialized

bool elastix::Configuration::m_IsInitialized { false }
private

Definition at line 319 of file elxConfiguration.h.

◆ m_ParameterFileName

std::string elastix::Configuration::m_ParameterFileName {}
private

Definition at line 315 of file elxConfiguration.h.

◆ m_ParameterFileParser

itk::ParameterFileParser::Pointer elastix::Configuration::m_ParameterFileParser { itk::ParameterFileParser::New() }
private

Definition at line 316 of file elxConfiguration.h.

◆ m_ParameterMapInterface

itk::ParameterMapInterface::Pointer elastix::Configuration::m_ParameterMapInterface { itk::ParameterMapInterface::New() }
private

Definition at line 317 of file elxConfiguration.h.

◆ m_TotalNumberOfElastixLevels

unsigned int elastix::Configuration::m_TotalNumberOfElastixLevels { 1 }
private

Definition at line 321 of file elxConfiguration.h.



Generated on 2023-01-13 for elastix by doxygen 1.9.6 elastix logo