@@ -2556,6 +2556,79 @@ def _format_arg(self, name, trait_spec, value):
25562556 return super (TCorrMap , self )._format_arg (name , trait_spec , value )
25572557
25582558
2559+ class NetCorrInputSpec (AFNICommandInputSpec ):
2560+ in_file = File (exists = True , argstr = "-inset %s" , mandatory = True )
2561+ in_rois = File (exists = True , argstr = "-in_rois %s" , mandatory = True )
2562+ mask = File (exists = True , argstr = "-mask %s" )
2563+ weight_ts = File (exists = True , argstr = "-weight_ts %s" )
2564+ fish_z = traits .Bool (argstr = "-fish_z" )
2565+ part_corr = traits .Bool (argstr = "-part_corr" )
2566+ ts_out = traits .Bool (argstr = "-ts_out" )
2567+ ts_label = traits .Bool (argstr = "-ts_label" )
2568+ ts_indiv = traits .Bool (argstr = "-ts_indiv" )
2569+ ts_wb_corr = traits .Bool (argstr = "-ts_wb_corr" )
2570+ ts_wb_Z = traits .Bool (argstr = "-ts_wb_Z" )
2571+ ts_wb_strlabel = traits .Bool (argstr = "-ts_wb_strlabel" )
2572+ nifti = traits .Bool (argstr = "-nifti" )
2573+ output_mask_nonnull = traits .Bool (argstr = "-output_mask_nonnull" )
2574+ push_thru_many_zeros = traits .Bool (argstr = "-push_thru_many_zeros" )
2575+ ignore_LT = traits .Bool (argstr = "-ignore_LT" )
2576+ out_file = File (
2577+ name_template = "%s_netcorr" ,
2578+ desc = "output file name part" ,
2579+ argstr = "-prefix %s" ,
2580+ position = 1 ,
2581+ name_source = "in_file" ,
2582+ )
2583+
2584+ class NetCorrOutputSpec (TraitedSpec ):
2585+ out_matrix = File (desc = "output text file for correlation stats" )
2586+
2587+ class NetCorr (AFNICommand ):
2588+ """Calculate correlation matrix of a set of ROIs (using mean time series of
2589+ each). Several networks may be analyzed simultaneously, one per brick.
2590+
2591+ For complete details, see the `3dTcorrMap Documentation.
2592+ <https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dNetCorr.html>`_
2593+
2594+ Examples
2595+ --------
2596+ >>> from nipype.interfaces import afni
2597+ >>> ncorr = afni.NetCorr()
2598+ >>> ncorr.inputs.in_file = 'functional.nii'
2599+ >>> ncorr.inputs.mask = 'mask.nii'
2600+ >>> ncorr.inputs.in_rois = 'rois.nii'
2601+ >>> ncorr.inputs.ts_wb_corr = True
2602+ >>> ncorr.inputs.ts_wb_Z = True
2603+ >>> ncorr.inputs.fish_z = True
2604+ >>> ncorr.inputs.prefix = 'sub0.tp1.ncorr'
2605+ >>> ncorr.cmdline # doctest: +SKIP
2606+ '3dNetCorr -prefix sub0.tp1.ncorr -inset functional.nii -mask mask.nii -in_rois rois.nii -ts_wb_corr -ts_wb_Z -fish_z'
2607+ >>> res = ncorr.run() # doctest: +SKIP
2608+
2609+ """
2610+
2611+ _cmd = "3dNetCorr"
2612+ input_spec = NetCorrInputSpec
2613+ output_spec = NetCorrOutputSpec
2614+
2615+ def _list_outputs (self ):
2616+ outputs = self .output_spec ().get ()
2617+
2618+ if not isdefined (self .inputs .out_file ):
2619+ prefix = self ._gen_fname (self .inputs .in_file , suffix = "_netcorr" )
2620+ else :
2621+ prefix = self .inputs .out_file
2622+
2623+ # All outputs should be in the same directory as the prefix
2624+ out_dir = os .path .dirname (os .path .abspath (prefix ))
2625+
2626+ outputs ["out_matrix" ] = (
2627+ fname_presuffix (prefix , suffix = "_000" , use_ext = False , newpath = out_dir ) + ".netcc"
2628+ )
2629+ return outputs
2630+
2631+
25592632class TCorrelateInputSpec (AFNICommandInputSpec ):
25602633 xset = File (
25612634 desc = "input xset" ,
0 commit comments