go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elastix::Conversion Class Reference

#include <elxConversion.h>

Detailed Description

A class that contains utility functions for the conversion of number of seconds and parameter values to text.

Definition at line 44 of file elxConversion.h.

Public Types

using ParameterMapType = std::map<std::string, ParameterValuesType>
 
using ParameterValuesType = std::vector<std::string>
 
using Self = Conversion
 

Static Public Member Functions

static constexpr const char * BoolToString (const bool arg)
 
template<typename TValue >
static std::vector< TValue > ConcatenateVectors (std::vector< TValue > vector1, std::vector< TValue > vector2)
 
static bool IsNumber (const std::string &)
 
static std::string ObjectPtrToString (itk::Object *)
 
static std::string ParameterMapToString (const ParameterMapType &)
 
static std::string SecondsToDHMS (const double totalSeconds, const unsigned int precision)
 
static bool StringToValue (const std::string &str, bool &value)
 
static bool StringToValue (const std::string &str, itk::Object *&value)
 
static bool StringToValue (const std::string &str, std::string &value)
 
template<class T >
static bool StringToValue (const std::string &str, T &value)
 
static std::string ToNativePathNameSeparators (const std::string &)
 
static itk::OptimizerParameters< doubleToOptimizerParameters (const std::vector< double > &)
 
static std::string ToString (const bool arg)
 
template<typename TInteger >
static std::string ToString (const TInteger integerValue)
 
static std::string ToString (double)
 
static std::string ToString (float)
 
template<typename T , unsigned int NRows, unsigned int NColumns>
static std::vector< std::string > ToVectorOfStrings (const itk::Matrix< T, NRows, NColumns > &matrix)
 
template<typename TContainer , typename SFINAE = typename TContainer::iterator>
static std::vector< std::string > ToVectorOfStrings (const TContainer &container)
 
static bool StringToValue (const std::string &str, double &value)
 
static bool StringToValue (const std::string &str, float &value)
 
static bool StringToValue (const std::string &str, char &value)
 
static bool StringToValue (const std::string &str, signed char &value)
 
static bool StringToValue (const std::string &str, unsigned char &value)
 

Member Typedef Documentation

◆ ParameterMapType

Definition at line 49 of file elxConversion.h.

◆ ParameterValuesType

using elastix::Conversion::ParameterValuesType = std::vector<std::string>

Corresponds with typedefs from the elastix class itk::ParameterFileParser.

Definition at line 48 of file elxConversion.h.

◆ Self

Definition at line 50 of file elxConversion.h.

Member Function Documentation

◆ BoolToString()

static constexpr const char * elastix::Conversion::BoolToString ( const bool arg)
inlinestaticconstexpr

Convenience function to convert a boolean to a text string.

Definition at line 58 of file elxConversion.h.

◆ ConcatenateVectors()

template<typename TValue >
static std::vector< TValue > elastix::Conversion::ConcatenateVectors ( std::vector< TValue > vector1,
std::vector< TValue > vector2 )
inlinestatic

Convenience function to concatenate two vectors.

Definition at line 148 of file elxConversion.h.

◆ IsNumber()

static bool elastix::Conversion::IsNumber ( const std::string & )
static

Convenience function which tells whether the argument may represent a number (either fixed point, floating point, or integer/whole number).

Note
IsNumber("NaN") and IsNumber("nan") return false.

◆ ObjectPtrToString()

static std::string elastix::Conversion::ObjectPtrToString ( itk::Object * )
static

Converts a raw itk::Object pointer to a text string.

◆ ParameterMapToString()

static std::string elastix::Conversion::ParameterMapToString ( const ParameterMapType & )
static

Converts the specified parameter map to a text string, according to the elastix parameter text file format.

◆ SecondsToDHMS()

static std::string elastix::Conversion::SecondsToDHMS ( const double totalSeconds,
const unsigned int precision )
static

Convenience function to convert seconds to day, hour, minute, second format.

◆ StringToValue() [1/9]

static bool elastix::Conversion::StringToValue ( const std::string & str,
bool & value )
static

Overload to cast a string to a bool. Returns true when casting was successful and false otherwise.

