Skip to content

Commit

Permalink
STYLE: Replace Get/SetParameterMap calls with Get/SetParameterMaps
Browse files Browse the repository at this point in the history
Follow-up to pull request #848 commit 38b6152 "ENH: Add GetParameterMaps and SetParameterMaps to ParameterObject".
  • Loading branch information
N-Dekker committed Mar 29, 2023
1 parent 28be9d5 commit 08dc30a
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Core/Main/GTesting/elxCoreMainGTestUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ std::vector<double>
GetTransformParametersFromFilter(TFilter & filter)
{
const auto transformParameterObject = filter.GetTransformParameterObject();
const auto & transformParameterMaps = DerefRawPointer(transformParameterObject).GetParameterMap();
const auto & transformParameterMaps = DerefRawPointer(transformParameterObject).GetParameterMaps();
return GetTransformParametersFromMaps(transformParameterMaps);
}

Expand Down
4 changes: 2 additions & 2 deletions Core/Main/GTesting/itkElastixRegistrationMethodGTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ GTEST_TEST(itkElastixRegistrationMethod, SetInitialTransformParameterObject)
registration.Update();

const auto & transformParameterMaps =
DerefRawPointer(registration.GetTransformParameterObject()).GetParameterMap();
DerefRawPointer(registration.GetTransformParameterObject()).GetParameterMaps();

ASSERT_EQ(transformParameterMaps.size(), numberOfParameterMaps);

Expand Down Expand Up @@ -766,7 +766,7 @@ GTEST_TEST(itkElastixRegistrationMethod, InitialTransformParameterFileLinkToTran
registration.Update();
const elx::ParameterObject & transformParameterObject =
DerefRawPointer(registration.GetTransformParameterObject());
const auto & transformParameterMaps = transformParameterObject.GetParameterMap();
const auto & transformParameterMaps = transformParameterObject.GetParameterMaps();
EXPECT_EQ(transformParameterMaps.size(), 1);
return Front(transformParameterMaps);
};
Expand Down
4 changes: 2 additions & 2 deletions Core/Main/GTesting/itkTransformixFilterGTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ GTEST_TEST(itkTransformixFilter, UpdateThrowsExceptionOnZeroParameterMaps)
{ "Size", ConvertToParameterValues(imageSize) },
{ "Spacing", ParameterValuesType(ImageDimension, "1") } } };

transformParameterObject.SetParameterMap(parameterMaps);
transformParameterObject.SetParameterMaps(parameterMaps);

elx::DefaultConstruct<itk::TransformixFilter<ImageType>> transformixFilter{};
transformixFilter.SetMovingImage(&image);
Expand Down Expand Up @@ -1227,7 +1227,7 @@ GTEST_TEST(itkTransformixFilter, SetCompositeTransformOfTranslationAndScale)
for (size_t numberOfParameterMaps{ 1 }; numberOfParameterMaps <= 3; ++numberOfParameterMaps)
{
elx::DefaultConstruct<elx::ParameterObject> transformParameterObject{};
transformParameterObject.SetParameterMap(ParameterMapVectorType(numberOfParameterMaps, transformParameterMap));
transformParameterObject.SetParameterMaps(ParameterMapVectorType(numberOfParameterMaps, transformParameterMap));

elx::DefaultConstruct<itk::TransformixFilter<ImageType>> transformixFilter{};
transformixFilter.SetMovingImage(inputImage);
Expand Down
4 changes: 2 additions & 2 deletions Core/Main/elxParameterObject.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void
ParameterObject::SetParameterMap(const ParameterMapType & parameterMap)
{
ParameterMapVectorType parameterMapVector = ParameterMapVectorType(1, parameterMap);
this->SetParameterMap(parameterMapVector);
this->SetParameterMaps(parameterMapVector);
}

/**
Expand Down Expand Up @@ -198,7 +198,7 @@ ParameterObject::RemoveParameter(const ParameterKeyType & key)
void
ParameterObject::ReadParameterFile(const ParameterFileNameType & parameterFileName)
{
this->SetParameterMap(ParameterMapVectorType{ itk::ParameterFileParser::ReadParameterMap(parameterFileName) });
this->SetParameterMaps({ itk::ParameterFileParser::ReadParameterMap(parameterFileName) });
}


Expand Down
6 changes: 3 additions & 3 deletions Core/Main/itkElastixRegistrationMethod.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ ElastixRegistrationMethod<TFixedImage, TMovingImage>::GenerateData()
// Set ParameterMap
ParameterObjectPointer parameterObject =
itkDynamicCastInDebugMode<elx::ParameterObject *>(this->ProcessObject::GetInput("ParameterObject"));
ParameterMapVectorType parameterMapVector = parameterObject->GetParameterMap();
ParameterMapVectorType parameterMapVector = parameterObject->GetParameterMaps();

if (parameterMapVector.empty())
{
Expand Down Expand Up @@ -234,7 +234,7 @@ ElastixRegistrationMethod<TFixedImage, TMovingImage>::GenerateData()
{
isError = ((i == 0) && m_InitialTransformParameterObject)
? elastixMain->RunWithInitialTransformParameterMaps(
argumentMap, parameterMap, m_InitialTransformParameterObject->GetParameterMap())
argumentMap, parameterMap, m_InitialTransformParameterObject->GetParameterMaps())
: elastixMain->Run(argumentMap, parameterMap);
}
catch (const itk::ExceptionObject & e)
Expand Down Expand Up @@ -285,7 +285,7 @@ ElastixRegistrationMethod<TFixedImage, TMovingImage>::GenerateData()

// Save parameter map
elx::ParameterObject::Pointer transformParameterObject = elx::ParameterObject::New();
transformParameterObject->SetParameterMap(transformParameterMapVector);
transformParameterObject->SetParameterMaps(transformParameterMapVector);
this->SetNthOutput(1, transformParameterObject);
}

Expand Down
2 changes: 1 addition & 1 deletion Core/Main/itkTransformixFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ TransformixFilter<TMovingImage>::GenerateData()

// Get ParameterMap
ParameterObjectPointer transformParameterObject = this->GetTransformParameterObject();
ParameterMapVectorType transformParameterMapVector = transformParameterObject->GetParameterMap();
ParameterMapVectorType transformParameterMapVector = transformParameterObject->GetParameterMaps();

// Assert user did not set empty parameter map
if (transformParameterMapVector.empty())
Expand Down
2 changes: 1 addition & 1 deletion dox/externalproject/ElastixTranslationExample.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ main()
const auto * const transformParameterObject = filter->GetTransformParameterObject();
assert(transformParameterObject != nullptr);

const auto & transformParameterMaps = transformParameterObject->GetParameterMap();
const auto & transformParameterMaps = transformParameterObject->GetParameterMaps();
assert(!transformParameterMaps.empty());

const auto & transformParameterMap = transformParameterMaps.front();
Expand Down

0 comments on commit 08dc30a

Please sign in to comment.