Skip to content

Commit 6b7056d

Browse files
committed
⚰️ Remove support for AFNI ECM < v21.1.1
1 parent 81d0b6e commit 6b7056d

File tree

3 files changed

+24
-36
lines changed

3 files changed

+24
-36
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7171
- Inputs `[desc-motion_bold, bold]` from `coregistration_prep_vol` nodeblock.
7272
- `input` field from `coregistration` in blank and default config.
7373
- `reg_with_skull` swtich from `func_input_prep` in blank and default config.
74+
- Support for AFNI 3dECM < v21.1.1.
7475

7576
#### Removed CI dependency
7677

CPAC/network_centrality/network_centrality.py

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2015-2024 C-PAC Developers
1+
# Copyright (C) 2015-2025 C-PAC Developers
22

33
# This file is part of C-PAC.
44

@@ -14,6 +14,8 @@
1414

1515
# You should have received a copy of the GNU Lesser General Public
1616
# License along with C-PAC. If not, see <https://www.gnu.org/licenses/>.
17+
"""Network centrality."""
18+
1719
from pathlib import Path
1820
from typing import Optional
1921

@@ -23,7 +25,7 @@
2325
from CPAC.network_centrality.utils import ThresholdOptionError
2426
from CPAC.pipeline.schema import valid_options
2527
from CPAC.utils.docs import docstring_parameter
26-
from CPAC.utils.interfaces.afni import AFNI_GTE_21_1_1, ECM
28+
from CPAC.utils.interfaces.afni import ECM
2729

2830

2931
@docstring_parameter(
@@ -107,8 +109,6 @@ def create_centrality_wf(
107109
method_option, threshold_option = utils.check_centrality_params(
108110
method_option, threshold_option, test_thresh
109111
)
110-
# Eigenvector centrality and AFNI ≥ 21.1.1?
111-
ecm_gte_21_1_01 = (method_option == "eigenvector_centrality") and AFNI_GTE_21_1_1
112112
out_names = tuple(f"{method_option}_{x}" for x in weight_options)
113113
if base_dir is None:
114114
centrality_wf = pe.Workflow(name=wf_name)
@@ -135,32 +135,21 @@ def create_centrality_wf(
135135

136136
# Eigenvector centrality
137137
elif method_option == "eigenvector_centrality":
138-
if ecm_gte_21_1_01:
139-
afni_centrality_node = pe.MapNode(
140-
ECM(environ={"OMP_NUM_THREADS": str(num_threads)}),
141-
name="afni_centrality",
142-
mem_gb=memory_gb,
143-
iterfield=["do_binary", "out_file"],
144-
)
145-
afni_centrality_node.inputs.out_file = [
146-
f"eigenvector_centrality_{w_option}.nii.gz"
147-
for w_option in weight_options
148-
]
149-
afni_centrality_node.inputs.do_binary = [
150-
w_option == "Binarized" for w_option in weight_options
151-
]
152-
centrality_wf.connect(
153-
afni_centrality_node, "out_file", output_node, "outfile_list"
154-
)
155-
else:
156-
afni_centrality_node = pe.Node(
157-
ECM(environ={"OMP_NUM_THREADS": str(num_threads)}),
158-
name="afni_centrality",
159-
mem_gb=memory_gb,
160-
)
161-
afni_centrality_node.inputs.out_file = (
162-
"eigenvector_centrality_merged.nii.gz"
163-
)
138+
afni_centrality_node = pe.MapNode(
139+
ECM(environ={"OMP_NUM_THREADS": str(num_threads)}),
140+
name="afni_centrality",
141+
mem_gb=memory_gb,
142+
iterfield=["do_binary", "out_file"],
143+
)
144+
afni_centrality_node.inputs.out_file = [
145+
f"eigenvector_centrality_{w_option}.nii.gz" for w_option in weight_options
146+
]
147+
afni_centrality_node.inputs.do_binary = [
148+
w_option == "Binarized" for w_option in weight_options
149+
]
150+
centrality_wf.connect(
151+
afni_centrality_node, "out_file", output_node, "outfile_list"
152+
)
164153
afni_centrality_node.inputs.memory = memory_gb # 3dECM input only
165154

166155
# lFCD
@@ -172,8 +161,8 @@ def create_centrality_wf(
172161
)
173162
afni_centrality_node.inputs.out_file = "lfcd_merged.nii.gz"
174163

175-
if not ecm_gte_21_1_01:
176-
# Need to separate sub-briks except for 3dECM if AFNI > 21.1.01
164+
if method_option != "eigenvector_centrality":
165+
# Need to separate sub-briks except for 3dECM
177166
sep_subbriks_node = pe.Node(
178167
Function(
179168
input_names=["nifti_file", "out_names"],

CPAC/utils/interfaces/afni.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2023 C-PAC Developers
1+
# Copyright (C) 2023-2025 C-PAC Developers
22

33
# This file is part of C-PAC.
44

@@ -31,8 +31,6 @@
3131
_major, _minor, _patch = [int(part) for part in AFNI_SEMVER.split(".")]
3232
AFNI_SEMVER = str(semver.Version.parse(f"{_major}.{_minor}.{_patch}"))
3333
del _major, _minor, _patch
34-
AFNI_GTE_21_1_1 = semver.compare(AFNI_SEMVER, "21.1.1") >= 0
35-
"""AFNI version >= 21.1.1?"""
3634

3735

3836
class ECMInputSpec(_ECMInputSpec):
@@ -51,4 +49,4 @@ class ECM(_ECM):
5149
input_spec = ECMInputSpec
5250

5351

54-
__all__ = ["AFNI_GTE_21_1_1", "ECM"]
52+
__all__ = ["ECM"]

0 commit comments

Comments
 (0)