Skip to content

Commit

Permalink
STYLE: Remove m_ParameterFileParser from Configuration
Browse files Browse the repository at this point in the history
The `ParameterFileParser` object is only used in one of the `Initialize` member functions of `Configuration`. Better to just declare it local to this particular member function.
  • Loading branch information
N-Dekker committed Feb 1, 2025
1 parent 3b95f24 commit 03df453
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 5 additions & 3 deletions Core/Configuration/elxConfiguration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,14 @@ Configuration::Initialize(const CommandLineArgumentMapType & _arg)
return 1;
}

const auto parameterFileParser = itk::ParameterFileParser::New();

/** Read the ParameterFile. */
m_ParameterFileParser->SetParameterFileName(m_ParameterFileName);
parameterFileParser->SetParameterFileName(m_ParameterFileName);
try
{
log::info("Reading the elastix parameters from file ...\n");
m_ParameterFileParser->ReadParameterFile();
parameterFileParser->ReadParameterFile();
}
catch (const itk::ExceptionObject & excp)
{
Expand All @@ -195,7 +197,7 @@ Configuration::Initialize(const CommandLineArgumentMapType & _arg)

/** Connect the parameter file reader to the interface. */
m_ParameterMapInterface->SetParameterMap(
AddDataFromExternalTransformFile(m_ParameterFileName, m_ParameterFileParser->GetParameterMap()));
AddDataFromExternalTransformFile(m_ParameterFileName, parameterFileParser->GetParameterMap()));

/** Silently check in the parameter file if error messages should be printed. */
m_ParameterMapInterface->SetPrintErrorMessages(false);
Expand Down
1 change: 0 additions & 1 deletion Core/Configuration/elxConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ class Configuration
private:
CommandLineArgumentMapType m_CommandLineArgumentMap{};
std::string m_ParameterFileName{};
const itk::ParameterFileParser::Pointer m_ParameterFileParser{ itk::ParameterFileParser::New() };
const itk::ParameterMapInterface::Pointer m_ParameterMapInterface{ itk::ParameterMapInterface::New() };

bool m_IsInitialized{ false };
Expand Down

0 comments on commit 03df453

Please sign in to comment.