1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506
|
Author: Flavien Bridault <fbridault@ircad.fr>
Description: Remove service that requires ITKFFT which is not available on i386
Forwarded: not-needed
diff --git c/lib/filter/image/CMakeLists.txt i/lib/filter/image/CMakeLists.txt
index 4ae5078..d5d7e6e 100644
--- c/lib/filter/image/CMakeLists.txt
+++ i/lib/filter/image/CMakeLists.txt
@@ -7,8 +7,8 @@ if(MSVC)
target_include_directories(filter_image SYSTEM PRIVATE ${VXL_CORE_INCLUDE_DIRS})
endif()
-find_package(ITK QUIET COMPONENTS ITKCommon ITKLabelMap ITKOptimizersv4 ITKTransform ITKFFT ITKStatistics REQUIRED)
-target_link_libraries(filter_image PUBLIC ITKCommon ITKLabelMap ITKOptimizersv4 ITKTransform ITKFFT ITKStatistics)
+find_package(ITK QUIET COMPONENTS ITKCommon ITKLabelMap ITKOptimizersv4 ITKTransform ITKStatistics REQUIRED)
+target_link_libraries(filter_image PUBLIC ITKCommon ITKLabelMap ITKOptimizersv4 ITKTransform ITKStatistics)
if(ITK_VERSION_MAJOR GREATER 4)
find_package(ITK QUIET COMPONENTS ITKSmoothing ITKRegistrationMethodsv4 REQUIRED)
--- sight.orig/module/filter/image/rc/plugin.xml
+++ sight/module/filter/image/rc/plugin.xml
@@ -56,12 +56,6 @@
</extension>
<extension implements="sight::service::extension::factory">
- <type>sight::service::registerer</type>
- <service>sight::module::filter::image::mip_matching_registration</service>
- <desc>This service uses a fast registration algorithm to quickly register two images together if the transform</desc>
- </extension>
-
- <extension implements="sight::service::extension::factory">
<type>sight::service::filter</type>
<service>sight::module::filter::image::matrix_regressor</service>
<object>sight::data::vector</object>
--- sight.orig/lib/filter/image/mip_matching_registration.hpp
+++ sight/lib/filter/image/mip_matching_registration.hpp
@@ -35,7 +35,6 @@
#include <io/itk/itk.hpp>
-#include <itkFFTNormalizedCorrelationImageFilter.h>
#include <itkIdentityTransform.h>
#include <itkLinearInterpolateImageFunction.h>
#include <itkMaximumProjectionImageFilter.h>
--- sight.orig/lib/filter/image/test/ut/mip_matching_registration_test.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-/************************************************************************
- *
- * Copyright (C) 2017-2024 IRCAD France
- * Copyright (C) 2017-2020 IHU Strasbourg
- *
- * This file is part of Sight.
- *
- * Sight is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Sight is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sight. If not, see <https://www.gnu.org/licenses/>.
- *
- ***********************************************************************/
-
-// cspell:ignore FFTWFFT
-
-#include "mip_matching_registration_test.hpp"
-
-#include "helper.hpp"
-
-#include <core/tools/dispatcher.hpp>
-
-#include <data/helper/medical_image.hpp>
-#include <data/matrix4.hpp>
-
-#include <filter/image/metric.hpp>
-#include <filter/image/mip_matching_registration.hpp>
-#include <filter/image/resampler.hpp>
-
-#include <io/itk/itk.hpp>
-
-#include <utest_data/generator/image.hpp>
-
-#include <glm/gtc/matrix_access.hpp>
-#include <glm/gtc/matrix_transform.hpp>
-#include <glm/gtc/quaternion.hpp>
-#include <glm/mat4x4.hpp>
-
-#include <itkImage.h>
-#include <itkRegionOfInterestImageFilter.h>
-#include <itkResampleImageFilter.h>
-
-#if ITK_VERSION_MAJOR >= 5 && ITK_VERSION_MINOR >= 3 && defined(__unix__)
-#include <itkFFTWFFTImageFilterInitFactory.h>
-#endif
-
-CPPUNIT_TEST_SUITE_REGISTRATION(sight::filter::image::ut::mip_matching_registration_test);
-
-namespace sight::filter::image::ut
-{
-
-//------------------------------------------------------------------------------
-
-void mip_matching_registration_test::setUp()
-{
-#if ITK_VERSION_MAJOR >= 5 && ITK_VERSION_MINOR >= 3 && defined(__unix__)
- auto factory = ::itk::FFTWFFTImageFilterInitFactory::New();
- factory->RegisterFactories();
-#endif
-}
-
-//------------------------------------------------------------------------------
-
-void mip_matching_registration_test::tearDown()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void mip_matching_registration_test::identity_test()
-{
- data::image::csptr moving = create_sphere_image<std::uint16_t, 3>();
- data::image::csptr fixed = data::object::copy(moving);
- data::matrix4::sptr mat = std::make_shared<data::matrix4>();
-
- filter::image::registration_dispatch::parameters params;
- params.fixed = fixed;
- params.moving = moving;
- params.transform = std::make_shared<data::matrix4>();
- core::type type = moving->type();
- core::tools::dispatcher<core::tools::supported_dispatcher_types, registration_dispatch>::invoke(type, params);
-
- for(std::size_t i = 0 ; i != 3 ; ++i)
- {
- CPPUNIT_ASSERT_EQUAL_MESSAGE(
- "Translation value is not equal to '0' ",
- 0.,
- (*params.transform)(i, 3)
- );
- }
-}
-
-//------------------------------------------------------------------------------
-
-void mip_matching_registration_test::translate_transform_test()
-{
- data::image::csptr moving = create_sphere_image<std::uint16_t, 3>();
- data::image::sptr fixed = std::make_shared<data::image>();
-
- data::matrix4::sptr transform = std::make_shared<data::matrix4>();
- (*transform)(0, 3) = 4.;
- (*transform)(1, 3) = 12.;
- (*transform)(2, 3) = 7.;
- sight::filter::image::resampler::resample(moving, fixed, transform);
-
- std::array<double, 3> expected {{4., 12., 7.}};
- filter::image::registration_dispatch::parameters params;
- params.fixed = fixed;
- params.moving = moving;
- params.transform = std::make_shared<data::matrix4>();
- core::type type = moving->type();
- core::tools::dispatcher<core::tools::supported_dispatcher_types, registration_dispatch>::invoke(type, params);
- for(std::size_t i = 0 ; i < 3 ; ++i)
- {
- CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
- "Actual transform does not match expected results",
- expected[i],
- (*params.transform)(i, 3),
- 1e-2
- );
- }
-}
-
-//------------------------------------------------------------------------------
-
-void mip_matching_registration_test::translate_transform_with_scales_test()
-{
- using image_t = itk::Image<std::uint16_t, 3>;
-
- // Create the moving image
- auto moving_spacing = image_t::SpacingType(1.);
- moving_spacing[1] = 1.3;
- data::image::sptr moving = create_sphere_image<std::uint16_t, 3>(moving_spacing);
- data::image::sptr fixed = std::make_shared<data::image>();
- moving->set_origin({107., 50., -30.});
-
- // Translate the image a bit
- std::array<double, 3> v_trans {{4., 19., 7.}};
- data::matrix4::sptr transform = std::make_shared<data::matrix4>();
- (*transform)(0, 3) = v_trans[0];
- (*transform)(1, 3) = v_trans[1];
- (*transform)(2, 3) = v_trans[2];
- sight::filter::image::resampler::resample(moving, fixed, transform);
- auto fixed_origin = std::array<double, 3> {{20., 10., 35.}};
- auto moving_origin = moving->origin();
- fixed->set_origin(fixed_origin);
- std::array<float, 3> expected {
- {
- float(moving_origin[0] + v_trans[0] - fixed_origin[0]),
- float(moving_origin[1] + v_trans[1] - fixed_origin[1]),
- float(moving_origin[2] + v_trans[2] - fixed_origin[2])
- }
- };
-
- auto itk_fixed = io::itk::move_to_itk<image_t>(fixed);
-
- // Resample the image to get a different spacing
- image_t::SizeType new_size {};
- image_t::SpacingType new_spacing(2.);
- for(uint8_t i = 0 ; i != 3 ; ++i)
- {
- new_size[i] = static_cast<unsigned int>(moving_spacing[i] / new_spacing[i] * double(moving->size()[i]));
- }
-
- auto resample = itk::ResampleImageFilter<image_t, image_t>::New();
- resample->SetInput(itk_fixed);
- resample->SetSize(new_size);
- resample->SetOutputSpacing(new_spacing);
- resample->SetOutputOrigin(itk_fixed->GetOrigin());
- resample->Update();
- auto* resampled = resample->GetOutput();
- auto resampled_f4s_fixed = io::itk::move_from_itk<image_t>(resampled, true);
-
- filter::image::registration_dispatch::parameters params;
- params.fixed = resampled_f4s_fixed;
- params.moving = moving;
- params.transform = std::make_shared<data::matrix4>();
- core::type type = moving->type();
- core::tools::dispatcher<core::tools::supported_dispatcher_types, registration_dispatch>::invoke(type, params);
- for(std::size_t i = 0 ; i < 3 ; ++i)
- {
- CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
- "Actual transform does not match expected results",
- double(expected[i]),
- (*params.transform)(i, 3),
- double(moving_spacing[std::uint32_t(i)])
- );
- }
-}
-
-} // namespace sight::filter::image::ut
--- sight.orig/lib/filter/image/test/ut/mip_matching_registration_test.hpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/************************************************************************
- *
- * Copyright (C) 2021-2023 IRCAD France
- * Copyright (C) 2018 IHU Strasbourg
- *
- * This file is part of Sight.
- *
- * Sight is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Sight is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sight. If not, see <https://www.gnu.org/licenses/>.
- *
- ***********************************************************************/
-
-#pragma once
-
-#include <cppunit/extensions/HelperMacros.h>
-
-namespace sight::filter::image::ut
-{
-
-class mip_matching_registration_test : public CPPUNIT_NS::TestFixture
-{
-CPPUNIT_TEST_SUITE(mip_matching_registration_test);
-CPPUNIT_TEST(identity_test);
-CPPUNIT_TEST(translate_transform_test);
-CPPUNIT_TEST(translate_transform_with_scales_test);
-CPPUNIT_TEST_SUITE_END();
-
-public:
-
- void setUp() override;
- void tearDown() override;
-
- static void identity_test();
- static void translate_transform_test();
- static void translate_transform_with_scales_test();
-};
-
-} // namespace sight::filter::image::ut
--- sight.orig/module/filter/image/mip_matching_registration.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/************************************************************************
- *
- * Copyright (C) 2017-2024 IRCAD France
- * Copyright (C) 2017-2020 IHU Strasbourg
- *
- * This file is part of Sight.
- *
- * Sight is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Sight is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sight. If not, see <https://www.gnu.org/licenses/>.
- *
- ***********************************************************************/
-
-#include "mip_matching_registration.hpp"
-
-#include <core/tools/dispatcher.hpp>
-
-#include <filter/image/mip_matching_registration.hpp>
-#include <filter/image/resampler.hpp>
-
-#include <geometry/data/matrix4.hpp>
-
-#include <functional>
-#include <numeric>
-
-namespace sight::module::filter::image
-{
-
-//------------------------------------------------------------------------------
-
-void mip_matching_registration::starting()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void mip_matching_registration::stopping()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void mip_matching_registration::configuring()
-{
-}
-
-//------------------------------------------------------------------------------
-
-void mip_matching_registration::updating()
-{
- const auto fixed = m_target.lock();
- const auto moving = m_source.lock();
- auto transform = m_transform.lock();
-
- SIGHT_ASSERT("Missing required input 'fixed'", fixed);
- SIGHT_ASSERT("Missing required input 'moving'", moving);
- SIGHT_ASSERT("Missing required inout 'transform'", transform);
-
- sight::filter::image::registration_dispatch::parameters params;
- params.fixed = fixed.get_shared();
- params.moving = moving.get_shared();
- params.transform = transform.get_shared();
-
- core::type type = moving->type();
- core::tools::dispatcher<core::tools::supported_dispatcher_types, sight::filter::image::registration_dispatch>
- ::invoke(type, params);
-
- transform->signal<data::matrix4::modified_signal_t>(data::matrix4::MODIFIED_SIG)->async_emit();
-}
-
-//------------------------------------------------------------------------------
-
-void mip_matching_registration::compute_registration(core::clock::type /*timestamp*/)
-{
- this->updating();
-}
-
-} // namespace sight::module::filter::image
--- sight.orig/module/filter/image/mip_matching_registration.hpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/************************************************************************
- *
- * Copyright (C) 2018-2024 IRCAD France
- * Copyright (C) 2018-2019 IHU Strasbourg
- *
- * This file is part of Sight.
- *
- * Sight is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Sight is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sight. If not, see <https://www.gnu.org/licenses/>.
- *
- ***********************************************************************/
-
-#pragma once
-
-#include <data/image.hpp>
-#include <data/matrix4.hpp>
-
-#include <service/registerer.hpp>
-
-namespace sight::module::filter::image
-{
-
-/**
- * @brief This service uses a fast registration algorithm to quickly register two images together if the transform
- * between both is pure translation.
- *
- * @section Signals Signals
- *
- * @section Slots Slots
- * - \b update: compute the registration
- *
- * @section XML XML Configuration
- *
- * @code{.xml}
- <service uid="..." type="sight::module::filter::image::SFastRegistration">
- <in key="source" uid="..." />
- <in key="target" uid="..." />
- <in key="transform" uid="..." />
- </service>
- * @endcode
- *
- * @subsection Input Input
- * - \b source [sight::data::image]: Input image that will be aligned to the target.
- * - \b target [sight::data::image]: Input image to which the source will be aligned.
- *
- * @subsection In-Out In-Out
- * - \b transform [sight::data::matrix4]: initial registration. The computed registration will be
- * concatenated to the initial registration matrix.
- */
-class mip_matching_registration : public service::registerer
-{
-public:
-
- SIGHT_DECLARE_SERVICE(mip_matching_registration, service::registerer);
-
- /**
- * @brief Constructor
- */
- mip_matching_registration() noexcept = default;
- /**
- * @brief Destructor
- */
- ~mip_matching_registration() noexcept override = default;
-
-protected:
-
- /**
- * @brief Starts the service.
- *
- * @throw core::tools::failed
- */
- void starting() override;
-
- /**
- * @brief Stops the service.
- *
- * @throw core::tools::failed
- */
- void stopping() override;
-
- /**
- * @brief Configures the service.
- *
- * @throw core::tools::failed
- */
- void configuring() override;
-
- /**
- * @brief Compute the registration.
- *
- * @throw core::tools::failed
- */
- void updating() override;
-
- /**
- * @brief Compute the registration by calling the `update` slot. The timestamp parameter is discarded.
- */
- void compute_registration(core::clock::type _timestamp) override;
-
-private:
-
- sight::data::ptr<sight::data::image, sight::data::access::in> m_source {this, "fixed"};
- sight::data::ptr<sight::data::image, sight::data::access::in> m_target {this, "moving"};
- sight::data::ptr<sight::data::matrix4, sight::data::access::inout> m_transform {this, "transform"};
-};
-
-} // namespace sight::module::filter::image
|