◆ StringToValue() [2/9]

static bool elastix::Conversion::StringToValue ( const std::string & str,
char & value )
static

Overloads for (signed/unsigned) char types, processing them as 8-bits integer types.

◆ StringToValue() [3/9]

static bool elastix::Conversion::StringToValue ( const std::string & str,
double & value )
static

Overloads for floating point types, to support NaN and infinity.

◆ StringToValue() [4/9]

static bool elastix::Conversion::StringToValue ( const std::string & str,
float & value )
static

Overloads for floating point types, to support NaN and infinity.

◆ StringToValue() [5/9]

static bool elastix::Conversion::StringToValue ( const std::string & str,
itk::Object *& value )
static

Overload to cast a string to an itk::Object pointer. Returns true when casting was successful and false otherwise.

◆ StringToValue() [6/9]

static bool elastix::Conversion::StringToValue ( const std::string & str,
signed char & value )
static

Overloads for (signed/unsigned) char types, processing them as 8-bits integer types.

◆ StringToValue() [7/9]

static bool elastix::Conversion::StringToValue ( const std::string & str,
std::string & value )
static

Provide a specialization for std::string, since the general StringToValue (especially outputStringStream >> value) will not work for strings containing spaces.

◆ StringToValue() [8/9]

template<class T >
static bool elastix::Conversion::StringToValue ( const std::string & str,
T & value )
inlinestatic

A templated function to cast strings to a type T. Returns true when casting was successful and false otherwise. We make use of the casting functionality of string streams.

Definition at line 174 of file elxConversion.h.

◆ StringToValue() [9/9]

static bool elastix::Conversion::StringToValue ( const std::string & str,
unsigned char & value )
static

Overloads for (signed/unsigned) char types, processing them as 8-bits integer types.

◆ ToNativePathNameSeparators()

static std::string elastix::Conversion::ToNativePathNameSeparators ( const std::string & )
static

Similar to Qt5 QDir::toNativeSeparators(const QString &pathName).

◆ ToOptimizerParameters()

static itk::OptimizerParameters< double > elastix::Conversion::ToOptimizerParameters ( const std::vector< double > & )
static

Converts the specified std::vector to an OptimizerParameters object.

◆ ToString() [1/4]

static std::string elastix::Conversion::ToString ( const bool arg)
inlinestatic

Convenience function overload to convert a Boolean to a text string.

Definition at line 77 of file elxConversion.h.

◆ ToString() [2/4]

template<typename TInteger >
static std::string elastix::Conversion::ToString ( const TInteger integerValue)
inlinestatic

Convenience function overload to convert an integer to a text string.

Definition at line 93 of file elxConversion.h.

◆ ToString() [3/4]

static std::string elastix::Conversion::ToString ( double )
static

Convenience function overload to convert a double precision floating point to a text string.

◆ ToString() [4/4]

static std::string elastix::Conversion::ToString ( float )
static

Convenience function overload to convert a single precision floating point to a text string.

◆ ToVectorOfStrings() [1/2]

template<typename T , unsigned int NRows, unsigned int NColumns>
static std::vector< std::string > elastix::Conversion::ToVectorOfStrings ( const itk::Matrix< T, NRows, NColumns > & matrix)
inlinestatic

Convenience function overload to convert a 2-D matrix to a vector of text strings. Typically used for an itk::ImageBase::DirectionType.

Definition at line 129 of file elxConversion.h.

◆ ToVectorOfStrings() [2/2]

template<typename TContainer , typename SFINAE = typename TContainer::iterator>
static std::vector< std::string > elastix::Conversion::ToVectorOfStrings ( const TContainer & container)
inlinestatic

Convenience function overload to convert a container to a vector of text strings. The container may be an itk::Size, itk::Index, itk::Point<double,N>, or itk::Vector<double,N>, or itk::OptimizationParameters<double>.

The C++ SFINAE idiom is being used to ensure that the argument type supports standard C++ iteration.

Definition at line 111 of file elxConversion.h.



Generated on 2024-07-17 for elastix by doxygen 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) elastix logo