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: 4 additions & 2 deletions localizer/lib/ai_decoupling.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@

try:
from .macos_security import append_macos_security_hint
from .core_executable import dccccore_executable_path
except ImportError:
from macos_security import append_macos_security_hint
from core_executable import dccccore_executable_path


class AIDecouplingLogic:
Expand All @@ -31,7 +33,7 @@ def __init__(self, plugin_path):
plugin_path: Plugin directory path
"""
self.plugin_path = Path(plugin_path)
self.executable_path = self.plugin_path / "cpp" / "CentiloidCalculator"
self.executable_path = dccccore_executable_path(self.plugin_path)
self.executable_dir = self.plugin_path / "cpp"
self.last_volume_name = None

Expand Down Expand Up @@ -138,7 +140,7 @@ def _load_result_volumes(self):
Returns:
tuple: (foreground_node, background_node, stripped_node)
"""
# Expected output file patterns (may vary based on CentiloidCalculator version)
# Expected output file patterns (may vary based on DCCCcore version)
potential_files = {
"foreground": "Normalized_AD_prob_map.nii",
"background": "Normalized.nii",
Expand Down
12 changes: 12 additions & 0 deletions localizer/lib/core_executable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""Resolve the bundled DCCCcore executable path."""

import sys
from pathlib import Path


def dccccore_executable_path(plugin_path, platform=None):
"""Return the platform-specific DCCCcore executable bundled with the UI."""

platform = platform or sys.platform
executable_name = "DCCCcore.exe" if platform == "win32" else "DCCCcore"
return Path(plugin_path) / "cpp" / executable_name
6 changes: 4 additions & 2 deletions localizer/lib/metric_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Metric calculation module for PET semi-quantitative analysis

Contains functionality for Centiloid, CenTauR, and CenTauRz calculations
using the new subcommand-based CentiloidCalculator executable
using the subcommand-based DCCCcore executable
"""

import os
Expand All @@ -14,8 +14,10 @@

try:
from .macos_security import append_macos_security_hint
from .core_executable import dccccore_executable_path
except ImportError:
from macos_security import append_macos_security_hint
from core_executable import dccccore_executable_path


class MetricCalculatorLogic:
Expand All @@ -42,7 +44,7 @@ def __init__(self, plugin_path):
plugin_path: Plugin directory path
"""
self.plugin_path = Path(plugin_path)
self.executable_path = self.plugin_path / "cpp" / "CentiloidCalculator"
self.executable_path = dccccore_executable_path(self.plugin_path)
self.last_volume_name = None
self._current_process = None
self._process_stdout = []
Expand Down
3 changes: 2 additions & 1 deletion localizer/localizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from lib.metric_calculator import MetricCalculatorLogic
from lib.ai_decoupling import AIDecouplingLogic
from lib.atlas_manager import AtlasManager
from lib.core_executable import dccccore_executable_path
from lib.ui_components import TimeConsumingMessageBox, MarkupManager


Expand Down Expand Up @@ -92,7 +93,7 @@ def __init__(self, parent=None) -> None:

def _setPaths(self):
self.PLUGIN_PATH = Path(os.path.dirname(__file__))
self.EXECUTABLE_PATH = self.PLUGIN_PATH / "cpp" / "CentiloidCalculator"
self.EXECUTABLE_PATH = dccccore_executable_path(self.PLUGIN_PATH)
self.EXECUTABLE_DIR = self.PLUGIN_PATH / "cpp"

def _setNodes(self):
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.4)
project(DCCCcore VERSION 4.2.5)
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.4"
version = "4.2.5"
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.4";
const std::string SOFTWARE_VERSION = "4.2.5";
19 changes: 17 additions & 2 deletions localizer/src/tests/test_ui_metric_command_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ class _DummyQProcess:
MetricCalculatorLogic = _load_metric_calculator_logic()


def test_bundled_core_executable_matches_packaged_name():
logic = MetricCalculatorLogic("/tmp/plugin")
executable_name = "DCCCcore.exe" if sys.platform == "win32" else "DCCCcore"

assert logic.executable_path == Path("/tmp/plugin/cpp") / executable_name


def test_bundled_core_executable_uses_exe_suffix_on_windows():
from core_executable import dccccore_executable_path

assert dccccore_executable_path(
"/tmp/plugin", platform="win32"
) == Path("/tmp/plugin/cpp/DCCCcore.exe")


def test_build_command_uses_subcommand_cli_for_centaur():
logic = MetricCalculatorLogic("/tmp/plugin")

Expand Down Expand Up @@ -92,10 +107,10 @@ def test_macos_security_hint_mentions_quarantine_command(monkeypatch):

message = append_macos_security_hint(
"Operation not permitted",
"/tmp/plugin/cpp/CentiloidCalculator",
"/tmp/plugin/cpp/DCCCcore",
returncode=126,
)

assert "macOS may have blocked DCCCcore" in message
assert "xattr -dr com.apple.quarantine" in message
assert "/tmp/plugin/cpp/CentiloidCalculator" in message
assert "/tmp/plugin/cpp/DCCCcore" in message
Loading