Skip to content

Commit

Permalink
Merged from master.
Browse files Browse the repository at this point in the history
  • Loading branch information
kathy-snider committed Jan 26, 2021
2 parents e3bb356 + 9fd8606 commit 7c56a65
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
36 changes: 18 additions & 18 deletions dcan_bold_proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
__prog__ = 'DCANBOLDProc'
__version__ = '4.0.0'
__doc__ = \
"""Wraps the compiled DCAN Signal Processing Matlab script, version: %s.
"""Wraps the compiled DCAN Signal Processing Matlab script, version: %s.
Runs in 3 main modes: [setup], [task], and [teardown].
[setup]: creates white matter and ventricular masks for regression, must be
[setup]: creates white matter and ventricular masks for regression, must be
run prior to task.
[task]: computes fd numbers [1][2], runs regressions on a given task/fmri [3]
and outputs a corrected dtseries, along with motion numbers in an
[task]: computes fd numbers [1][2], runs regressions on a given task/fmri [3]
and outputs a corrected dtseries, along with motion numbers in an
hdf5 (.mat) formatted file.
[teardown]: concatenates any resting state runs into a single dtseries, and
[teardown]: concatenates any resting state runs into a single dtseries, and
parcellates all final tasks.""" % __version__
__references__ = \
"""References
----------
[1] Fair DA, Miranda-Dominguez O, et al. Correction of respiratory artifacts
in MRI head motion estimates. bioRxiv [Internet]. 2018 Jan 1; Available from:
[1] Fair DA, Miranda-Dominguez O, et al. Correction of respiratory artifacts
in MRI head motion estimates. bioRxiv [Internet]. 2018 Jan 1; Available from:
http://biorxiv.org/content/early/2018/06/07/337360.abstract
[2] Power J, et al. Methods to detect, characterize, and remove motion
artifact in resting state fMRI. Neuroimage [Internet]. Elsevier Inc.; 2014
[2] Power J, et al. Methods to detect, characterize, and remove motion
artifact in resting state fMRI. Neuroimage [Internet]. Elsevier Inc.; 2014
Jan 1 [cited 2014 Jul 9];84:32041. doi: 10.1016/j.neuroimage.2013.08.048.
[3] Friston KJ, et al. Movement-related effects in fMRI time-series. Magn
[3] Friston KJ, et al. Movement-related effects in fMRI time-series. Magn
Reson Med [Internet]. 1996;35(3):34655. doi: 10.1016/j.neuroimage.2013.08.048
"""

Expand Down Expand Up @@ -91,7 +91,7 @@ def generate_parser(parser=None):
formatter_class=argparse.RawDescriptionHelpFormatter
)
parser.add_argument(
'-v', '--version', action='version',
'-v', '--version', action='version',
version='%s_v%s' % (__prog__, __version__),
help='print the software name and version'
)
Expand Down Expand Up @@ -297,7 +297,7 @@ def interface(subject, output_folder, task=None, fd_threshold=None,
'analyses_v2','timecourses'),
'result_dir': os.path.join(output_folder, 'MNINonLinear', 'Results',
task, version_name),
'summary_folder': os.path.join(output_folder,
'summary_folder': os.path.join(output_folder,
'summary_%s' % version_name),
'vent_mask': os.path.join(output_folder, 'MNINonLinear',
'vent_%gmm_%s_mask_eroded.nii.gz' % \
Expand All @@ -308,8 +308,8 @@ def interface(subject, output_folder, task=None, fd_threshold=None,
'wm_mask': os.path.join(output_folder, 'MNINonLinear',
'wm_%gmm_%s_mask_eroded.nii.gz' % \
(fmri_res, subject)),
'wm_mean_signal': os.path.join(output_folder, 'MNINonLinear',
'Results', task, version_name,
'wm_mean_signal': os.path.join(output_folder, 'MNINonLinear',
'Results', task, version_name,
'%s_wm_mean.txt' % task)
}
output_spec.update(kwargs.get('output_spec', {}))
Expand Down Expand Up @@ -338,14 +338,14 @@ def interface(subject, output_folder, task=None, fd_threshold=None,
os.mkdir(output_spec['summary_folder'])

if no_aparc:
label_override = dict(wm_lt_R=2, wm_ut_R=2, wm_lt_L=41,
label_override = dict(wm_lt_R=2, wm_ut_R=2, wm_lt_L=41,
wm_ut_L=41)
else:
label_override = {}

# create white matter and ventricle masks for regression
make_masks(input_spec['segmentation'], output_spec['wm_mask'],
output_spec['vent_mask'], fmri_res=fmri_res,
output_spec['vent_mask'], fmri_res=fmri_res,
roi_res=roi_res, **label_override)

elif teardown:
Expand All @@ -354,7 +354,7 @@ def interface(subject, output_folder, task=None, fd_threshold=None,
expr = re.compile(r'.*(task-[^_]+).*([0-9]+).*')
#tasknames = sorted(list(set([d[:-2] for d in alltasks
tasknames = sorted(list(set([expr.match(d).group(1) for d in alltasks
if os.path.isdir(os.path.join(output_results,d))
if os.path.isdir(os.path.join(output_results,d))
and 'task-' in d])))

concatlist = []
Expand Down Expand Up @@ -645,7 +645,7 @@ def parcellate(concatlist, output_folder):
'Results')
output_concat_dtseries = os.path.join(base_results_folder,
'%s_%s_Atlas.dtseries.nii' %
(taskname, version_name))
(taskname, version_name))
# parcellation
for parcel_name, score in parcellations:
print("Parcellating with %s" % parcel_name)
Expand Down
4 changes: 2 additions & 2 deletions matlab_code/dcan_signal_processing.m
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ function dcan_signal_processing(config_path)
ix_ol = find(th==0); % find index movers > fd_th
ix_in = find(th==1); % find index low motion number

if ix_in <= 10
if numel(ix_in) <= 10
int_method = 'none';
err_msg = ['WARNING: There are only ', num2str(ix_in), ...
err_msg = ['WARNING: There are only ', num2str(numel(ix_in)), ...
' frames below the fd threshold of ', ...
num2str(fd_th), '. Skipping interpolation.'];
disp(err_msg)
Expand Down

0 comments on commit 7c56a65

Please sign in to comment.