Skip to content

Conversation

@N-Dekker
Copy link
Member

Removed those nine member function pointers as well as the 28 member functions that they could point to, and added nine switch (m_SelectedMethod) statements instead.

@N-Dekker N-Dekker marked this pull request as draft May 7, 2023 09:12
Removed those nine member function pointers as well as the 28 member functions that they could point to, and added nine `switch (m_SelectedMethod)` statements instead.
@N-Dekker N-Dekker force-pushed the Remove-AdvancedCombinationTransform-member-function-pointers branch from 4a80e38 to 5e2772a Compare May 10, 2023 16:42
@N-Dekker
Copy link
Member Author

N-Dekker commented May 10, 2023

To my surprise, the cleanup proposed by this PR appears to possibly slow down a "default" registration! 😞 At least, that's what I observed on VS2019 Release, on the following code:

constexpr auto imageDimension = 3U;
using PixelType = float;
using ImageType = itk::Image<PixelType, imageDimension>;

const auto fixedImage = itk::ReadImage<ImageType>("F:\\ITKElastix\\examples\\data\\CT_3D_lung_fixed.mha");
const auto movingImage = itk::ReadImage<ImageType>("F:\\ITKElastix\\examples\\data\\CT_3D_lung_moving.mha");

for (int i{}; i < 5; ++i)
{
  elx::DefaultConstruct<itk::ElastixRegistrationMethod<ImageType, ImageType>> registration{};

  // Do a registration, using the default parameter maps of ElastixRegistrationMethod. May take some time!
  registration.SetFixedImage(fixedImage);
  registration.SetMovingImage(movingImage);

  using namespace std::chrono;
  const auto timePointBeforeUpdate = high_resolution_clock::now();
  registration.Update();
  const auto timePointAfterUpdate = high_resolution_clock::now();
  const auto durationSeconds = duration_cast<duration<double>>(timePointAfterUpdate - timePointBeforeUpdate);
  std::cout << " Duration: " << durationSeconds.count() << " second(s)" << std::endl;
}

At the main branch: ~33 seconds. With this PR: ~37 sec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants