Skip to content

Commit bfcfa94

Browse files
committed
ENH: added the correlation maps to the output afni NetCorr
1 parent 380d798 commit bfcfa94

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

nipype/interfaces/afni/preprocess.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2684,8 +2684,9 @@ class NetCorrInputSpec(AFNICommandInputSpec):
26842684
)
26852685

26862686
class NetCorrOutputSpec(TraitedSpec):
2687-
out_matrix = File(desc="output text file for correlation stats")
2688-
2687+
out_corr_matrix = File(desc="output correlation matrix between ROIs written to a text file with .netcc suffix")
2688+
out_corr_maps = traits.List(File(), desc="output correlation maps in Pearson and/or Z-scores")
2689+
26892690
class NetCorr(AFNICommand):
26902691
"""Calculate correlation matrix of a set of ROIs (using mean time series of
26912692
each). Several networks may be analyzed simultaneously, one per brick.
@@ -2715,6 +2716,8 @@ class NetCorr(AFNICommand):
27152716
output_spec = NetCorrOutputSpec
27162717

27172718
def _list_outputs(self):
2719+
import glob
2720+
27182721
outputs = self.output_spec().get()
27192722

27202723
if not isdefined(self.inputs.out_file):
@@ -2723,11 +2726,13 @@ def _list_outputs(self):
27232726
prefix = self.inputs.out_file
27242727

27252728
# All outputs should be in the same directory as the prefix
2726-
out_dir = os.path.dirname(os.path.abspath(prefix))
2729+
odir = os.path.dirname(os.path.abspath(prefix))
2730+
outputs["out_corr_matrix"] = glob.glob(os.path.join(odir, "*.netcc"))[0]
2731+
2732+
if isdefined(self.inputs.ts_wb_corr) or isdefined(self.inputs.ts_Z_corr):
2733+
corrdir = os.path.join(odir, prefix + "_000_INDIV")
2734+
outputs["out_corr_maps"] = glob.glob(os.path.join(corrdir, "*.nii.gz"))
27272735

2728-
outputs["out_matrix"] = (
2729-
fname_presuffix(prefix, suffix="_000", use_ext=False, newpath=out_dir) + ".netcc"
2730-
)
27312736
return outputs
27322737

27332738

0 commit comments

Comments
 (0)