From 9761a0753d23585a3316c70416e1372edd6da0e2 Mon Sep 17 00:00:00 2001 From: tctco Date: Tue, 26 May 2026 00:05:59 +0800 Subject: [PATCH] Enable iterative rigid alignment --- localizer/src/CMakeLists.txt | 4 ++-- localizer/src/README.md | 1 + localizer/src/conanfile.py | 2 +- localizer/src/core/config/Version.h | 2 +- .../spatialNormalizations/rigid/RigidCLI.cpp | 6 ++++++ localizer/src/tests/test_normalize_cli.py | 18 ++++++++++++++++++ 6 files changed, 29 insertions(+), 4 deletions(-) diff --git a/localizer/src/CMakeLists.txt b/localizer/src/CMakeLists.txt index eeb1fd3..6628a02 100644 --- a/localizer/src/CMakeLists.txt +++ b/localizer/src/CMakeLists.txt @@ -1,8 +1,8 @@ # CMakeList.txt: DCCCcore Refactored Version cmake_minimum_required(VERSION 3.21) -project(DCCCcore VERSION 4.2.0) -set(DCCCCORE_VERSION_SUFFIX "-alpha") +project(DCCCcore VERSION 4.2.1) +set(DCCCCORE_VERSION_SUFFIX "") set(DCCCCORE_SOFTWARE_VERSION "${PROJECT_VERSION}${DCCCCORE_VERSION_SUFFIX}") # Set C++ standard diff --git a/localizer/src/README.md b/localizer/src/README.md index baf68e8..20bff5f 100644 --- a/localizer/src/README.md +++ b/localizer/src/README.md @@ -113,6 +113,7 @@ Perform spatial standardization without metric calculation: # Iterative rigid registration ./DCCCcore normalize --input pet.nii --output normalized.nii --iterative ./DCCCcore adni-pet-core --input pet.nii --output normalized.nii --iterative +./DCCCcore rigid --input pet.nii --output rigid.nii --iterative ``` #### ADAD Analysis diff --git a/localizer/src/conanfile.py b/localizer/src/conanfile.py index 52ae7f2..f41356f 100644 --- a/localizer/src/conanfile.py +++ b/localizer/src/conanfile.py @@ -4,7 +4,7 @@ class AppConan(ConanFile): name = "DCCCcore" - version = "4.2.0-alpha" + version = "4.2.1" settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "CMakeToolchain" diff --git a/localizer/src/core/config/Version.h b/localizer/src/core/config/Version.h index a28a284..8cacdb5 100644 --- a/localizer/src/core/config/Version.h +++ b/localizer/src/core/config/Version.h @@ -1,4 +1,4 @@ #pragma once #include -const std::string SOFTWARE_VERSION = "4.2.0-alpha"; +const std::string SOFTWARE_VERSION = "4.2.1"; diff --git a/localizer/src/spatialNormalizations/rigid/RigidCLI.cpp b/localizer/src/spatialNormalizations/rigid/RigidCLI.cpp index 8bfe373..902f50b 100644 --- a/localizer/src/spatialNormalizations/rigid/RigidCLI.cpp +++ b/localizer/src/spatialNormalizations/rigid/RigidCLI.cpp @@ -23,6 +23,10 @@ class RigidCLI final : public ISpatialNormalizationCLI { void configureArguments(argparse::ArgumentParser& parser) override { addBaseArguments(parser); + parser.add_argument("-i", "--iterative") + .help("Use iterative rigid transformation") + .default_value(false) + .implicit_value(true); } int execute(const argparse::ArgumentParser& parser, const std::string& fullCommand) override { @@ -30,6 +34,7 @@ class RigidCLI final : public ISpatialNormalizationCLI { options.inputPath = parser.get("--input"); options.outputPath = parser.get("--output"); options.configPath = parser.get("--config"); + options.useIterativeRigid = parser.get("--iterative"); options.enableDebugOutput = parser.get("--debug"); if (!Common::fs::ensureParentDirectory(options.outputPath)) { @@ -56,6 +61,7 @@ class RigidCLI final : public ISpatialNormalizationCLI { request.inputPath = options.inputPath; request.skip = false; request.options.rigidOnly = true; + request.options.useIterativeRigid = options.useIterativeRigid; request.options.enableDebugOutput = options.enableDebugOutput; request.options.debugOutputBasePath = options.debugOutputBasePath; diff --git a/localizer/src/tests/test_normalize_cli.py b/localizer/src/tests/test_normalize_cli.py index 8835cda..20e5932 100644 --- a/localizer/src/tests/test_normalize_cli.py +++ b/localizer/src/tests/test_normalize_cli.py @@ -55,3 +55,21 @@ def test_iterative_flag(self, run_subprocess, tmp_path, test_files): ) assert output_path.exists(), "normalize --iterative did not create the expected output file." + def test_rigid_iterative_flag(self, run_subprocess, tmp_path, test_files): + output_path = tmp_path / "rigid_iterative_output.nii" + result = run_subprocess( + [ + "rigid", + "--input", + str(test_files["input"]), + "--output", + str(output_path), + "--iterative", + ] + ) + + assert result.returncode == 0, ( + "rigid command with --iterative failed.\n" + f"STDOUT:\n{result.stdout}\nSTDERR:\n{result.stderr}" + ) + assert output_path.exists(), "rigid --iterative did not create the expected output file."