Skip to content

Commit

Permalink
ENH: Print the parameter map to log, when there is no parameter file
Browse files Browse the repository at this point in the history
- Addresses issue #1284 "Let library also print the input parameters to log file".
  • Loading branch information
N-Dekker committed Feb 3, 2025
1 parent 1704f0c commit 73a299e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Core/Configuration/elxConfiguration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,32 @@ Configuration::PrintParameterFile() const
} // end PrintParameterFile()


/**
* ******************** PrintParameterMap ***************************
*/

void
Configuration::PrintParameterMap() const
{
// Separate clearly in log-file, before and after writing the parameter map.
log::info_to_log_file(std::ostringstream{}
<< "\n=============== start of ParameterMap ===============\n"
<< Conversion::ParameterMapToString(m_ParameterMapInterface->GetParameterMap())
<< "\n=============== end of ParameterMap ===============\n");

} // end PrintParameterMap()
/**
* ************************ BeforeAll ***************************
*/

int
Configuration::BeforeAll()
{
if (!BaseComponent::IsElastixLibrary())
if (m_ParameterFileName.empty())
{
this->PrintParameterMap();
}
else
{
this->PrintParameterFile();
}
Expand Down
4 changes: 4 additions & 0 deletions Core/Configuration/elxConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,10 @@ class Configuration
void
PrintParameterFile() const;

/** Print the parameter map to the log file. */
void
PrintParameterMap() const;

private:
CommandLineArgumentMapType m_CommandLineArgumentMap{};
std::string m_ParameterFileName{};
Expand Down

0 comments on commit 73a299e

Please sign in to comment.