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
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+
1719from pathlib import Path
1820from typing import Optional
1921
2325from CPAC .network_centrality .utils import ThresholdOptionError
2426from CPAC .pipeline .schema import valid_options
2527from 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" ],
0 commit comments