18#ifndef elxConfiguration_h
19#define elxConfiguration_h
82 itkGetStringMacro(ParameterFileName);
83 itkSetStringMacro(ParameterFileName);
105 itkSetMacro(ElastixLevel,
unsigned int);
106 itkGetConstMacro(ElastixLevel,
unsigned int);
109 itkSetMacro(TotalNumberOfElastixLevels,
unsigned int);
110 itkGetConstMacro(TotalNumberOfElastixLevels,
unsigned int);
151 const std::string & parameterName,
152 const unsigned int entry_nr,
153 const bool printThisErrorMessage)
const
155 std::string errorMessage =
"";
157 parameterValue, parameterName, entry_nr, printThisErrorMessage, errorMessage);
158 if (!errorMessage.empty())
160 xl::xout[
"error"] << errorMessage;
170 ReadParameter(T & parameterValue,
const std::string & parameterName,
const unsigned int entry_nr)
const
172 std::string errorMessage =
"";
173 bool found = this->
m_ParameterMapInterface->ReadParameter(parameterValue, parameterName, entry_nr, errorMessage);
174 if (!errorMessage.empty())
176 xl::xout[
"error"] << errorMessage;
187 const std::string & parameterName,
188 const std::string & prefix,
189 const unsigned int entry_nr,
190 const int default_entry_nr,
191 const bool printThisErrorMessage)
const
193 std::string errorMessage =
"";
195 parameterValue, parameterName, prefix, entry_nr, default_entry_nr, printThisErrorMessage, errorMessage);
196 if (!errorMessage.empty())
198 xl::xout[
"error"] << errorMessage;
209 const std::string & parameterName,
210 const std::string & prefix,
211 const unsigned int entry_nr,
212 const int default_entry_nr)
const
214 std::string errorMessage =
"";
216 parameterValue, parameterName, prefix, entry_nr, default_entry_nr, errorMessage);
217 if (!errorMessage.empty())
219 xl::xout[
"error"] << errorMessage;
235 std::vector<std::string>
247 template <
typename T>
248 std::unique_ptr<std::vector<T>>
256 template <
typename T>
259 const std::string & parameterName,
260 const unsigned int entry_nr,
261 const bool printThisErrorMessage)
const
263 auto parameterValue = defaultParameterValue;
264 (void)Self::ReadParameter<T>(parameterValue, parameterName, entry_nr, printThisErrorMessage);
265 return parameterValue;
273 const std::string & parameterName,
274 const unsigned int entry_nr,
275 const bool printThisErrorMessage)
const
285 const std::string & parameterName,
286 const unsigned int entry_nr_start,
287 const unsigned int entry_nr_end,
288 const bool printThisErrorMessage)
const
290 std::string errorMessage =
"";
292 parameterValues, parameterName, entry_nr_start, entry_nr_end, printThisErrorMessage, errorMessage);
293 if (!errorMessage.empty())
295 xl::xout[
"error"] << errorMessage;
The BaseComponent class is a class that all elastix components should inherit from.
A class that deals with user given parameters and command line arguments.
void SetCommandLineArgument(const std::string &key, const std::string &value)
virtual int Initialize(const CommandLineArgumentMapType &_arg, const itk::ParameterFileParser::ParameterMapType &inputMap)
bool ReadParameter(T ¶meterValue, const std::string ¶meterName, const unsigned int entry_nr, const bool printThisErrorMessage) const
bool ReadParameter(T ¶meterValue, const std::string ¶meterName, const std::string &prefix, const unsigned int entry_nr, const int default_entry_nr) const
ITK_DISALLOW_COPY_AND_MOVE(Configuration)
std::map< std::string, std::string > CommandLineArgumentMapType
itk::SmartPointer< Self > Pointer
virtual void PrintParameterFile() const
itk::SmartPointer< const Self > ConstPointer
std::vector< std::string > GetValuesOfParameter(const std::string ¶meterName) const
itk::ParameterFileParser::Pointer m_ParameterFileParser
std::unique_ptr< std::vector< T > > RetrieveValuesOfParameter(const std::string ¶meterName) const
bool ReadParameter(T ¶meterValue, const std::string ¶meterName, const unsigned int entry_nr) const
std::string m_ParameterFileName
std::vcl_size_t CountNumberOfParameterEntries(const std::string ¶meterName) const
T RetrieveParameterValue(const T &defaultParameterValue, const std::string ¶meterName, const unsigned int entry_nr, const bool printThisErrorMessage) const
virtual bool GetPrintErrorMessages()
bool HasParameter(const std::string ¶meterName) const
unsigned int m_TotalNumberOfElastixLevels
itk::ParameterMapInterface::Pointer m_ParameterMapInterface
bool ReadParameter(std::vector< T > ¶meterValues, const std::string ¶meterName, const unsigned int entry_nr_start, const unsigned int entry_nr_end, const bool printThisErrorMessage) const
unsigned int m_ElastixLevel
CommandLineArgumentMapType m_CommandLineArgumentMap
virtual int Initialize(const CommandLineArgumentMapType &_arg)
virtual bool IsInitialized() const
CommandLineArgumentMapType::value_type CommandLineEntryType
virtual int BeforeAllTransformix()
bool ReadParameter(T ¶meterValue, const std::string ¶meterName, const std::string &prefix, const unsigned int entry_nr, const int default_entry_nr, const bool printThisErrorMessage) const
~Configuration() override=default
std::string RetrieveParameterStringValue(const std::string &defaultParameterValue, const std::string ¶meterName, const unsigned int entry_nr, const bool printThisErrorMessage) const
std::string GetCommandLineArgument(const std::string &key) const
std::map< std::string, ParameterValuesType > ParameterMapType