diff --git a/Core/Install/elxBaseComponent.cxx b/Core/Install/elxBaseComponent.cxx index cb237b516..bcbd03d2f 100644 --- a/Core/Install/elxBaseComponent.cxx +++ b/Core/Install/elxBaseComponent.cxx @@ -22,9 +22,9 @@ namespace { -bool IsElastixLibrary(const bool initialValue = false) +bool IsElastixLibrary(const bool initialValue = true) { - // By default, assume that this is not the elastix library. + // By default, assume that this is the elastix library (not the elastix executable). // Note that the initialization of this static variable is thread-safe, // as supported by C++11 "magic statics". @@ -77,9 +77,9 @@ bool BaseComponent::IsElastixLibrary() return ::IsElastixLibrary(); } -void BaseComponent::InitializeElastixLibrary() +void BaseComponent::InitializeElastixExecutable() { - ::IsElastixLibrary(true); + ::IsElastixLibrary(false); } /** diff --git a/Core/Install/elxBaseComponent.h b/Core/Install/elxBaseComponent.h index acafdfd53..c2786de2d 100644 --- a/Core/Install/elxBaseComponent.h +++ b/Core/Install/elxBaseComponent.h @@ -124,7 +124,7 @@ class BaseComponent static bool IsElastixLibrary(); - static void InitializeElastixLibrary(); + static void InitializeElastixExecutable(); /** Convenience function to convert seconds to day, hour, minute, second format. */ std::string ConvertSecondsToDHMS( const double totalSeconds, const unsigned int precision ) const; diff --git a/Core/Main/elastix.cxx b/Core/Main/elastix.cxx index e575cc2dc..ec00269f9 100644 --- a/Core/Main/elastix.cxx +++ b/Core/Main/elastix.cxx @@ -38,6 +38,8 @@ int main( int argc, char ** argv ) { + elastix::BaseComponent::InitializeElastixExecutable(); + assert( ! elastix::BaseComponent::IsElastixLibrary() ); /** Check if "--help" or "--version" was asked for. */ if( argc == 1 ) diff --git a/Core/Main/elastixlib.cxx b/Core/Main/elastixlib.cxx index 8e9c96aed..fd518045a 100644 --- a/Core/Main/elastixlib.cxx +++ b/Core/Main/elastixlib.cxx @@ -48,7 +48,6 @@ namespace elastix ELASTIX::ELASTIX() { - BaseComponent::InitializeElastixLibrary(); assert(BaseComponent::IsElastixLibrary()); } diff --git a/Core/Main/transformix.cxx b/Core/Main/transformix.cxx index 2d214efeb..1654a5734 100644 --- a/Core/Main/transformix.cxx +++ b/Core/Main/transformix.cxx @@ -31,6 +31,9 @@ int main( int argc, char ** argv ) { + elastix::BaseComponent::InitializeElastixExecutable(); + assert(!elastix::BaseComponent::IsElastixLibrary()); + /** Check if "-help" or "--version" was asked for.*/ if( argc == 1 ) {