Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ENH: added the correlation maps to the output afni NetCorr
  • Loading branch information
aghayoor committed Mar 4, 2021
commit bfcfa94e3668ff57c5a7139dd76571e0cde429c8
17 changes: 11 additions & 6 deletions nipype/interfaces/afni/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -2684,8 +2684,9 @@ class NetCorrInputSpec(AFNICommandInputSpec):
)

class NetCorrOutputSpec(TraitedSpec):
out_matrix = File(desc="output text file for correlation stats")

out_corr_matrix = File(desc="output correlation matrix between ROIs written to a text file with .netcc suffix")
out_corr_maps = traits.List(File(), desc="output correlation maps in Pearson and/or Z-scores")

class NetCorr(AFNICommand):
"""Calculate correlation matrix of a set of ROIs (using mean time series of
each). Several networks may be analyzed simultaneously, one per brick.
Expand Down Expand Up @@ -2715,6 +2716,8 @@ class NetCorr(AFNICommand):
output_spec = NetCorrOutputSpec

def _list_outputs(self):
import glob

outputs = self.output_spec().get()

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

# All outputs should be in the same directory as the prefix
out_dir = os.path.dirname(os.path.abspath(prefix))
odir = os.path.dirname(os.path.abspath(prefix))
outputs["out_corr_matrix"] = glob.glob(os.path.join(odir, "*.netcc"))[0]

if isdefined(self.inputs.ts_wb_corr) or isdefined(self.inputs.ts_Z_corr):
corrdir = os.path.join(odir, prefix + "_000_INDIV")
outputs["out_corr_maps"] = glob.glob(os.path.join(corrdir, "*.nii.gz"))

outputs["out_matrix"] = (
fname_presuffix(prefix, suffix="_000", use_ext=False, newpath=out_dir) + ".netcc"
)
return outputs


Expand Down