Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions localizer/lib/ai_decoupling.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ def decouple_image(self, input_node, modality, **kwargs):
tmp_path = str(self.plugin_path / "tmp.nii")
slicer.util.saveNode(input_node, tmp_path)

# Build command using new subcommand format
# Build command using the current ADAD subcommand.
cmd = [
str(self.executable_path),
"decouple",
"adad",
"--input", tmp_path,
"--output", str(self.plugin_path / "Normalized.nii"),
"--modality", normalized_modality
]

print(f"Running decouple command: {' '.join(cmd)}")
print(f"Running ADAD command: {' '.join(cmd)}")
try:
result = subprocess.run(cmd, capture_output=True, text=True, cwd=self.plugin_path)
except Exception as e:
Expand Down
2 changes: 1 addition & 1 deletion localizer/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CMakeList.txt: DCCCcore Refactored Version
cmake_minimum_required(VERSION 3.21)

project(DCCCcore VERSION 4.2.5)
project(DCCCcore VERSION 4.2.6)
set(DCCCCORE_VERSION_SUFFIX "")
set(DCCCCORE_SOFTWARE_VERSION "${PROJECT_VERSION}${DCCCCORE_VERSION_SUFFIX}")

Expand Down
2 changes: 1 addition & 1 deletion localizer/src/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class AppConan(ConanFile):
name = "DCCCcore"
version = "4.2.5"
version = "4.2.6"
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain"

Expand Down
2 changes: 1 addition & 1 deletion localizer/src/core/config/Version.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once
#include <string>

const std::string SOFTWARE_VERSION = "4.2.5";
const std::string SOFTWARE_VERSION = "4.2.6";
47 changes: 47 additions & 0 deletions localizer/src/tests/test_ui_ai_decoupling.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import importlib
import sys
import types
from pathlib import Path


def _load_ai_decoupling_logic():
if "slicer" not in sys.modules:
sys.modules["slicer"] = types.SimpleNamespace(
util=types.SimpleNamespace(saveNode=lambda *_args: True)
)
else:
slicer_module = sys.modules["slicer"]
if not hasattr(slicer_module, "util"):
slicer_module.util = types.SimpleNamespace()
slicer_module.util.saveNode = lambda *_args: True

repo_root = Path(__file__).resolve().parents[3]
sys.path.insert(0, str(repo_root / "localizer" / "lib"))
module = importlib.import_module("ai_decoupling")
return module, module.AIDecouplingLogic


def test_decouple_image_uses_adad_subcommand(monkeypatch):
module, logic_type = _load_ai_decoupling_logic()
logic = logic_type("/tmp/plugin")
captured = {}

def fake_run(command, **kwargs):
captured["command"] = command
captured["kwargs"] = kwargs
return types.SimpleNamespace(returncode=0, stdout="ADAD score: 1", stderr="")

monkeypatch.setattr(module.subprocess, "run", fake_run)
monkeypatch.setattr(
logic,
"_load_result_volumes",
lambda: (object(), object(), object()),
)

input_node = types.SimpleNamespace(GetName=lambda: "PET")
success, *_ = logic.decouple_image(input_node, "Abeta")

assert success
assert captured["command"][:2] == [str(logic.executable_path), "adad"]
assert captured["command"][-2:] == ["--modality", "abeta"]
assert captured["kwargs"]["cwd"] == Path("/tmp/plugin")
Loading